[libcxx-commits] [libcxx] [libc++] tests: add long-double-is-double feature (PR #77076)

Dominik Wójt via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 5 02:20:44 PST 2024


https://github.com/domin144 created https://github.com/llvm/llvm-project/pull/77076

The current approach with matching the platforms by name is error prone. In my internal tests the platform is "arm-none-eabi" and was not matched even though the test is not valid there.

>From d5045b6b7a4ee18337dd9420fcfe9290b614f803 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dominik=20W=C3=B3jt?= <dominik.wojt at arm.com>
Date: Thu, 4 Jan 2024 15:37:14 +0100
Subject: [PATCH] [libc++] tests: add long-double-is-double feature

The current approach with matching the platforms by name is error prone.
In my internal tests the platform is "arm-none-eabi" and was not
matched even though the test is not valid there.
---
 .../cmp.alg/strong_order_long_double.verify.cpp | 17 +++--------------
 libcxx/utils/libcxx/test/features.py            | 11 +++++++++++
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp b/libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp
index fd16afeefb0331..772f6d1ab5be50 100644
--- a/libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp
+++ b/libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp
@@ -8,20 +8,9 @@
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
 
-// The following platforms have sizeof(long double) == sizeof(double), so this test doesn't apply to them.
-// This test does apply to aarch64 where Arm's AAPCS64 is followed. There they are different sizes.
-// UNSUPPORTED: target={{arm64|arm64e|armv(7|8)(l|m)?|powerpc|powerpc64}}-{{.+}}
-
-// MSVC configurations have long double equal to regular double on all
-// architectures.
-// UNSUPPORTED: target={{.+}}-pc-windows-msvc
-
-// ARM/AArch64 MinGW also has got long double equal to regular double, just
-// like MSVC (thus match both MinGW and MSVC here, for those architectures).
-// UNSUPPORTED: target={{aarch64|armv7}}-{{.*}}-windows-{{.+}}
-
-// Android's 32-bit x86 target has long double equal to regular double.
-// UNSUPPORTED: target=i686-{{.+}}-android{{.*}}
+// This test does not apply to platforms, which have
+// sizeof(long double) == sizeof(double).
+// XFAIL: long-double-is-double
 
 // <compare>
 
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 77efbdf1310349..cc150ccfe3d0c3 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -217,6 +217,17 @@ def _getAndroidDeviceApi(cfg):
           """,
         ),
     ),
+    Feature(
+        name="long-double-is-double",
+        when=lambda cfg: sourceBuilds(
+            cfg,
+            """
+            int main(int, char**) {
+              static_assert(sizeof(long double) == sizeof(double));
+            }
+            """,
+        ),
+    ),
     # TODO: Remove this feature once compiler-rt includes __atomic_is_lockfree()
     # on all supported platforms.
     Feature(



More information about the libcxx-commits mailing list