[libcxx-commits] [libcxx] 1d3964d - [libcxx][test] Make LIBCPP_STATIC_ASSERT usable at namespace scope
Casey Carter via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 10 16:35:41 PST 2022
Author: Casey Carter
Date: 2022-01-10T16:35:31-08:00
New Revision: 1d3964d2adc457d9a2ac6cad8be4c84fef36d19e
URL: https://github.com/llvm/llvm-project/commit/1d3964d2adc457d9a2ac6cad8be4c84fef36d19e
DIFF: https://github.com/llvm/llvm-project/commit/1d3964d2adc457d9a2ac6cad8be4c84fef36d19e.diff
LOG: [libcxx][test] Make LIBCPP_STATIC_ASSERT usable at namespace scope
... even when `!defined(_LIBCPP_VERSION)`. (Note that the previous definition for this case - `((void)0);` - is ill-formed at namespace scope.) Ditto for `LIBCPP_ASSERT`, `LIBCPP_ASSERT_NOEXCEPT`, `LIBCPP_ASSERT_NOT_NOEXCEPT`, and `LIBCPP_ONLY`.
Differential Revision: https://reviews.llvm.org/D116880
Added:
Modified:
libcxx/test/support/test_macros.h
Removed:
################################################################################
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index a90a52f8ca5d4..322601609bf57 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -236,11 +236,11 @@
#define LIBCPP_ASSERT_NOT_NOEXCEPT(...) ASSERT_NOT_NOEXCEPT(__VA_ARGS__)
#define LIBCPP_ONLY(...) __VA_ARGS__
#else
-#define LIBCPP_ASSERT(...) ((void)0)
-#define LIBCPP_STATIC_ASSERT(...) ((void)0)
-#define LIBCPP_ASSERT_NOEXCEPT(...) ((void)0)
-#define LIBCPP_ASSERT_NOT_NOEXCEPT(...) ((void)0)
-#define LIBCPP_ONLY(...) ((void)0)
+#define LIBCPP_ASSERT(...) static_assert(true, "")
+#define LIBCPP_STATIC_ASSERT(...) static_assert(true, "")
+#define LIBCPP_ASSERT_NOEXCEPT(...) static_assert(true, "")
+#define LIBCPP_ASSERT_NOT_NOEXCEPT(...) static_assert(true, "")
+#define LIBCPP_ONLY(...) static_assert(true, "")
#endif
#if !defined(_LIBCPP_HAS_NO_RANGES)
More information about the libcxx-commits
mailing list