[libcxx-commits] [libcxx] [libc++] Adds additional FTM imput validation. (PR #138462)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun May 4 10:14:11 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r HEAD~1...HEAD libcxx/test/libcxx/feature_test_macro/invalid.sh.py libcxx/utils/generate_feature_test_macro_components.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- test/libcxx/feature_test_macro/invalid.sh.py 2025-05-04 17:09:25.000000 +0000
+++ test/libcxx/feature_test_macro/invalid.sh.py 2025-05-04 17:13:45.263255 +0000
@@ -133,11 +133,11 @@
],
},
},
"headers": [],
},
- { # This entry is in the wrong alphabetic order
+ { # This entry is in the wrong alphabetic order
"name": "def",
"values": {
"c++17": {
"197001": [
{
--- utils/generate_feature_test_macro_components.py 2025-05-04 17:09:25.000000 +0000
+++ utils/generate_feature_test_macro_components.py 2025-05-04 17:13:45.894622 +0000
@@ -1989,11 +1989,12 @@
class DataNotSorted(Exception):
pass
-def validate_sorted(name:str, data: List[str]) -> None:
+
+def validate_sorted(name: str, data: List[str]) -> None:
sorted_data = sorted(data)
if data != sorted_data:
raise DataNotSorted(
f"The {name} are not sorted.\n"
+ "\n".join(
@@ -2002,34 +2003,42 @@
sorted_data,
"input data",
"sorted data",
lineterm="",
)
- ) + "\n"
+ )
+ + "\n"
)
+
def get_ftms(
data, std_dialects: List[Std], use_implemented_status: bool
) -> Dict[Ftm, Dict[Std, Optional[Value]]]:
"""Impementation for FeatureTestMacros.(standard|implemented)_ftms()."""
result = dict()
for feature in data:
last = None
entry = dict()
implemented = True
- validate_sorted(f"C++ standard version numbers of ftm '{feature['name']}'", list(feature["values"].keys()))
+ validate_sorted(
+ f"C++ standard version numbers of ftm '{feature['name']}'",
+ list(feature["values"].keys()),
+ )
for std in std_dialects:
if std not in feature["values"].keys():
if last == None:
continue
else:
entry[std] = last
else:
if implemented:
values = feature["values"][std]
assert len(values) > 0, f"{feature['name']}[{std}] has no entries"
- validate_sorted(f"value of the fmt '{feature['name']}' in {std}", list(values.keys()))
+ validate_sorted(
+ f"value of the fmt '{feature['name']}' in {std}",
+ list(values.keys()),
+ )
for value in values:
papers = list(values[value])
assert (
len(papers) > 0
), f"{feature['name']}[{std}][{value}] has no entries"
``````````
</details>
https://github.com/llvm/llvm-project/pull/138462
More information about the libcxx-commits
mailing list