[libcxx-commits] [libcxx] [libc++] Adds headers to FTM. (PR #75699)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Dec 16 06:27:18 PST 2023
https://github.com/mordante created https://github.com/llvm/llvm-project/pull/75699
These feature-test macros had no headers listed in their associated papers. This adds the expected headers.
Fixes https://github.com/llvm/llvm-project/issues/75577
>From 46155c6d4719d0294df4663fc73bd460253e86ea Mon Sep 17 00:00:00 2001
From: Mark de Wever <koraq at xs4all.nl>
Date: Sat, 16 Dec 2023 15:25:23 +0100
Subject: [PATCH] [libc++] Adds headers to FTM.
These feature-test macros had no headers listed in their associated
papers. This adds the expected headers.
Fixes https://github.com/llvm/llvm-project/issues/75577
---
libcxx/include/version | 4 +-
.../.version.compile.pass.cpp | 105 ------------------
.../format.version.compile.pass.cpp | 34 ++++++
.../numeric.version.compile.pass.cpp | 46 +++++++-
.../generate_feature_test_macro_components.py | 10 +-
5 files changed, 83 insertions(+), 116 deletions(-)
delete mode 100644 libcxx/test/std/language.support/support.limits/support.limits.general/.version.compile.pass.cpp
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,
},
{
More information about the libcxx-commits
mailing list