[libcxx-commits] [libcxx] 67d483a - [libcxx][test] Use TEST_HAS_BUILTIN in test code
Casey Carter via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jan 20 01:47:37 PST 2022
Author: Casey Carter
Date: 2022-01-20T01:47:29-08:00
New Revision: 67d483aba23c95bf4501992de6417046e6685070
URL: https://github.com/llvm/llvm-project/commit/67d483aba23c95bf4501992de6417046e6685070
DIFF: https://github.com/llvm/llvm-project/commit/67d483aba23c95bf4501992de6417046e6685070.diff
LOG: [libcxx][test] Use TEST_HAS_BUILTIN in test code
... 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.
Added:
Modified:
libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.noop/noop_coroutine.pass.cpp
libcxx/test/support/test_macros.h
Removed:
################################################################################
diff --git a/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.noop/noop_coroutine.pass.cpp b/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.noop/noop_coroutine.pass.cpp
index af7a173ce03e8..de53b0a53676d 100644
--- a/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.noop/noop_coroutine.pass.cpp
+++ b/libcxx/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.noop/noop_coroutine.pass.cpp
@@ -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;
@@ -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)
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index 32304e329421a..5333d344588ea 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -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
More information about the libcxx-commits
mailing list