Skip to content

Commit

Permalink
<yvals_core.h>: Fix <bit> feature-test macros (#695)
Browse files Browse the repository at this point in the history
* Don't define `__cpp_lib_bitops` when `__EDG__`, so IntelliSense is consistent with MSVC
* Don't define `__cpp_lib_int_pow2` when `__cpp_lib_bitops` isn't defined since the facilities that correspond with `__cpp_lib_int_pow2` are only provided when `__cpp_lib_bitops` is defined.
* Update feature-test macro test accordingly

(See discussion starting at #313 (comment).)
  • Loading branch information
CaseyCarter authored Apr 10, 2020
1 parent 2597e24 commit 0055b5b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
40 changes: 21 additions & 19 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1092,12 +1092,10 @@
#define __cpp_lib_bit_cast 201806L
#endif // __EDG__

#if defined(__clang__) || defined(__EDG__)
#define __cpp_lib_bitops 201907L
#else // ^^^ Clang and EDG / MSVC vvv
#ifdef __clang__ // TRANSITION, VSO-1020212
// a future MSVC update will embed CPU feature detection into <bit> intrinsics
// TRANSITION, VSO-1020212
#endif // defined(__clang__) || defined(__EDG__)
#define __cpp_lib_bitops 201907L
#endif // __clang__

#define __cpp_lib_bounded_array_traits 201902L

Expand All @@ -1120,20 +1118,24 @@
#define __cpp_lib_endian 201907L
#define __cpp_lib_erase_if 202002L
#define __cpp_lib_generic_unordered_lookup 201811L
#define __cpp_lib_int_pow2 202002L
#define __cpp_lib_is_constant_evaluated 201811L
#define __cpp_lib_is_nothrow_convertible 201806L
#define __cpp_lib_list_remove_return_type 201806L
#define __cpp_lib_math_constants 201907L
#define __cpp_lib_remove_cvref 201711L
#define __cpp_lib_shift 201806L
#define __cpp_lib_span 202002L
#define __cpp_lib_ssize 201902L
#define __cpp_lib_starts_ends_with 201711L
#define __cpp_lib_to_address 201711L
#define __cpp_lib_to_array 201907L
#define __cpp_lib_type_identity 201806L
#define __cpp_lib_unwrap_ref 201811L

#ifdef __cpp_lib_bitops // TRANSITION, VSO-1020212
#define __cpp_lib_int_pow2 202002L
#endif

#define __cpp_lib_is_constant_evaluated 201811L
#define __cpp_lib_is_nothrow_convertible 201806L
#define __cpp_lib_list_remove_return_type 201806L
#define __cpp_lib_math_constants 201907L
#define __cpp_lib_remove_cvref 201711L
#define __cpp_lib_shift 201806L
#define __cpp_lib_span 202002L
#define __cpp_lib_ssize 201902L
#define __cpp_lib_starts_ends_with 201711L
#define __cpp_lib_to_address 201711L
#define __cpp_lib_to_array 201907L
#define __cpp_lib_type_identity 201806L
#define __cpp_lib_unwrap_ref 201811L
#endif // _HAS_CXX20

#if _HAS_CXX20
Expand Down
4 changes: 2 additions & 2 deletions tests/std/tests/VSO_0157762_feature_test_macros/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ STATIC_ASSERT(__cpp_lib_bit_cast == 201806L);
#endif
#endif

#if _HAS_CXX20 && (defined(__clang__) || defined(__EDG__)) // TRANSITION, VSO-1020212
#if _HAS_CXX20 && defined(__clang__) // TRANSITION, VSO-1020212
#ifndef __cpp_lib_bitops
#error __cpp_lib_bitops is not defined
#elif __cpp_lib_bitops != 201907L
Expand Down Expand Up @@ -1191,7 +1191,7 @@ STATIC_ASSERT(__cpp_lib_hypot == 201603L);
STATIC_ASSERT(__cpp_lib_incomplete_container_elements == 201505L);
#endif

#if _HAS_CXX20
#if _HAS_CXX20 && defined(__clang__) // TRANSITION, VSO-1020212
#ifndef __cpp_lib_int_pow2
#error __cpp_lib_int_pow2 is not defined
#elif __cpp_lib_int_pow2 != 202002L
Expand Down

0 comments on commit 0055b5b

Please sign in to comment.