Skip to content

Commit edb1586

Browse files
committed
Align description of integration footer content
Details of proposed mapping mechanism didn't match between the overview and DPC++ FE sections: aligned them to use function template in both cases. Also added `inline` keyword to `get_spec_constant_symbolic_ID` function template.
1 parent 82882b9 commit edb1586

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

sycl/doc/SYCL2020-SpecializationConstants.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Based on those limitations, the following mapping design is proposed:
102102
```
103103
namespace detail {
104104
template<auto &SpecName>
105-
const char *get_spec_constant_symbolic_ID();
105+
inline const char *get_spec_constant_symbolic_ID();
106106
}
107107
```
108108
Which is only declared, but not defined in there and used to retrieve required
@@ -120,11 +120,11 @@ Based on those limitations, the following mapping design is proposed:
120120
// };
121121
122122
template<>
123-
const char *get_spec_constant_symbolic_ID<int_const>() {
123+
inline const char *get_spec_constant_symbolic_ID<int_const>() {
124124
return "unique_name_for_int_const";
125125
}
126126
template<>
127-
const char *get_spec_constant_symbolic_ID<Wrapper::float_const>() {
127+
inline const char *get_spec_constant_symbolic_ID<Wrapper::float_const>() {
128128
return "unique_name_for_Wrapper_float_const";
129129
}
130130
}
@@ -712,24 +712,20 @@ Will look like:
712712
namespace detail {
713713
// generic declaration
714714
template<auto &SpecName>
715-
struct get_symbolic_id_helper{};
715+
inline const char *get_spec_constant_symbolic_ID();
716716
717717
// specializations for each specialization constant:
718718
// we can refer to all those specialization_id variables, because integration
719719
// footer was _appended_ to the user-provided translation unit
720720
template<>
721-
struct get_symbolic_id_helper<id_int> {
722-
static const char *get_symbolic_id() {
723-
return "result of __builtin_unique_ID(id_int) encoded here";
724-
}
725-
};
721+
inline const char *get_spec_constant_symbolic_ID() {
722+
return "result of __builtin_unique_ID(id_int) encoded here";
723+
}
726724
727725
template<>
728-
struct get_symbolic_id_helper<id_A> {
729-
static const char *get_symbolic_id() {
730-
return "result of __builtin_unique_ID(A) encoded here";
731-
}
732-
};
726+
inline const char *get_spec_constant_symbolic_ID() {
727+
return "result of __builtin_unique_ID(A) encoded here";
728+
}
733729
734730
} // namespace detail
735731

0 commit comments

Comments
 (0)