[libcxx] [llvm] [libc++] Deprecate and remove meaningless `<cxxx>` headers (PR #111615)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 20:14:14 PDT 2024


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 64a22b3e69587c83566a83e793764f2a13733f0b...81ea61bdfb3e0f0e83fee4d006646f9f67111faa libcxx/test/libcxx/clang_modules_include.gen.py libcxx/test/libcxx/double_include.gen.py libcxx/test/libcxx/header_inclusions.gen.py libcxx/test/libcxx/libcpp_version.gen.py libcxx/test/libcxx/no_assert_include.gen.py libcxx/test/libcxx/system_reserved_names.gen.py libcxx/utils/libcxx/header_information.py
``````````

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- test/libcxx/clang_modules_include.gen.py	2024-10-09 03:10:12.000000 +0000
+++ test/libcxx/clang_modules_include.gen.py	2024-10-09 03:13:41.611484 +0000
@@ -15,14 +15,19 @@
 # block Lit from interpreting a RUN/XFAIL/etc inside the generation script
 # END.
 
 import sys
 sys.path.append(sys.argv[1])
-from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
+from libcxx.header_information import (
+    lit_header_restrictions,
+    lit_header_undeprecations,
+    public_headers,
+)
 
 for header in public_headers:
-  print(f"""\
+    print(
+        f"""\
 //--- {header}.compile.pass.cpp
 // RUN: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only
 
 // GCC doesn't support -fcxx-modules
 // UNSUPPORTED: gcc
@@ -42,11 +47,12 @@
 
 {lit_header_restrictions.get(header, '')}
 {lit_header_undeprecations.get(header, '')}
 
 #include <{header}>
-""")
+"""
+    )
 
 print(
     f"""\
 //--- import_std.compile.pass.mm
 // RUN: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only
--- test/libcxx/double_include.gen.py	2024-10-09 03:10:12.000000 +0000
+++ test/libcxx/double_include.gen.py	2024-10-09 03:13:41.628069 +0000
@@ -13,14 +13,19 @@
 # Block Lit from interpreting a RUN/XFAIL/etc inside the generation script.
 # END.
 
 import sys
 sys.path.append(sys.argv[1])
-from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
+from libcxx.header_information import (
+    lit_header_restrictions,
+    lit_header_undeprecations,
+    public_headers,
+)
 
 for header in public_headers:
-  print(f"""\
+    print(
+        f"""\
 //--- {header}.sh.cpp
 {lit_header_restrictions.get(header, '')}
 {lit_header_undeprecations.get(header, '')}
 
 // RUN: %{{cxx}} -c %s -o %t.first.o %{{flags}} %{{compile_flags}}
@@ -31,6 +36,7 @@
 #include <{header}>
 
 #if defined(WITH_MAIN)
 int main(int, char**) {{ return 0; }}
 #endif
-""")
+"""
+    )
--- test/libcxx/header_inclusions.gen.py	2024-10-09 03:10:12.000000 +0000
+++ test/libcxx/header_inclusions.gen.py	2024-10-09 03:13:41.702923 +0000
@@ -10,35 +10,43 @@
 # prescribed by the Standard.
 
 # RUN: %{python} %s %{libcxx-dir}/utils
 
 import sys
+
 sys.path.append(sys.argv[1])
-from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers, mandatory_inclusions
+from libcxx.header_information import (
+    lit_header_restrictions,
+    lit_header_undeprecations,
+    public_headers,
+    mandatory_inclusions,
+)
 
 for header in public_headers:
-  header_guard = lambda h: f"_LIBCPP_{h.upper().replace('.', '_').replace('/', '_')}"
+    header_guard = lambda h: f"_LIBCPP_{h.upper().replace('.', '_').replace('/', '_')}"
 
-  # <cassert> has no header guards
-  if header == 'cassert':
-    checks = ''
-  else:
-    checks = f'''
+    # <cassert> has no header guards
+    if header == "cassert":
+        checks = ""
+    else:
+        checks = f"""
 #ifndef {header_guard(header)}
 # error <{header}> was expected to define a header guard {header_guard(header)}
 #endif
-'''
-  for includee in mandatory_inclusions.get(header, []):
-    checks += f'''
+"""
+    for includee in mandatory_inclusions.get(header, []):
+        checks += f"""
 #ifndef {header_guard(includee)}
 # error <{header}> was expected to include <{includee}>
 #endif
-'''
+"""
 
-  print(f"""\
+    print(
+        f"""\
 //--- {header}.compile.pass.cpp
 {lit_header_restrictions.get(header, '')}
 {lit_header_undeprecations.get(header, '')}
 
 #include <{header}>
 {checks}
-""")
+"""
+    )
--- test/libcxx/libcpp_version.gen.py	2024-10-09 03:10:12.000000 +0000
+++ test/libcxx/libcpp_version.gen.py	2024-10-09 03:13:41.732744 +0000
@@ -10,19 +10,25 @@
 
 # RUN: %{python} %s %{libcxx-dir}/utils
 
 import sys
 sys.path.append(sys.argv[1])
-from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
+from libcxx.header_information import (
+    lit_header_restrictions,
+    lit_header_undeprecations,
+    public_headers,
+)
 
 for header in public_headers:
-  print(f"""\
+    print(
+        f"""\
 //--- {header}.compile.pass.cpp
 {lit_header_restrictions.get(header, '')}
 {lit_header_undeprecations.get(header, '')}
 
 #include <{header}>
 
 #ifndef _LIBCPP_VERSION
 # error <{header}> does not seem to define _LIBCPP_VERSION
 #endif
-""")
+"""
+    )
--- test/libcxx/no_assert_include.gen.py	2024-10-09 03:10:12.000000 +0000
+++ test/libcxx/no_assert_include.gen.py	2024-10-09 03:13:41.794260 +0000
@@ -10,23 +10,30 @@
 # assert.h (because assert() is implemented as a macro).
 
 # RUN: %{python} %s %{libcxx-dir}/utils
 
 import sys
+
 sys.path.append(sys.argv[1])
-from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
+from libcxx.header_information import (
+    lit_header_restrictions,
+    lit_header_undeprecations,
+    public_headers,
+)
 
 for header in public_headers:
-  if header == 'cassert':
-    continue
+    if header == "cassert":
+        continue
 
-  print(f"""\
+    print(
+        f"""\
 //--- {header}.compile.pass.cpp
 {lit_header_restrictions.get(header, '')}
 {lit_header_undeprecations.get(header, '')}
 
 #include <{header}>
 
 #ifdef assert
 # error "Do not include cassert or assert.h in standard header files"
 #endif
-""")
+"""
+    )
--- test/libcxx/system_reserved_names.gen.py	2024-10-09 03:10:12.000000 +0000
+++ test/libcxx/system_reserved_names.gen.py	2024-10-09 03:13:41.824105 +0000
@@ -12,11 +12,15 @@
 
 # RUN: %{python} %s %{libcxx-dir}/utils
 
 import sys
 sys.path.append(sys.argv[1])
-from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
+from libcxx.header_information import (
+    lit_header_restrictions,
+    lit_header_undeprecations,
+    public_headers,
+)
 
 for header in public_headers:
     print(
         f"""\
 //--- {header}.compile.pass.cpp

``````````

</details>


https://github.com/llvm/llvm-project/pull/111615


More information about the llvm-commits mailing list