Skip to content

Conversation

@DavidSpickett
Copy link
Collaborator

Instead of having to match a whole bunch of different target names.

… sizeof(double)

Instead of having to match a whole bunch of different target names.
@DavidSpickett DavidSpickett requested a review from a team as a code owner August 14, 2024 12:54
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Aug 14, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 14, 2024

@llvm/pr-subscribers-libcxx

Author: David Spickett (DavidSpickett)

Changes

Instead of having to match a whole bunch of different target names.


Full diff: https://github.com/llvm/llvm-project/pull/103903.diff

2 Files Affected:

  • (modified) libcxx/test/std/language.support/cmp/cmp.alg/strong_order_long_double.verify.cpp (+1-16)
  • (modified) libcxx/utils/libcxx/test/features.py (+12)
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 c9c2ba20021491..7310a38509a3f4 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
@@ -6,22 +6,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-// 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.
-// XFAIL: target={{arm64|arm64e|armv(7|8)(l|m)?|powerpc|powerpc64}}-{{.+}}
-
-// MSVC configurations have long double equal to regular double on all
-// architectures.
-// XFAIL: 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).
-// XFAIL: target={{aarch64|armv7}}-{{.*}}-windows-{{.+}}
-
-// Android's 32-bit x86 target has long double equal to regular double.
-// XFAIL: target=i686-{{.+}}-android{{.*}}
+// UNSUPPORTED: c++03, c++11, c++14, c++17, long-double-is-double
 
 // <compare>
 
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 97cdb0349885d6..cc0de556ae82cc 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -227,6 +227,18 @@ def _mingwSupportsModules(cfg):
           """,
         ),
     ),
+    Feature(
+        name="long-double-is-double",
+        when=lambda cfg: sourceBuilds(
+            cfg,
+            """
+            int main(int, char**) {
+              static_assert(sizeof(long double) == sizeof(double));
+              return 0;
+            }
+          """,
+        ),
+    ),
     # Check for a Windows UCRT bug (fixed in UCRT/Windows 10.0.20348.0):
     # https://developercommunity.visualstudio.com/t/utf-8-locales-break-ctype-functions-for-wchar-type/1653678
     Feature(

@DavidSpickett
Copy link
Collaborator Author

ping!

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we just do something like

#if __SIZEOF_LONG_DOUBLE__ != __SIZEOF_DOUBLE__
// test
#else
// exptected-no-diagnostics (or whatever the magic comment was)
#endif

?

@frederick-vs-ja
Copy link
Contributor

Instead of add a platform feature, I think it's more flexible to add a macro to test_macros.h, which will make it easier to handle tests in strong_order.pass.cpp. Currently test cases for long double are unconditionally commented out, but they should be enabled for MSVC-like platforms.

@DavidSpickett
Copy link
Collaborator Author

Alternative: #106708

@ldionne
Copy link
Member

ldionne commented Aug 30, 2024

I think this can be closed in favor of #106708 now

@DavidSpickett DavidSpickett deleted the libcxx-long-double branch August 30, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants