-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
In between the large static sections of "feature-test macros defined to a static value in C++X -or-later" we have sections of "feature test macros defined to Y in c++MEOW or Z in C++WOOF". For example:
Lines 1323 to 1353 in f75c7f5
| #ifndef _M_CEE | |
| #if _HAS_CXX20 | |
| #define __cpp_lib_execution 201902L // P1001R2 execution::unseq | |
| #elif _HAS_CXX17 | |
| #define __cpp_lib_execution 201603L // P0024R2 Parallel Algorithms | |
| #endif // language mode | |
| #endif // _M_CEE | |
| #if _HAS_CXX20 | |
| #define __cpp_lib_array_constexpr 201811L // P1032R1 Miscellaneous constexpr | |
| #elif _HAS_CXX17 // ^^^ _HAS_CXX20 / _HAS_CXX17 vvv | |
| #define __cpp_lib_array_constexpr 201803L | |
| #endif // _HAS_CXX17 | |
| #if _HAS_CXX20 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 | |
| #define __cpp_lib_chrono 201907L // P1466R3 Miscellaneous Minor Fixes For <chrono> | |
| #elif _HAS_CXX17 | |
| #define __cpp_lib_chrono 201611L // P0505R0 constexpr For <chrono> (Again) | |
| #else // _HAS_CXX17 | |
| #define __cpp_lib_chrono 201510L // P0092R1 <chrono> floor(), ceil(), round(), abs() | |
| #endif // _HAS_CXX17 | |
| #if _HAS_CXX20 | |
| #define __cpp_lib_shared_ptr_arrays 201707L // P0674R1 make_shared() For Arrays | |
| #else // _HAS_CXX20 | |
| #define __cpp_lib_shared_ptr_arrays 201611L // P0497R0 Fixing shared_ptr For Arrays | |
| #endif // _HAS_CXX20 | |
| #if defined(__cpp_impl_coroutine) || defined(_DOWNLEVEL_COROUTINES_SUPPORTED) // TRANSITION, Clang coroutine support | |
| #define __cpp_lib_coroutine 201902L | |
| #endif // __cpp_impl_coroutine |
These conditional sections have grown somewhat organically and have therefore become quite messy. I suggested in #2005 (comment) that we should reorder all such sections lexicographically by feature-test macro name. @AdamBucior suggests we should instead disable C4005 in the portion of <yvals_core.h> that defines feature-test macros to allow redefinitions so we can define everything consistently in the static sections.
The latter suggestion seems cleaner to me despite the need to suppress a warning, and should work fine with modules IIUC since the all definitions (both original and redefinitions) of each feature-test macro would appear in the same file.