Skip to content

Commit 4d274f5

Browse files
mordanteJaddyen
authored andcommitted
[libc++] Implements the new FTM header test generator. (llvm#134542)
This generator has almost identical output to the existing script. Notable differences are - conditionally include headers that are not implemented yet - removes the synopsis - uses 2 spaces indent in `# if` There are a few more test macros added that triggered bugs in existing FTM.
1 parent f4fbed4 commit 4d274f5

12 files changed

+1056
-28
lines changed

libcxx/test/libcxx/feature_test_macro/ftm_metadata.sh.py

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,58 @@
2121

2222
class Test(unittest.TestCase):
2323
def setUp(self):
24-
self.ftm = FeatureTestMacros(TEST_DATA)
24+
self.ftm = FeatureTestMacros(TEST_DATA, ["charconv"])
2525
self.maxDiff = None # This causes the diff to be printed when the test fails
2626

2727
def test_implementation(self):
2828
expected = {
2929
"__cpp_lib_any": Metadata(
30-
headers=["any"], test_suite_guard=None, libcxx_guard=None
30+
headers=["any"],
31+
available_since="c++17",
32+
test_suite_guard=None,
33+
libcxx_guard=None,
3134
),
3235
"__cpp_lib_barrier": Metadata(
3336
headers=["barrier"],
37+
available_since="c++20",
3438
test_suite_guard="!defined(_LIBCPP_VERSION) || (_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC)",
3539
libcxx_guard="_LIBCPP_HAS_THREADS && _LIBCPP_AVAILABILITY_HAS_SYNC",
3640
),
41+
"__cpp_lib_clamp": Metadata(
42+
headers=["algorithm"],
43+
available_since="c++17",
44+
test_suite_guard=None,
45+
libcxx_guard=None,
46+
),
3747
"__cpp_lib_format": Metadata(
38-
headers=["format"], test_suite_guard=None, libcxx_guard=None
48+
headers=["format"],
49+
available_since="c++20",
50+
test_suite_guard=None,
51+
libcxx_guard=None,
3952
),
4053
"__cpp_lib_parallel_algorithm": Metadata(
4154
headers=["algorithm", "numeric"],
55+
available_since="c++17",
56+
test_suite_guard=None,
57+
libcxx_guard=None,
58+
),
59+
"__cpp_lib_to_chars": Metadata(
60+
headers=["charconv"],
61+
available_since="c++17",
4262
test_suite_guard=None,
4363
libcxx_guard=None,
4464
),
4565
"__cpp_lib_variant": Metadata(
46-
headers=["variant"], test_suite_guard=None, libcxx_guard=None
66+
headers=["variant"],
67+
available_since="c++17",
68+
test_suite_guard=None,
69+
libcxx_guard=None,
4770
),
48-
"__cpp_lib_missing_FTM_in_older_standard": Metadata(
49-
headers=[], test_suite_guard=None, libcxx_guard=None
71+
"__cpp_lib_zz_missing_FTM_in_older_standard": Metadata(
72+
headers=[],
73+
available_since="c++17",
74+
test_suite_guard=None,
75+
libcxx_guard=None,
5076
),
5177
}
5278
self.assertEqual(self.ftm.ftm_metadata, expected)

0 commit comments

Comments
 (0)