|
17 | 17 |
|
18 | 18 | // IWYU pragma: always_keep |
19 | 19 |
|
20 | | -#if __cplusplus < 202002L |
| 20 | +#if __cplusplus < 2020'02L |
21 | 21 | # if defined(_MSC_VER) && !defined(__clang__) |
22 | 22 | # error This library requires the use of C++20. Use /Zc:__cplusplus to enable __cplusplus conformance. |
23 | 23 | # else |
|
47 | 47 | // they expand to the arguments if if the current compiler corresponds to the |
48 | 48 | // macro name; nothing, otherwise. |
49 | 49 | #if defined(__NVCC__) |
50 | | -# define STDEXEC_NVCC(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
| 50 | +# define STDEXEC_NVCC() 1 |
51 | 51 | # define STDEXEC_NVCC_VERSION (__CUDACC_VER_MAJOR__ * 100 + __CUDACC_VER_MINOR__) |
52 | 52 | #elif defined(__EDG__) |
53 | | -# define STDEXEC_EDG(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
| 53 | +# define STDEXEC_EDG() 1 |
54 | 54 | # define STDEXEC_EDG_VERSION __EDG_VERSION__ |
55 | 55 | # if defined(__NVCOMPILER) |
56 | | -# define STDEXEC_NVHPC(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
| 56 | +# define STDEXEC_NVHPC() 1 |
57 | 57 | # define STDEXEC_NVHPC_VERSION (__NVCOMPILER_MAJOR__ * 100 + __NVCOMPILER_MINOR__) |
58 | 58 | # endif |
59 | 59 | # if defined(__INTELLISENSE__) |
60 | | -# define STDEXEC_INTELLISENSE(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
61 | | -# define STDEXEC_MSVC_HEADERS(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
| 60 | +# define STDEXEC_INTELLISENSE() 1 |
| 61 | +# define STDEXEC_MSVC_HEADERS() 1 |
62 | 62 | # endif |
63 | 63 | #elif defined(__clang__) |
64 | | -# define STDEXEC_CLANG(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
| 64 | +# define STDEXEC_CLANG() 1 |
65 | 65 | # define STDEXEC_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) |
66 | 66 | # if defined(_MSC_VER) |
67 | | -# define STDEXEC_CLANG_CL(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
| 67 | +# define STDEXEC_CLANG_CL() 1 |
68 | 68 | # endif |
69 | 69 | # if defined(__apple_build_version__) |
70 | | -# define STDEXEC_APPLE_CLANG(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
| 70 | +# define STDEXEC_APPLE_CLANG() 1 |
71 | 71 | // Apple clang version is encoded as major * 1000000 + minor * 1000 + patch. We ignore the patch |
72 | 72 | // version here, as it is not relevant for the purposes of this library. |
73 | 73 | # define STDEXEC_APPLE_CLANG_VERSION (__apple_build_version__ / 1000) |
74 | 74 | # endif |
75 | 75 | #elif defined(__GNUC__) |
76 | | -# define STDEXEC_GCC(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
| 76 | +# define STDEXEC_GCC() 1 |
77 | 77 | # define STDEXEC_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) |
78 | 78 | #elif defined(_MSC_VER) |
79 | | -# define STDEXEC_MSVC(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
80 | | -# define STDEXEC_MSVC_HEADERS(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
81 | | -# define STDEXEC_MSVC_VERSION _MSC_VER |
| 79 | +# define STDEXEC_MSVC() 1 |
| 80 | +# define STDEXEC_MSVC_HEADERS() 1 |
| 81 | +# define STDEXEC_MSVC_VERSION _MSC_VER |
82 | 82 | #endif |
83 | 83 |
|
84 | 84 | #ifndef STDEXEC_NVCC |
85 | | -# define STDEXEC_NVCC(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) |
| 85 | +# define STDEXEC_NVCC() 0 |
86 | 86 | #endif |
87 | 87 | #ifndef STDEXEC_NVHPC |
88 | | -# define STDEXEC_NVHPC(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) |
| 88 | +# define STDEXEC_NVHPC() 0 |
89 | 89 | #endif |
90 | 90 | #ifndef STDEXEC_EDG |
91 | | -# define STDEXEC_EDG(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) |
| 91 | +# define STDEXEC_EDG() 0 |
92 | 92 | #endif |
93 | 93 | #ifndef STDEXEC_CLANG |
94 | | -# define STDEXEC_CLANG(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) |
| 94 | +# define STDEXEC_CLANG() 0 |
95 | 95 | #endif |
96 | 96 | #ifndef STDEXEC_CLANG_CL |
97 | | -# define STDEXEC_CLANG_CL(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) |
| 97 | +# define STDEXEC_CLANG_CL() 0 |
98 | 98 | #endif |
99 | 99 | #ifndef STDEXEC_APPLE_CLANG |
100 | | -# define STDEXEC_APPLE_CLANG(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) |
| 100 | +# define STDEXEC_APPLE_CLANG() 0 |
101 | 101 | #endif |
102 | 102 | #ifndef STDEXEC_GCC |
103 | | -# define STDEXEC_GCC(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) |
| 103 | +# define STDEXEC_GCC() 0 |
104 | 104 | #endif |
105 | 105 | #ifndef STDEXEC_MSVC |
106 | | -# define STDEXEC_MSVC(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) |
| 106 | +# define STDEXEC_MSVC() 0 |
107 | 107 | #endif |
108 | 108 | #ifndef STDEXEC_MSVC_HEADERS |
109 | | -# define STDEXEC_MSVC_HEADERS(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) |
| 109 | +# define STDEXEC_MSVC_HEADERS() 0 |
110 | 110 | #endif |
111 | 111 | #ifndef STDEXEC_INTELLISENSE |
112 | | -# define STDEXEC_INTELLISENSE(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) |
| 112 | +# define STDEXEC_INTELLISENSE() 0 |
113 | 113 | #endif |
114 | 114 |
|
115 | 115 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
116 | 116 | #if defined(__CUDACC__) || STDEXEC_NVHPC() |
117 | | -# define STDEXEC_CUDA_COMPILATION(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
| 117 | +# define STDEXEC_CUDA_COMPILATION() 1 |
118 | 118 | #else |
119 | | -# define STDEXEC_CUDA_COMPILATION(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) |
| 119 | +# define STDEXEC_CUDA_COMPILATION() 0 |
120 | 120 | #endif |
121 | 121 |
|
122 | 122 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
|
134 | 134 | #endif |
135 | 135 |
|
136 | 136 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
137 | | -#if __cpp_impl_coroutine >= 201902 && __cpp_lib_coroutine >= 201902 |
| 137 | +#if __cpp_impl_coroutine >= 2019'02 && __cpp_lib_coroutine >= 2019'02 |
138 | 138 | # include <coroutine> // IWYU pragma: keep |
139 | 139 | # define STDEXEC_STD_NO_COROUTINES() 0 |
140 | 140 | namespace __coro = std; // NOLINT(misc-unused-alias-decls) |
@@ -185,7 +185,8 @@ namespace __coro = std::experimental; |
185 | 185 | # endif |
186 | 186 | #elif STDEXEC_CLANG_CL() |
187 | 187 | // clang-cl does not support [[no_unique_address]]: https://reviews.llvm.org/D110485 |
188 | | -# if STDEXEC_CLANG_VERSION < 18'01 // TODO: Find the version that started supporting [[msvc::no_unique_address]] |
| 188 | +// TODO: Find the version that started supporting [[msvc::no_unique_address]] |
| 189 | +# if STDEXEC_CLANG_VERSION < 18'01 |
189 | 190 | # define STDEXEC_ATTR_WHICH_3(_ATTR) /*nothing*/ |
190 | 191 | # else |
191 | 192 | # define STDEXEC_ATTR_WHICH_3(_ATTR) [[msvc::no_unique_address]] |
@@ -377,7 +378,7 @@ namespace stdexec { |
377 | 378 | inline constexpr bool __same_as_v<_Ap, _Ap> = true; |
378 | 379 | } // namespace stdexec |
379 | 380 |
|
380 | | -#if defined(__cpp_lib_unreachable) && __cpp_lib_unreachable >= 202202L |
| 381 | +#if defined(__cpp_lib_unreachable) && __cpp_lib_unreachable >= 2022'02L |
381 | 382 | # define STDEXEC_UNREACHABLE() std::unreachable() |
382 | 383 | #elif STDEXEC_HAS_BUILTIN(__builtin_unreachable) |
383 | 384 | # define STDEXEC_UNREACHABLE() __builtin_unreachable() |
@@ -420,41 +421,42 @@ namespace stdexec { |
420 | 421 | // Some compilers turn on pack indexing in pre-C++26 code. We want to use it if it is |
421 | 422 | // available. Pack indexing is disabled for clang < 20 because of: |
422 | 423 | // https://github.com/llvm/llvm-project/issues/116105 |
423 | | -#if defined(__cpp_pack_indexing) && !STDEXEC_NVCC() && !(STDEXEC_CLANG() && STDEXEC_CLANG_VERSION < 20'00) |
424 | | -# define STDEXEC_HAS_PACK_INDEXING() 1 |
| 424 | +#if defined(__cpp_pack_indexing) && !STDEXEC_NVCC() \ |
| 425 | + && !(STDEXEC_CLANG() && STDEXEC_CLANG_VERSION < 20'00) |
| 426 | +# define STDEXEC_STD_NO_PACK_INDEXING() 0 |
425 | 427 | #else // ^^^ has pack indexing ^^^ / vvv no pack indexing vvv |
426 | | -# define STDEXEC_HAS_PACK_INDEXING() 0 |
| 428 | +# define STDEXEC_STD_NO_PACK_INDEXING() 1 |
427 | 429 | #endif // no pack indexing |
428 | 430 |
|
429 | 431 | #if STDEXEC_HAS_FEATURE(thread_sanitizer) || defined(__SANITIZE_THREAD__) |
430 | | -# define STDEXEC_TSAN(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
| 432 | +# define STDEXEC_TSAN() 1 |
431 | 433 | #else |
432 | | -# define STDEXEC_TSAN(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) |
| 434 | +# define STDEXEC_TSAN() 0 |
433 | 435 | #endif |
434 | 436 |
|
435 | 437 | // Before clang-16, clang did not like libstdc++'s ranges implementation |
436 | 438 | #if __has_include(<ranges>) && \ |
437 | | - (defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 201911L) && \ |
| 439 | + (defined(__cpp_lib_ranges) && __cpp_lib_ranges >= 2019'11L) && \ |
438 | 440 | (!STDEXEC_CLANG() || STDEXEC_CLANG_VERSION >= 16'00 || defined(_LIBCPP_VERSION)) |
439 | 441 | # define STDEXEC_HAS_STD_RANGES() 1 |
440 | 442 | #else |
441 | 443 | # define STDEXEC_HAS_STD_RANGES() 0 |
442 | 444 | #endif |
443 | 445 |
|
444 | 446 | #if __has_include(<memory_resource>) && \ |
445 | | - (defined(__cpp_lib_memory_resource) && __cpp_lib_memory_resource >= 201603L) |
| 447 | + (defined(__cpp_lib_memory_resource) && __cpp_lib_memory_resource >= 2016'03L) |
446 | 448 | # define STDEXEC_HAS_STD_MEMORY_RESOURCE() 1 |
447 | 449 | #else |
448 | 450 | # define STDEXEC_HAS_STD_MEMORY_RESOURCE() 0 |
449 | 451 | #endif |
450 | 452 |
|
451 | | -#if defined(__cpp_lib_execution) && __cpp_lib_execution >= 201603L |
| 453 | +#if defined(__cpp_lib_execution) && __cpp_lib_execution >= 2016'03L |
452 | 454 | # define STDEXEC_HAS_EXECUTION_POLICY() 1 |
453 | 455 | #else |
454 | 456 | # define STDEXEC_HAS_EXECUTION_POLICY() 0 |
455 | 457 | #endif |
456 | 458 |
|
457 | | -#if defined(__cpp_lib_execution) && __cpp_lib_execution >= 201902L |
| 459 | +#if defined(__cpp_lib_execution) && __cpp_lib_execution >= 2019'02L |
458 | 460 | # define STDEXEC_HAS_UNSEQUENCED_EXECUTION_POLICY() 1 |
459 | 461 | #else |
460 | 462 | # define STDEXEC_HAS_UNSEQUENCED_EXECUTION_POLICY() 0 |
@@ -486,10 +488,10 @@ namespace stdexec { |
486 | 488 | # define STDEXEC_FRIENDSHIP_IS_LEXICAL() 0 |
487 | 489 | #endif |
488 | 490 |
|
489 | | -#if defined(__cpp_explicit_this_parameter) && (__cpp_explicit_this_parameter >= 202110) |
490 | | -# define STDEXEC_EXPLICIT_THIS(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) |
| 491 | +#if defined(__cpp_explicit_this_parameter) && (__cpp_explicit_this_parameter >= 2021'10L) |
| 492 | +# define STDEXEC_EXPLICIT_THIS() 1 |
491 | 493 | #else |
492 | | -# define STDEXEC_EXPLICIT_THIS(...) STDEXEC_HEAD_OR_NULL(0, __VA_ARGS__) |
| 494 | +# define STDEXEC_EXPLICIT_THIS() 0 |
493 | 495 | #endif |
494 | 496 |
|
495 | 497 | #if STDEXEC_ENABLE_EXTRA_TYPE_CHECKING == 0 |
|
0 commit comments