Skip to content

Commit

Permalink
[libcxx][test] Use TEST_HAS_BUILTIN in test code
Browse files Browse the repository at this point in the history
... rather than using `__has_builtin` directly. This both (1) allows a compiler that doesn't speak `__has_builtin` to workaround with preprocessor magic, and (2) avoids diagnostics about things that look like function like macros after `#if` but are not.
  • Loading branch information
CaseyCarter committed Jan 20, 2022
1 parent 60b6e73 commit 67d483a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -20,7 +20,7 @@

#include "test_macros.h"

#if __has_builtin(__builtin_coro_noop)
#if TEST_HAS_BUILTIN(__builtin_coro_noop)

namespace coro = std::experimental::coroutines_v1;

Expand Down Expand Up @@ -74,4 +74,4 @@ int main(int, char**)

int main(int, char**) { return 0; }

#endif // __has_builtin(__builtin_coro_noop)
#endif // TEST_HAS_BUILTIN(__builtin_coro_noop)
2 changes: 1 addition & 1 deletion libcxx/test/support/test_macros.h
Expand Up @@ -147,7 +147,7 @@

#if defined(__cpp_lib_is_constant_evaluated) && __cpp_lib_is_constant_evaluated >= 201811L
# define TEST_IS_CONSTANT_EVALUATED std::is_constant_evaluated()
#elif __has_builtin(__builtin_is_constant_evaluated)
#elif TEST_HAS_BUILTIN(__builtin_is_constant_evaluated)
# define TEST_IS_CONSTANT_EVALUATED __builtin_is_constant_evaluated()
#else
# define TEST_IS_CONSTANT_EVALUATED false
Expand Down

0 comments on commit 67d483a

Please sign in to comment.