aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs
diff options
context:
space:
mode:
authormikhnenko <mikhnenko@yandex-team.com>2025-01-15 10:21:24 +0300
committermikhnenko <mikhnenko@yandex-team.com>2025-01-15 10:51:44 +0300
commitd4335833a23cfb05cd23307a807ef318b5d32e4a (patch)
treea623318c1ca70196b72884f6a3bd418db6a54b95 /contrib/libs
parent22d628bb6cc8bd0cd690ae85f58b6aa2550b8962 (diff)
downloadydb-d4335833a23cfb05cd23307a807ef318b5d32e4a.tar.gz
Autogen ext and experimental sysincls
commit_hash:663ee1c040fc820b34e714256533e550544d2772
Diffstat (limited to 'contrib/libs')
-rw-r--r--contrib/libs/cxxsupp/libcxx/.yandex_meta/scripts/sysincls.py45
1 files changed, 37 insertions, 8 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/.yandex_meta/scripts/sysincls.py b/contrib/libs/cxxsupp/libcxx/.yandex_meta/scripts/sysincls.py
index a3fb43e6ea..d1a87cb532 100644
--- a/contrib/libs/cxxsupp/libcxx/.yandex_meta/scripts/sysincls.py
+++ b/contrib/libs/cxxsupp/libcxx/.yandex_meta/scripts/sysincls.py
@@ -14,6 +14,8 @@ assert sysincl.count("# GENERATED BY YM2") == 1
assert sysincl.count("# END OF GENERATION") == 1
headers = []
+ext_headers = []
+expr_headers = []
for header in include_dir.glob("**/*"):
if not header.is_file():
@@ -23,29 +25,56 @@ for header in include_dir.glob("**/*"):
if header.parent == include_dir:
if header.name.startswith("__") or not '.' in header.name:
- headers.append(rel_path)
+ headers.append(str(rel_path))
else:
str_path = str(rel_path)
- if str_path.startswith('experimental') or str_path.startswith('ext'):
- continue
- headers.append(rel_path)
+ if str_path.startswith('experimental'):
+ expr_headers.append(str_path)
+ elif str_path.startswith('ext'):
+ ext_headers.append(str_path)
+ else:
+ headers.append(str_path)
-headers = sorted(headers, key = lambda header: (str(header).count('/') != 0, str(header).count('__') != 0, header))
+
+headers = sorted(headers, key = lambda header: (header.count('/') != 0, header.count('__') != 0, header))
+ext_headers = sorted(ext_headers)
+expr_headers = sorted(expr_headers)
manual, generated = sysincl.split(GENERATED_BEG)
generated, manual_end = generated.split(GENERATED_END)
generated = []
+banned_generated = []
+
+for header in ext_headers + expr_headers:
+ banned_generated.append(
+ " - {name}:{spaces}DO_NOT_INCLUDE_NON_STANDARD_{banned_name}".format(
+ name=str(header),
+ spaces=' ' * max(1, 54 - len(header)),
+ banned_name=header.replace('/', '_').replace('.', '_').upper(),
+ )
+ )
+ if "experimental/propagate_const" == header:
+ banned_generated[-1] = "#TODO: ban this header too\n#" + banned_generated[-1]
for header in headers:
generated.append(
" - {name}:{spaces}contrib/libs/cxxsupp/libcxx/include/{name}".format(
- name=str(header),
- spaces=' ' * max(1, 54 - len(str(header)))
+ name=header,
+ spaces=' ' * max(1, 54 - len(header))
)
)
-generated = "- includes:\n" + '\n'.join(generated)
+generated = """- source_filter: "^(?!(contrib/libs/cxxsupp/libcxx)).*"
+ includes:
+""" \
+ + '\n'.join(banned_generated) \
+ + """
+
+# This includes all headers needed to resolve includes in c-headers from libcxx listed above
+- includes:
+""" \
+ + '\n'.join(generated)
with open(sysicncl_path, 'w') as f:
f.write(f"{manual}{GENERATED_BEG}{generated}\n{GENERATED_END}{manual_end}")