Skip to content

Commit c8dd9ad

Browse files
committed
Address review comments.
1 parent 4eaacab commit c8dd9ad

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

libcxx/test/libcxx/feature_test_macro/implemented_ftms.sh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# ===----------------------------------------------------------------------===##
88

9-
# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/utils/data/feature_test_macros/test_data.json
9+
# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/test/libcxx/feature_test_macro/test_data.json
1010

1111
import sys
1212

libcxx/test/libcxx/feature_test_macro/standard_ftms.sh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# ===----------------------------------------------------------------------===##
88

9-
# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/utils/data/feature_test_macros/test_data.json
9+
# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/test/libcxx/feature_test_macro/test_data.json
1010

1111
import sys
1212

libcxx/test/libcxx/feature_test_macro/std_dialects.sh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# ===----------------------------------------------------------------------===##
88

9-
# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/utils/data/feature_test_macros/test_data.json
9+
# RUN: %{python} %s %{libcxx-dir}/utils %{libcxx-dir}/test/libcxx/feature_test_macro/test_data.json
1010

1111
import sys
1212

libcxx/utils/generate_feature_test_macro_components.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,8 +1869,10 @@ def produce_docs():
18691869
f.write(doc_str)
18701870

18711871

1872-
def get_dialect_versions(data, std_dialects, use_implemented_status):
1873-
"""Impementation for feature_test_macros.get_(std_|)dialect_versions()."""
1872+
def get_ftms(
1873+
data, std_dialects: list[str], use_implemented_status: bool
1874+
) -> dict[str, dict[str, any]]:
1875+
"""Impementation for FeatureTestMacros.(standard|implemented)_ftms()."""
18741876
result = dict()
18751877
for feature in data:
18761878
last = None
@@ -2000,20 +2002,20 @@ class FeatureTestMacros:
20002002
# The JSON data structure.
20012003
__data = None
20022004

2003-
def __init__(self, filename):
2005+
def __init__(self, filename: str):
20042006
"""Initializes the class with the JSON data in the file 'filename'."""
20052007
self.__data = json.load(open(filename))
20062008

20072009
@functools.cached_property
2008-
def std_dialects(self):
2010+
def std_dialects(self) -> list[str]:
20092011
"""Returns the C++ dialects avaiable.
20102012
20112013
The available dialects are based on the 'c++xy' keys found the 'values'
20122014
entries in '__data'. So when WG21 starts to feature-test macros for a
20132015
future C++ Standard this dialect will automatically be available.
20142016
20152017
The return value is a sorted list with the C++ dialects used. Since FTM
2016-
were added in C++14 the list will not contain C++98 or C++11.
2018+
were added in C++14 the list will not contain C++03 or C++11.
20172019
"""
20182020
dialects = set()
20192021
for feature in self.__data:
@@ -2024,7 +2026,7 @@ def std_dialects(self):
20242026
return sorted(list(dialects))
20252027

20262028
@functools.cached_property
2027-
def standard_ftms(self):
2029+
def standard_ftms(self) -> dict[str, dict[str, any]]:
20282030
"""Returns the FTM versions per dialect in the Standard.
20292031
20302032
This function does not use the 'implemented' flag. The output contains
@@ -2038,10 +2040,10 @@ def standard_ftms(self):
20382040
* key: The version of the C++ dialect.
20392041
* value: The value of the feature-test macro.
20402042
"""
2041-
return get_dialect_versions(self.__data, self.std_dialects, False)
2043+
return get_ftms(self.__data, self.std_dialects, False)
20422044

20432045
@functools.cached_property
2044-
def implemented_ftms(self):
2046+
def implemented_ftms(self) -> dict[str, dict[str, any]]:
20452047
"""Returns the FTM versions per dialect implemented in libc++.
20462048
20472049
Unlike `get_std_dialect_versions` this function uses the 'implemented'
@@ -2055,7 +2057,7 @@ def implemented_ftms(self):
20552057
macro is not implemented its value is None.
20562058
"""
20572059

2058-
return get_dialect_versions(self.__data, self.std_dialects, True)
2060+
return get_ftms(self.__data, self.std_dialects, True)
20592061

20602062

20612063
def main():

0 commit comments

Comments
 (0)