Skip to content

Commit

Permalink
[libc++] Adds headers to FTM. (llvm#75699)
Browse files Browse the repository at this point in the history
These feature-test macros had no headers listed in their associated
papers. This adds the expected headers.

Fixes llvm#75577
  • Loading branch information
mordante authored Dec 18, 2023
1 parent 42239d2 commit 9c18f03
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 116 deletions.
4 changes: 2 additions & 2 deletions libcxx/include/version
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

10 changes: 7 additions & 3 deletions libcxx/utils/generate_feature_test_macro_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -660,7 +662,7 @@ def add_version_header(tc):
},
{
"name": "__cpp_lib_ios_noreplace",
"values": { "c++23": 202207 },
"values": {"c++23": 202207},
"headers": ["ios"],
},
{
Expand Down Expand Up @@ -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,
},
{
Expand Down

0 comments on commit 9c18f03

Please sign in to comment.