Skip to content

Commit 887574c

Browse files
Try to fix generating scripts
1 parent 81ea61b commit 887574c

File tree

7 files changed

+71
-38
lines changed

7 files changed

+71
-38
lines changed

libcxx/test/libcxx/clang_modules_include.gen.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@
1717

1818
import sys
1919
sys.path.append(sys.argv[1])
20-
from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
20+
from libcxx.header_information import (
21+
lit_header_restrictions,
22+
header_undeprecations,
23+
public_headers,
24+
)
2125

2226
for header in public_headers:
23-
print(f"""\
27+
print(
28+
f"""\
2429
//--- {header}.compile.pass.cpp
2530
// RUN: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only
2631
@@ -41,10 +46,11 @@
4146
// UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
4247
4348
{lit_header_restrictions.get(header, '')}
44-
{lit_header_undeprecations.get(header, '')}
49+
{header_undeprecations.get(header, '')}
4550
4651
#include <{header}>
47-
""")
52+
"""
53+
)
4854

4955
print(
5056
f"""\

libcxx/test/libcxx/double_include.gen.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@
1515

1616
import sys
1717
sys.path.append(sys.argv[1])
18-
from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
18+
from libcxx.header_information import (
19+
lit_header_restrictions,
20+
header_undeprecations,
21+
public_headers,
22+
)
1923

2024
for header in public_headers:
21-
print(f"""\
25+
print(
26+
f"""\
2227
//--- {header}.sh.cpp
2328
{lit_header_restrictions.get(header, '')}
24-
{lit_header_undeprecations.get(header, '')}
29+
{header_undeprecations.get(header, '')}
2530
2631
// RUN: %{{cxx}} -c %s -o %t.first.o %{{flags}} %{{compile_flags}}
2732
// RUN: %{{cxx}} -c %s -o %t.second.o -DWITH_MAIN %{{flags}} %{{compile_flags}}
@@ -33,4 +38,5 @@
3338
#if defined(WITH_MAIN)
3439
int main(int, char**) {{ return 0; }}
3540
#endif
36-
""")
41+
"""
42+
)

libcxx/test/libcxx/header_inclusions.gen.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,41 @@
1212
# RUN: %{python} %s %{libcxx-dir}/utils
1313

1414
import sys
15+
1516
sys.path.append(sys.argv[1])
16-
from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers, mandatory_inclusions
17+
from libcxx.header_information import (
18+
lit_header_restrictions,
19+
header_undeprecations,
20+
public_headers,
21+
mandatory_inclusions,
22+
)
1723

1824
for header in public_headers:
19-
header_guard = lambda h: f"_LIBCPP_{h.upper().replace('.', '_').replace('/', '_')}"
25+
header_guard = lambda h: f"_LIBCPP_{h.upper().replace('.', '_').replace('/', '_')}"
2026

21-
# <cassert> has no header guards
22-
if header == 'cassert':
23-
checks = ''
24-
else:
25-
checks = f'''
27+
# <cassert> has no header guards
28+
if header == 'cassert':
29+
checks = ""
30+
else:
31+
checks = f"""
2632
#ifndef {header_guard(header)}
2733
# error <{header}> was expected to define a header guard {header_guard(header)}
2834
#endif
29-
'''
30-
for includee in mandatory_inclusions.get(header, []):
31-
checks += f'''
35+
"""
36+
for includee in mandatory_inclusions.get(header, []):
37+
checks += f"""
3238
#ifndef {header_guard(includee)}
3339
# error <{header}> was expected to include <{includee}>
3440
#endif
35-
'''
41+
"""
3642

37-
print(f"""\
43+
print(
44+
f"""\
3845
//--- {header}.compile.pass.cpp
3946
{lit_header_restrictions.get(header, '')}
40-
{lit_header_undeprecations.get(header, '')}
47+
{header_undeprecations.get(header, '')}
4148
4249
#include <{header}>
4350
{checks}
44-
""")
51+
"""
52+
)

libcxx/test/libcxx/libcpp_version.gen.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,23 @@
1212

1313
import sys
1414
sys.path.append(sys.argv[1])
15-
from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
15+
from libcxx.header_information import (
16+
lit_header_restrictions,
17+
header_undeprecations,
18+
public_headers,
19+
)
1620

1721
for header in public_headers:
18-
print(f"""\
22+
print(
23+
f"""\
1924
//--- {header}.compile.pass.cpp
2025
{lit_header_restrictions.get(header, '')}
21-
{lit_header_undeprecations.get(header, '')}
26+
{header_undeprecations.get(header, '')}
2227
2328
#include <{header}>
2429
2530
#ifndef _LIBCPP_VERSION
2631
# error <{header}> does not seem to define _LIBCPP_VERSION
2732
#endif
28-
""")
33+
"""
34+
)

libcxx/test/libcxx/no_assert_include.gen.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
# RUN: %{python} %s %{libcxx-dir}/utils
1313

1414
import sys
15+
1516
sys.path.append(sys.argv[1])
16-
from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
17+
from libcxx.header_information import lit_header_restrictions, header_undeprecations, public_headers
1718

1819
for header in public_headers:
1920
if header == 'cassert':
@@ -22,7 +23,7 @@
2223
print(f"""\
2324
//--- {header}.compile.pass.cpp
2425
{lit_header_restrictions.get(header, '')}
25-
{lit_header_undeprecations.get(header, '')}
26+
{header_undeprecations.get(header, '')}
2627
2728
#include <{header}>
2829

libcxx/test/libcxx/system_reserved_names.gen.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@
1313
# RUN: %{python} %s %{libcxx-dir}/utils
1414

1515
import sys
16+
1617
sys.path.append(sys.argv[1])
17-
from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
18+
from libcxx.header_information import (
19+
lit_header_restrictions,
20+
header_undeprecations,
21+
public_headers,
22+
)
1823

1924
for header in public_headers:
2025
print(
2126
f"""\
2227
//--- {header}.compile.pass.cpp
2328
{lit_header_restrictions.get(header, '')}
24-
{lit_header_undeprecations.get(header, '')}
29+
{header_undeprecations.get(header, '')}
2530
2631
#define SYSTEM_RESERVED_NAME This name should not be used in libc++
2732

libcxx/utils/libcxx/header_information.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@
3232
"syncstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
3333
}
3434

35+
# Undeprecate headers that are deprecated in C++17 and removed in C++20.
36+
header_undeprecations = {
37+
"ccomplex": "#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS",
38+
"ciso646": "#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS",
39+
"cstdalign": "#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS",
40+
"cstdbool": "#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS",
41+
"ctgmath": "#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS",
42+
}
43+
3544
lit_header_restrictions = {
3645
"barrier": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17",
3746
"clocale": "// UNSUPPORTED: no-localization",
@@ -70,14 +79,6 @@
7079
"wchar.h": "// UNSUPPORTED: no-wide-characters",
7180
"wctype.h": "// UNSUPPORTED: no-wide-characters",
7281
}
73-
# Undeprecate headers that are deprecated in C++17 and removed in C++20.
74-
lit_header_undeprecations = {
75-
"ccomplex": "// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS",
76-
"ciso646": "// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS",
77-
"cstdalign": "// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS",
78-
"cstdbool": "// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS",
79-
"ctgmath": "// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS",
80-
}
8182

8283
# This table was produced manually, by grepping the TeX source of the Standard's
8384
# library clauses for the string "#include". Each header's synopsis contains

0 commit comments

Comments
 (0)