Skip to content

Commit 3fc0d94

Browse files
[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.
1 parent 13d6233 commit 3fc0d94

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libcxx/test/support/test_macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ inline Tp const& DoNotOptimize(Tp const& value) {
511511
# define TEST_CONSTEXPR_OPERATOR_NEW
512512
#endif
513513

514-
#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
514+
#if defined(_MSC_VER) || __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
515515
# define TEST_LONG_DOUBLE_IS_DOUBLE
516516
#endif
517517

0 commit comments

Comments
 (0)