Skip to content

Commit c792de2

Browse files
[libcxx][test] Add macro for when long double is just double (#106708)
This removes the need for the long list of platforms in strong_order_long_double_verify.
1 parent 2497739 commit c792de2

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,6 @@
88

99
// UNSUPPORTED: c++03, c++11, c++14, c++17
1010

11-
// The following platforms have sizeof(long double) == sizeof(double), so this test doesn't apply to them.
12-
// This test does apply to aarch64 where Arm's AAPCS64 is followed. There they are different sizes.
13-
// XFAIL: target={{arm64|arm64e|armv(7|8)(l|m)?|powerpc|powerpc64}}-{{.+}}
14-
15-
// MSVC configurations have long double equal to regular double on all
16-
// architectures.
17-
// XFAIL: target={{.+}}-pc-windows-msvc
18-
19-
// ARM/AArch64 MinGW also has got long double equal to regular double, just
20-
// like MSVC (thus match both MinGW and MSVC here, for those architectures).
21-
// XFAIL: target={{aarch64|armv7}}-{{.*}}-windows-{{.+}}
22-
23-
// Android's 32-bit x86 target has long double equal to regular double.
24-
// XFAIL: target=i686-{{.+}}-android{{.*}}
25-
2611
// <compare>
2712

2813
// template<class T> constexpr strong_ordering strong_order(const T& a, const T& b);
@@ -37,5 +22,9 @@
3722

3823
void f() {
3924
long double ld = 3.14;
25+
#ifdef TEST_LONG_DOUBLE_IS_DOUBLE
26+
(void)ld; // expected-no-diagnostics
27+
#else
4028
(void)std::strong_order(ld, ld); // expected-error@*:* {{std::strong_order is unimplemented for this floating-point type}}
29+
#endif
4130
}

libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ bool tests() {
229229
test_roundtrip_through_nested_T<false>(i);
230230
test_roundtrip_through_buffer<false>(i);
231231

232-
#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
232+
#ifdef TEST_LONG_DOUBLE_IS_DOUBLE
233233
test_roundtrip_through<double, false>(i);
234234
#endif
235235
#if defined(__SIZEOF_INT128__) && __SIZEOF_LONG_DOUBLE__ == __SIZEOF_INT128__ && \

libcxx/test/support/test_macros.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,4 +511,8 @@ inline Tp const& DoNotOptimize(Tp const& value) {
511511
# define TEST_CONSTEXPR_OPERATOR_NEW
512512
#endif
513513

514+
#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
515+
# define TEST_LONG_DOUBLE_IS_DOUBLE
516+
#endif
517+
514518
#endif // SUPPORT_TEST_MACROS_HPP

0 commit comments

Comments
 (0)