Skip to content

Commit 791057e

Browse files
[NFC][SYCL] Use "inline constexpr" unconditionally (#7688)
C++17 is minimally supported standard, so it is always available to us.
1 parent adfb1c1 commit 791057e

File tree

6 files changed

+19
-31
lines changed

6 files changed

+19
-31
lines changed

sycl/include/sycl/detail/defines_elementary.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,6 @@
5555
#endif
5656
#endif // __SYCL2020_DEPRECATED
5757

58-
#ifndef __SYCL_INLINE_CONSTEXPR
59-
// inline constexpr is a C++17 feature
60-
#if __cplusplus >= 201703L
61-
#define __SYCL_INLINE_CONSTEXPR inline constexpr
62-
#else
63-
#define __SYCL_INLINE_CONSTEXPR static constexpr
64-
#endif
65-
#endif // __SYCL_INLINE_CONSTEXPR
66-
6758
#ifndef __SYCL_HAS_CPP_ATTRIBUTE
6859
#if defined(__cplusplus) && defined(__has_cpp_attribute)
6960
#define __SYCL_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)

sycl/include/sycl/detail/type_traits.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ template <typename ElementType, access::address_space Space,
6666
class multi_ptr;
6767

6868
template <class T>
69-
__SYCL_INLINE_CONSTEXPR bool is_group_v =
69+
inline constexpr bool is_group_v =
7070
detail::is_group<T>::value || detail::is_sub_group<T>::value;
7171

7272
namespace ext::oneapi::experimental {
7373
template <class T>
74-
__SYCL_INLINE_CONSTEXPR bool is_group_helper_v =
74+
inline constexpr bool is_group_helper_v =
7575
detail::is_group_helper<std::decay_t<T>>::value;
7676
} // namespace ext::oneapi::experimental
7777

sycl/include/sycl/ext/oneapi/atomic_enums.hpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,28 @@ namespace oneapi {
2626

2727
using memory_order __SYCL2020_DEPRECATED("use 'sycl::memory_order' instead") =
2828
sycl::memory_order;
29-
__SYCL_INLINE_CONSTEXPR memory_order memory_order_relaxed __SYCL2020_DEPRECATED(
29+
inline constexpr memory_order memory_order_relaxed __SYCL2020_DEPRECATED(
3030
"use 'sycl::memory_order_relaxed' instead") = memory_order::relaxed;
31-
__SYCL_INLINE_CONSTEXPR memory_order memory_order_acquire __SYCL2020_DEPRECATED(
31+
inline constexpr memory_order memory_order_acquire __SYCL2020_DEPRECATED(
3232
"use 'sycl::memory_order_acquire' instead") = memory_order::acquire;
33-
__SYCL_INLINE_CONSTEXPR memory_order memory_order_release __SYCL2020_DEPRECATED(
33+
inline constexpr memory_order memory_order_release __SYCL2020_DEPRECATED(
3434
"use 'sycl::memory_order_release' instead") = memory_order::release;
35-
__SYCL_INLINE_CONSTEXPR memory_order memory_order_acq_rel __SYCL2020_DEPRECATED(
35+
inline constexpr memory_order memory_order_acq_rel __SYCL2020_DEPRECATED(
3636
"use 'sycl::memory_order_acq_rel' instead") = memory_order::acq_rel;
37-
__SYCL_INLINE_CONSTEXPR memory_order memory_order_seq_cst __SYCL2020_DEPRECATED(
37+
inline constexpr memory_order memory_order_seq_cst __SYCL2020_DEPRECATED(
3838
"use 'sycl::memory_order_seq_cst' instead") = memory_order::seq_cst;
3939

4040
using memory_scope __SYCL2020_DEPRECATED("use 'sycl::memory_scope' instead") =
4141
sycl::memory_scope;
42-
__SYCL_INLINE_CONSTEXPR
43-
memory_scope memory_scope_work_item __SYCL2020_DEPRECATED(
42+
inline constexpr memory_scope memory_scope_work_item __SYCL2020_DEPRECATED(
4443
"use 'sycl::memory_scope_work_item' instead") = memory_scope::work_item;
45-
__SYCL_INLINE_CONSTEXPR
46-
memory_scope memory_scope_sub_group __SYCL2020_DEPRECATED(
44+
inline constexpr memory_scope memory_scope_sub_group __SYCL2020_DEPRECATED(
4745
"use 'sycl::memory_scope_sub_group' instead") = memory_scope::sub_group;
48-
__SYCL_INLINE_CONSTEXPR memory_scope memory_scope_work_group
49-
__SYCL2020_DEPRECATED("use 'sycl::memory_scope_work_group' instead") =
50-
memory_scope::work_group;
51-
__SYCL_INLINE_CONSTEXPR memory_scope memory_scope_device __SYCL2020_DEPRECATED(
46+
inline constexpr memory_scope memory_scope_work_group __SYCL2020_DEPRECATED(
47+
"use 'sycl::memory_scope_work_group' instead") = memory_scope::work_group;
48+
inline constexpr memory_scope memory_scope_device __SYCL2020_DEPRECATED(
5249
"use 'sycl::memory_scope_device' instead") = memory_scope::device;
53-
__SYCL_INLINE_CONSTEXPR memory_scope memory_scope_system __SYCL2020_DEPRECATED(
50+
inline constexpr memory_scope memory_scope_system __SYCL2020_DEPRECATED(
5451
"use 'sycl::memory_scope_system' instead") = memory_scope::system;
5552

5653
#ifndef __SYCL_DEVICE_ONLY__

sycl/include/sycl/known_identity.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ struct has_known_identity
383383
std::decay_t<AccumulatorT>> {};
384384

385385
template <typename BinaryOperation, typename AccumulatorT>
386-
__SYCL_INLINE_CONSTEXPR bool has_known_identity_v =
386+
inline constexpr bool has_known_identity_v =
387387
sycl::has_known_identity<BinaryOperation, AccumulatorT>::value;
388388

389389
// ---- known_identity
@@ -393,7 +393,7 @@ struct known_identity
393393
std::decay_t<AccumulatorT>> {};
394394

395395
template <typename BinaryOperation, typename AccumulatorT>
396-
__SYCL_INLINE_CONSTEXPR AccumulatorT known_identity_v =
396+
inline constexpr AccumulatorT known_identity_v =
397397
sycl::known_identity<BinaryOperation, AccumulatorT>::value;
398398

399399
} // __SYCL_INLINE_VER_NAMESPACE(_V1)

sycl/include/sycl/properties/accessor_properties.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class __SYCL2020_DEPRECATED("spelling is now: no_init") noinit
2525

2626
} // namespace property
2727

28-
__SYCL_INLINE_CONSTEXPR property::no_init no_init;
28+
inline constexpr property::no_init no_init;
2929

3030
__SYCL2020_DEPRECATED("spelling is now: no_init")
31-
__SYCL_INLINE_CONSTEXPR property::noinit noinit;
31+
inline constexpr property::noinit noinit;
3232

3333
namespace ext {
3434
namespace intel {

sycl/include/sycl/properties/property_traits.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ template <typename propertyT, typename syclObjectT>
2424
struct is_property_of : public std::false_type {};
2525

2626
template <typename propertyT>
27-
__SYCL_INLINE_CONSTEXPR bool is_property_v = is_property<propertyT>::value;
27+
inline constexpr bool is_property_v = is_property<propertyT>::value;
2828

2929
template <typename propertyT, typename syclObjectT>
30-
__SYCL_INLINE_CONSTEXPR bool is_property_of_v =
30+
inline constexpr bool is_property_of_v =
3131
is_property_of<propertyT, syclObjectT>::value;
3232

3333
} // __SYCL_INLINE_VER_NAMESPACE(_V1)

0 commit comments

Comments
 (0)