summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Jiang <de34@live.cn>2024-10-26 13:46:59 +0800
committerGitHub <noreply@github.com>2024-10-26 13:46:59 +0800
commit3fc0d94ce57de2d0841e77c8fda7feef2923c4e0 (patch)
tree09d30b071f86e3cc7fa8746f07bbc1a946350fc2
parent13d6233e77982f2a596922a79365373e1466a968 (diff)
[libc++][test] Make macro detection more friendly to MSVC (#113633)
MSVC STL's test suite is a bit nervous about replacing non-macro-defined identifiers with `0` (see also https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4668?view=msvc-170). On MSVC (and MS-compatible mode of other compilers), `long double` has the same format (IEEE-754 binary64) as `double`, so it should be OK to define `TEST_LONG_DOUBLE_IS_DOUBLE` when `_MSC_VER` is defined. Such detection should be performed first.
-rw-r--r--libcxx/test/support/test_macros.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index 5ef14e54dae2..1b6473b623c5 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -511,7 +511,7 @@ inline Tp const& DoNotOptimize(Tp const& value) {
# define TEST_CONSTEXPR_OPERATOR_NEW
#endif
-#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
+#if defined(_MSC_VER) || __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
# define TEST_LONG_DOUBLE_IS_DOUBLE
#endif