diff options
author | mikhnenko <mikhnenko@yandex-team.com> | 2025-01-15 10:21:24 +0300 |
---|---|---|
committer | mikhnenko <mikhnenko@yandex-team.com> | 2025-01-15 10:51:44 +0300 |
commit | d4335833a23cfb05cd23307a807ef318b5d32e4a (patch) | |
tree | a623318c1ca70196b72884f6a3bd418db6a54b95 | |
parent | 22d628bb6cc8bd0cd690ae85f58b6aa2550b8962 (diff) | |
download | ydb-d4335833a23cfb05cd23307a807ef318b5d32e4a.tar.gz |
Autogen ext and experimental sysincls
commit_hash:663ee1c040fc820b34e714256533e550544d2772
-rw-r--r-- | build/sysincl/stl-to-libcxx.yml | 43 | ||||
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/.yandex_meta/scripts/sysincls.py | 45 |
2 files changed, 63 insertions, 25 deletions
diff --git a/build/sysincl/stl-to-libcxx.yml b/build/sysincl/stl-to-libcxx.yml index 22a93f7ad6..dc24ce5aa5 100644 --- a/build/sysincl/stl-to-libcxx.yml +++ b/build/sysincl/stl-to-libcxx.yml @@ -50,25 +50,34 @@ # Though these are headers provided by libcxx, we do not want to allow them to be included. # We are using non-existent filename to generate error instead, as there is no specific syntax for this case. -- includes: - - ext/hash_map: DO_NOT_INCLUDE_NON_STANDARD_EXT_HASH_MAP - - ext/hash_set: DO_NOT_INCLUDE_NON_STANDARD_EXT_HASH_SET - - experimental/any: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_ANY - - experimental/chrono: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_CHRONO - - experimental/coroutine: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_COROUTINE - - experimental/filesystem: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_FILESYSTEM - - experimental/numeric: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_NUMERIC - - experimental/memory: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_MEMORY - - experimental/optional: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_OPTIONAL - - experimental/ratio: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_RATIO - - experimental/source_location: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_SOURCE_LOCATION - - experimental/string_view: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_STRING_VIEW - - experimental/system_error: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_SYSTEM_ERROR - - experimental/tuple: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_TUPLE - +# GENERATED BY YM2 +- source_filter: "^(?!(contrib/libs/cxxsupp/libcxx)).*" + includes: + - ext/__hash: DO_NOT_INCLUDE_NON_STANDARD_EXT___HASH + - ext/hash_map: DO_NOT_INCLUDE_NON_STANDARD_EXT_HASH_MAP + - ext/hash_set: DO_NOT_INCLUDE_NON_STANDARD_EXT_HASH_SET + - experimental/__config: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL___CONFIG + - experimental/__memory: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL___MEMORY + - experimental/__simd/abi_tag.h: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL___SIMD_ABI_TAG_H + - experimental/__simd/aligned_tag.h: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL___SIMD_ALIGNED_TAG_H + - experimental/__simd/declaration.h: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL___SIMD_DECLARATION_H + - experimental/__simd/internal_declaration.h: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL___SIMD_INTERNAL_DECLARATION_H + - experimental/__simd/reference.h: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL___SIMD_REFERENCE_H + - experimental/__simd/scalar.h: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL___SIMD_SCALAR_H + - experimental/__simd/simd.h: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL___SIMD_SIMD_H + - experimental/__simd/simd_mask.h: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL___SIMD_SIMD_MASK_H + - experimental/__simd/traits.h: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL___SIMD_TRAITS_H + - experimental/__simd/utility.h: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL___SIMD_UTILITY_H + - experimental/__simd/vec_ext.h: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL___SIMD_VEC_EXT_H + - experimental/iterator: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_ITERATOR + - experimental/memory: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_MEMORY +#TODO: ban this header too +# - experimental/propagate_const: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_PROPAGATE_CONST + - experimental/simd: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_SIMD + - experimental/type_traits: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_TYPE_TRAITS + - experimental/utility: DO_NOT_INCLUDE_NON_STANDARD_EXPERIMENTAL_UTILITY # This includes all headers needed to resolve includes in c-headers from libcxx listed above -# GENERATED BY YM2 - includes: - algorithm: contrib/libs/cxxsupp/libcxx/include/algorithm - any: contrib/libs/cxxsupp/libcxx/include/any 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}") |