|
58 | 58 | import bootstrap |
59 | 59 | bootstrap.check() |
60 | 60 |
|
61 | | -# endings = dot + a suffix, compare against result of shared.suffix() |
62 | | -C_EXTENSIONS = ['.c', '.i'] |
63 | | -CXX_EXTENSIONS = ['.cppm', '.pcm', '.cpp', '.cxx', '.cc', '.c++', '.CPP', '.CXX', '.C', '.CC', '.C++', '.ii'] |
64 | | -OBJC_EXTENSIONS = ['.m', '.mi'] |
65 | | -PREPROCESSED_EXTENSIONS = ['.i', '.ii'] |
66 | | -OBJCXX_EXTENSIONS = ['.mm', '.mii'] |
67 | | -SPECIAL_ENDINGLESS_FILENAMES = [os.devnull] |
68 | | -C_EXTENSIONS += SPECIAL_ENDINGLESS_FILENAMES # consider the special endingless filenames like /dev/null to be C |
69 | | - |
70 | | -SOURCE_EXTENSIONS = C_EXTENSIONS + CXX_EXTENSIONS + OBJC_EXTENSIONS + OBJCXX_EXTENSIONS + ['.bc', '.ll', '.S'] |
71 | | -ASSEMBLY_EXTENSIONS = ['.s'] |
72 | | -HEADER_EXTENSIONS = ['.h', '.hxx', '.hpp', '.hh', '.H', '.HXX', '.HPP', '.HH'] |
| 61 | +PREPROCESSED_EXTENSIONS = {'.i', '.ii'} |
| 62 | +ASSEMBLY_EXTENSIONS = {'.s'} |
| 63 | +HEADER_EXTENSIONS = {'.h', '.hxx', '.hpp', '.hh', '.H', '.HXX', '.HPP', '.HH'} |
| 64 | +SOURCE_EXTENSIONS = { |
| 65 | + '.c', '.i', # C |
| 66 | + '.cppm', '.pcm', '.cpp', '.cxx', '.cc', '.c++', '.CPP', '.CXX', '.C', '.CC', '.C++', '.ii', # C++ |
| 67 | + '.m', '.mi', '.mm', '.mii', # ObjC/ObjC++ |
| 68 | + '.bc', '.ll', # LLVM IR |
| 69 | + '.S', # asm with preprocessor |
| 70 | + os.devnull # consider the special endingless filenames like /dev/null to be C |
| 71 | +} | PREPROCESSED_EXTENSIONS |
73 | 72 |
|
74 | 73 | # These symbol names are allowed in INCOMING_MODULE_JS_API but are not part of the |
75 | 74 | # default set. |
@@ -1018,7 +1017,7 @@ def compile_source_file(i, input_file): |
1018 | 1017 | # First, generate LLVM bitcode. For each input file, we get base.o with bitcode |
1019 | 1018 | for i, input_file in input_files: |
1020 | 1019 | file_suffix = get_file_suffix(input_file) |
1021 | | - if file_suffix in SOURCE_EXTENSIONS + ASSEMBLY_EXTENSIONS or (options.dash_c and file_suffix == '.bc'): |
| 1020 | + if file_suffix in SOURCE_EXTENSIONS | ASSEMBLY_EXTENSIONS or (options.dash_c and file_suffix == '.bc'): |
1022 | 1021 | compile_source_file(i, input_file) |
1023 | 1022 | elif file_suffix in DYLIB_EXTENSIONS: |
1024 | 1023 | logger.debug(f'using shared library: {input_file}') |
|
0 commit comments