Skip to content

[libc++] Adds headers to FTM. #75699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2023

Conversation

mordante
Copy link
Member

These feature-test macros had no headers listed in their associated papers. This adds the expected headers.

Fixes #75577

These feature-test macros had no headers listed in their associated
papers. This adds the expected headers.

Fixes llvm#75577
@mordante mordante requested a review from a team as a code owner December 16, 2023 14:27
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Dec 16, 2023
@llvmbot
Copy link
Member

llvmbot commented Dec 16, 2023

@llvm/pr-subscribers-libcxx

Author: Mark de Wever (mordante)

Changes

These feature-test macros had no headers listed in their associated papers. This adds the expected headers.

Fixes #75577


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

5 Files Affected:

  • (modified) libcxx/include/version (+2-2)
  • (removed) libcxx/test/std/language.support/support.limits/support.limits.general/.version.compile.pass.cpp (-105)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp (+34)
  • (modified) libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp (+40-6)
  • (modified) libcxx/utils/generate_feature_test_macro_components.py (+7-3)
diff --git a/libcxx/include/version b/libcxx/include/version
index a91c344c436090..7aa002e257b0a1 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -93,7 +93,7 @@ __cpp_lib_expected                                      202211L <expected>
 __cpp_lib_filesystem                                    201703L <filesystem>
 __cpp_lib_format                                        202106L <format>
 __cpp_lib_format_ranges                                 202207L <format>
-__cpp_lib_format_uchar                                  202311L <>
+__cpp_lib_format_uchar                                  202311L <format>
 __cpp_lib_formatters                                    202302L <stacktrace> <thread>
 __cpp_lib_forward_like                                  202207L <utility>
 __cpp_lib_freestanding_algorithm                        202311L <algorithm>
@@ -188,7 +188,7 @@ __cpp_lib_remove_cvref                                  201711L <type_traits>
 __cpp_lib_result_of_sfinae                              201210L <functional> <type_traits>
 __cpp_lib_robust_nonmodifying_seq_ops                   201304L <algorithm>
 __cpp_lib_sample                                        201603L <algorithm>
-__cpp_lib_saturation_arithmetic                         202311L <>
+__cpp_lib_saturation_arithmetic                         202311L <numeric>
 __cpp_lib_scoped_lock                                   201703L <mutex>
 __cpp_lib_semaphore                                     201907L <semaphore>
 __cpp_lib_shared_mutex                                  201505L <shared_mutex>
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/.version.compile.pass.cpp
deleted file mode 100644
index 2486985cefaca0..00000000000000
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/.version.compile.pass.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// WARNING: This test was generated by generate_feature_test_macro_components.py
-// and should not be edited manually.
-//
-// clang-format off
-
-// <>
-
-// Test the feature test macros defined by <>
-
-/*  Constant                           Value
-    __cpp_lib_format_uchar             202311L [C++20]
-    __cpp_lib_saturation_arithmetic    202311L [C++26]
-*/
-
-#include <>
-#include "test_macros.h"
-
-#if TEST_STD_VER < 14
-
-# ifdef __cpp_lib_format_uchar
-#   error "__cpp_lib_format_uchar should not be defined before c++20"
-# endif
-
-# ifdef __cpp_lib_saturation_arithmetic
-#   error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
-# endif
-
-#elif TEST_STD_VER == 14
-
-# ifdef __cpp_lib_format_uchar
-#   error "__cpp_lib_format_uchar should not be defined before c++20"
-# endif
-
-# ifdef __cpp_lib_saturation_arithmetic
-#   error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
-# endif
-
-#elif TEST_STD_VER == 17
-
-# ifdef __cpp_lib_format_uchar
-#   error "__cpp_lib_format_uchar should not be defined before c++20"
-# endif
-
-# ifdef __cpp_lib_saturation_arithmetic
-#   error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
-# endif
-
-#elif TEST_STD_VER == 20
-
-# ifndef __cpp_lib_format_uchar
-#   error "__cpp_lib_format_uchar should be defined in c++20"
-# endif
-# if __cpp_lib_format_uchar != 202311L
-#   error "__cpp_lib_format_uchar should have the value 202311L in c++20"
-# endif
-
-# ifdef __cpp_lib_saturation_arithmetic
-#   error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
-# endif
-
-#elif TEST_STD_VER == 23
-
-# ifndef __cpp_lib_format_uchar
-#   error "__cpp_lib_format_uchar should be defined in c++23"
-# endif
-# if __cpp_lib_format_uchar != 202311L
-#   error "__cpp_lib_format_uchar should have the value 202311L in c++23"
-# endif
-
-# ifdef __cpp_lib_saturation_arithmetic
-#   error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
-# endif
-
-#elif TEST_STD_VER > 23
-
-# ifndef __cpp_lib_format_uchar
-#   error "__cpp_lib_format_uchar should be defined in c++26"
-# endif
-# if __cpp_lib_format_uchar != 202311L
-#   error "__cpp_lib_format_uchar should have the value 202311L in c++26"
-# endif
-
-# if !defined(_LIBCPP_VERSION)
-#   ifndef __cpp_lib_saturation_arithmetic
-#     error "__cpp_lib_saturation_arithmetic should be defined in c++26"
-#   endif
-#   if __cpp_lib_saturation_arithmetic != 202311L
-#     error "__cpp_lib_saturation_arithmetic should have the value 202311L in c++26"
-#   endif
-# else // _LIBCPP_VERSION
-#   ifdef __cpp_lib_saturation_arithmetic
-#     error "__cpp_lib_saturation_arithmetic should not be defined because it is unimplemented in libc++!"
-#   endif
-# endif
-
-#endif // TEST_STD_VER > 23
-
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
index 4e2c50483c2298..aa7b2f4286827b 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
@@ -18,6 +18,7 @@
 /*  Constant                   Value
     __cpp_lib_format           202106L [C++20]
     __cpp_lib_format_ranges    202207L [C++23]
+    __cpp_lib_format_uchar     202311L [C++20]
 */
 
 #include <format>
@@ -33,6 +34,10 @@
 #   error "__cpp_lib_format_ranges should not be defined before c++23"
 # endif
 
+# ifdef __cpp_lib_format_uchar
+#   error "__cpp_lib_format_uchar should not be defined before c++20"
+# endif
+
 #elif TEST_STD_VER == 14
 
 # ifdef __cpp_lib_format
@@ -43,6 +48,10 @@
 #   error "__cpp_lib_format_ranges should not be defined before c++23"
 # endif
 
+# ifdef __cpp_lib_format_uchar
+#   error "__cpp_lib_format_uchar should not be defined before c++20"
+# endif
+
 #elif TEST_STD_VER == 17
 
 # ifdef __cpp_lib_format
@@ -53,6 +62,10 @@
 #   error "__cpp_lib_format_ranges should not be defined before c++23"
 # endif
 
+# ifdef __cpp_lib_format_uchar
+#   error "__cpp_lib_format_uchar should not be defined before c++20"
+# endif
+
 #elif TEST_STD_VER == 20
 
 # if !defined(_LIBCPP_VERSION)
@@ -72,6 +85,13 @@
 #   error "__cpp_lib_format_ranges should not be defined before c++23"
 # endif
 
+# ifndef __cpp_lib_format_uchar
+#   error "__cpp_lib_format_uchar should be defined in c++20"
+# endif
+# if __cpp_lib_format_uchar != 202311L
+#   error "__cpp_lib_format_uchar should have the value 202311L in c++20"
+# endif
+
 #elif TEST_STD_VER == 23
 
 # if !defined(_LIBCPP_VERSION)
@@ -94,6 +114,13 @@
 #   error "__cpp_lib_format_ranges should have the value 202207L in c++23"
 # endif
 
+# ifndef __cpp_lib_format_uchar
+#   error "__cpp_lib_format_uchar should be defined in c++23"
+# endif
+# if __cpp_lib_format_uchar != 202311L
+#   error "__cpp_lib_format_uchar should have the value 202311L in c++23"
+# endif
+
 #elif TEST_STD_VER > 23
 
 # if !defined(_LIBCPP_VERSION)
@@ -116,5 +143,12 @@
 #   error "__cpp_lib_format_ranges should have the value 202207L in c++26"
 # endif
 
+# ifndef __cpp_lib_format_uchar
+#   error "__cpp_lib_format_uchar should be defined in c++26"
+# endif
+# if __cpp_lib_format_uchar != 202311L
+#   error "__cpp_lib_format_uchar should have the value 202311L in c++26"
+# endif
+
 #endif // TEST_STD_VER > 23
 
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp
index 60004b06c5ff52..b510eefc69a5d3 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/numeric.version.compile.pass.cpp
@@ -15,12 +15,13 @@
 
 // Test the feature test macros defined by <numeric>
 
-/*  Constant                        Value
-    __cpp_lib_constexpr_numeric     201911L [C++20]
-    __cpp_lib_gcd_lcm               201606L [C++17]
-    __cpp_lib_interpolate           201902L [C++20]
-    __cpp_lib_parallel_algorithm    201603L [C++17]
-    __cpp_lib_ranges_iota           202202L [C++23]
+/*  Constant                           Value
+    __cpp_lib_constexpr_numeric        201911L [C++20]
+    __cpp_lib_gcd_lcm                  201606L [C++17]
+    __cpp_lib_interpolate              201902L [C++20]
+    __cpp_lib_parallel_algorithm       201603L [C++17]
+    __cpp_lib_ranges_iota              202202L [C++23]
+    __cpp_lib_saturation_arithmetic    202311L [C++26]
 */
 
 #include <numeric>
@@ -48,6 +49,10 @@
 #   error "__cpp_lib_ranges_iota should not be defined before c++23"
 # endif
 
+# ifdef __cpp_lib_saturation_arithmetic
+#   error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
+# endif
+
 #elif TEST_STD_VER == 14
 
 # ifdef __cpp_lib_constexpr_numeric
@@ -70,6 +75,10 @@
 #   error "__cpp_lib_ranges_iota should not be defined before c++23"
 # endif
 
+# ifdef __cpp_lib_saturation_arithmetic
+#   error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
+# endif
+
 #elif TEST_STD_VER == 17
 
 # ifdef __cpp_lib_constexpr_numeric
@@ -104,6 +113,10 @@
 #   error "__cpp_lib_ranges_iota should not be defined before c++23"
 # endif
 
+# ifdef __cpp_lib_saturation_arithmetic
+#   error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
+# endif
+
 #elif TEST_STD_VER == 20
 
 # ifndef __cpp_lib_constexpr_numeric
@@ -144,6 +157,10 @@
 #   error "__cpp_lib_ranges_iota should not be defined before c++23"
 # endif
 
+# ifdef __cpp_lib_saturation_arithmetic
+#   error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
+# endif
+
 #elif TEST_STD_VER == 23
 
 # ifndef __cpp_lib_constexpr_numeric
@@ -193,6 +210,10 @@
 #   endif
 # endif
 
+# ifdef __cpp_lib_saturation_arithmetic
+#   error "__cpp_lib_saturation_arithmetic should not be defined before c++26"
+# endif
+
 #elif TEST_STD_VER > 23
 
 # ifndef __cpp_lib_constexpr_numeric
@@ -242,5 +263,18 @@
 #   endif
 # endif
 
+# if !defined(_LIBCPP_VERSION)
+#   ifndef __cpp_lib_saturation_arithmetic
+#     error "__cpp_lib_saturation_arithmetic should be defined in c++26"
+#   endif
+#   if __cpp_lib_saturation_arithmetic != 202311L
+#     error "__cpp_lib_saturation_arithmetic should have the value 202311L in c++26"
+#   endif
+# else // _LIBCPP_VERSION
+#   ifdef __cpp_lib_saturation_arithmetic
+#     error "__cpp_lib_saturation_arithmetic should not be defined because it is unimplemented in libc++!"
+#   endif
+# endif
+
 #endif // TEST_STD_VER > 23
 
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 6a30324397883a..70e18b6dde006e 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -486,7 +486,9 @@ def add_version_header(tc):
             "values": {
                 "c++20": 202311  # DR P2909R4 Fix formatting of code units as integers
             },
-            "headers": [""],  # Note not in format
+            "headers": [
+                "format"  # TODO verify this entry since the paper was underspecified.
+            ],
         },
         {
             "name": "__cpp_lib_formatters",
@@ -660,7 +662,7 @@ def add_version_header(tc):
         },
         {
             "name": "__cpp_lib_ios_noreplace",
-            "values": { "c++23": 202207 },
+            "values": {"c++23": 202207},
             "headers": ["ios"],
         },
         {
@@ -1010,7 +1012,9 @@ def add_version_header(tc):
         {
             "name": "__cpp_lib_saturation_arithmetic",
             "values": {"c++26": 202311},  # P0543R3 Saturation arithmetic
-            "headers": [""],  # Note not in <numerics>
+            "headers": [
+                "numeric"  # TODO verify this entry since the paper was underspecified.
+            ],
             "unimplemented": True,
         },
         {

@philnik777 philnik777 merged commit 9c18f03 into llvm:main Dec 18, 2023
@mordante mordante deleted the add_feature_test_macros_to_a_header branch December 18, 2023 16:49
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.

[libc++][test] support.limits.general/.version.compile.pass.cpp is malformed
3 participants