From 4b855a55be15146b775888b3961c89ae1b26efb8 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 3 Sep 2026 17:46:37 -0700 Subject: [PATCH] Consistent indentation for python multi-line data structures. NFC Standardize on 2-space indentation for multi-line lists, sets, and dictionaries across the codebase. The reason we have some inconsistency here between out code indentation and out data structure indentation is that `.style.yapf` was lacking a `continuation_indent_width = 2`, so I added this. Also convert `SUPPORTED_LINKER_FLAGS` in `tools/link.py` from a tuple to a set for O(1) membership lookups. --- .style.yapf | 1 + embuilder.py | 228 ++++++++--------- emcc.py | 14 +- system/lib/update_compiler_rt.py | 20 +- system/lib/update_llvm_libc.py | 50 ++-- system/lib/update_openmp.py | 44 ++-- test/clang_native.py | 16 +- test/test_benchmark.py | 16 +- test/test_core.py | 6 +- test/test_emrun.py | 10 +- test/test_other.py | 76 +++--- tools/building.py | 12 +- tools/cmdline.py | 14 +- tools/diagnostics.py | 8 +- tools/gen_struct_info.py | 26 +- tools/link.py | 30 +-- tools/maint/add_license.py | 14 +- tools/maint/create_release.py | 10 +- tools/maint/gen_release_notes.py | 8 +- tools/maint/gen_sig_info.py | 16 +- tools/ports/icu.py | 42 ++-- tools/settings.py | 410 +++++++++++++++---------------- tools/system_libs.py | 100 ++++---- 23 files changed, 586 insertions(+), 585 deletions(-) diff --git a/.style.yapf b/.style.yapf index de72b98c2c862..c0496d5b331ab 100644 --- a/.style.yapf +++ b/.style.yapf @@ -1,3 +1,4 @@ [style] based_on_style = pep8 indent_width = 2 +continuation_indent_width = 2 diff --git a/embuilder.py b/embuilder.py index 3dbdb704aa24b..c5f6cdc133d22 100755 --- a/embuilder.py +++ b/embuilder.py @@ -27,125 +27,125 @@ # Minimal subset of targets used by CI systems to build enough to be useful MINIMAL_TASKS = [ - 'libclang_rt.builtins', - 'libclang_rt.builtins-mt', - 'libclang_rt.builtins-legacysjlj', - 'libclang_rt.builtins-wasmsjlj', - 'libclang_rt.builtins-ww', - 'libclang_rt.asan', - 'libclang_rt.asan-mt', - 'libclang_rt.lsan', - 'libclang_rt.lsan-mt', - 'libclang_rt.lsan_common', - 'libclang_rt.lsan_common-mt', - 'libclang_rt.sanitizer_common', - 'libclang_rt.sanitizer_common-mt', - 'libclang_rt.ubsan', - 'libclang_rt.ubsan-mt', - 'libc', - 'libc-asan-debug', - 'libc-debug', - 'libc-mt-debug', - 'libc-mt-asan-debug', - 'libc-ww-debug', - 'libc_optz', - 'libc_optz-debug', - 'libc++abi', - 'libc++abi-legacyexcept', - 'libc++abi-wasmexcept', - 'libc++abi-noexcept', - 'libc++abi-debug', - 'libc++abi-debug-legacyexcept', - 'libc++abi-debug-wasmexcept', - 'libc++abi-debug-noexcept', - 'libc++abi-debug-mt-noexcept', - 'libc++abi-debug-ww-noexcept', - 'libc++', - 'libc++-legacyexcept', - 'libc++-wasmexcept', - 'libc++-noexcept', - 'libc++-ww-noexcept', - 'libc++-debug', - 'libc++-debug-wasmexcept', - 'libc++-debug-legacyexcept', - 'libc++-debug-noexcept', - 'libc++-debug-mt-noexcept', - 'libc++-debug-ww-noexcept', - 'libal', - 'libdlmalloc', - 'libdlmalloc-tracing', - 'libdlmalloc-debug', - 'libdlmalloc-mt-debug', - 'libdlmalloc-ww', - 'libdlmalloc-ww-debug', - 'libembind', - 'libembind-rtti', - 'libembind-mt-rtti', - 'libemmalloc', - 'libemmalloc-debug', - 'libemmalloc-memvalidate', - 'libemmalloc-verbose', - 'libemmalloc-memvalidate-verbose', - 'libmimalloc', - 'libmimalloc-mt', - 'libGL', - 'libGL-getprocaddr', - 'libGL-mt-getprocaddr', - 'libGL-emu-getprocaddr', - 'libGL-emu-webgl2-ofb-getprocaddr', - 'libGL-webgl2-ofb-getprocaddr', - 'libGL-webgl2-ofb-full_es3-getprocaddr', - 'libGL-ww-getprocaddr', - 'libhtml5', - 'libsockets', - 'libsockets-mt', - 'libsockets-ww', - 'libstubs', - 'libstubs-debug', - 'libstandalonewasm-nocatch', - 'crt1', - 'crt1_proxy_main', - 'crtbegin-mt', - 'libunwind-legacyexcept', - 'libunwind-wasmexcept', - 'libnoexit', - 'bullet', - 'libstb_image', - 'libwasmfs_no_fs', - 'libwasmfs-debug', - 'libwasm_workers-debug', + 'libclang_rt.builtins', + 'libclang_rt.builtins-mt', + 'libclang_rt.builtins-legacysjlj', + 'libclang_rt.builtins-wasmsjlj', + 'libclang_rt.builtins-ww', + 'libclang_rt.asan', + 'libclang_rt.asan-mt', + 'libclang_rt.lsan', + 'libclang_rt.lsan-mt', + 'libclang_rt.lsan_common', + 'libclang_rt.lsan_common-mt', + 'libclang_rt.sanitizer_common', + 'libclang_rt.sanitizer_common-mt', + 'libclang_rt.ubsan', + 'libclang_rt.ubsan-mt', + 'libc', + 'libc-asan-debug', + 'libc-debug', + 'libc-mt-debug', + 'libc-mt-asan-debug', + 'libc-ww-debug', + 'libc_optz', + 'libc_optz-debug', + 'libc++abi', + 'libc++abi-legacyexcept', + 'libc++abi-wasmexcept', + 'libc++abi-noexcept', + 'libc++abi-debug', + 'libc++abi-debug-legacyexcept', + 'libc++abi-debug-wasmexcept', + 'libc++abi-debug-noexcept', + 'libc++abi-debug-mt-noexcept', + 'libc++abi-debug-ww-noexcept', + 'libc++', + 'libc++-legacyexcept', + 'libc++-wasmexcept', + 'libc++-noexcept', + 'libc++-ww-noexcept', + 'libc++-debug', + 'libc++-debug-wasmexcept', + 'libc++-debug-legacyexcept', + 'libc++-debug-noexcept', + 'libc++-debug-mt-noexcept', + 'libc++-debug-ww-noexcept', + 'libal', + 'libdlmalloc', + 'libdlmalloc-tracing', + 'libdlmalloc-debug', + 'libdlmalloc-mt-debug', + 'libdlmalloc-ww', + 'libdlmalloc-ww-debug', + 'libembind', + 'libembind-rtti', + 'libembind-mt-rtti', + 'libemmalloc', + 'libemmalloc-debug', + 'libemmalloc-memvalidate', + 'libemmalloc-verbose', + 'libemmalloc-memvalidate-verbose', + 'libmimalloc', + 'libmimalloc-mt', + 'libGL', + 'libGL-getprocaddr', + 'libGL-mt-getprocaddr', + 'libGL-emu-getprocaddr', + 'libGL-emu-webgl2-ofb-getprocaddr', + 'libGL-webgl2-ofb-getprocaddr', + 'libGL-webgl2-ofb-full_es3-getprocaddr', + 'libGL-ww-getprocaddr', + 'libhtml5', + 'libsockets', + 'libsockets-mt', + 'libsockets-ww', + 'libstubs', + 'libstubs-debug', + 'libstandalonewasm-nocatch', + 'crt1', + 'crt1_proxy_main', + 'crtbegin-mt', + 'libunwind-legacyexcept', + 'libunwind-wasmexcept', + 'libnoexit', + 'bullet', + 'libstb_image', + 'libwasmfs_no_fs', + 'libwasmfs-debug', + 'libwasm_workers-debug', ] # Additional tasks on top of MINIMAL_TASKS that are necessary for PIC testing on # CI (which has slightly more tests than other modes that want to use MINIMAL) MINIMAL_PIC_TASKS = [ - *MINIMAL_TASKS, - 'libc-mt', - 'libc_optz-mt', - 'libc_optz-mt-debug', - 'libc++abi-mt', - 'libc++abi-mt-noexcept', - 'libc++abi-debug-mt', - 'libc++-mt', - 'libc++-mt-noexcept', - 'libc++-debug-mt', - 'libdlmalloc-mt', - 'libGL-emu', - 'libGL-emu-webgl2-getprocaddr', - 'libGL-mt-emu', - 'libGL-mt-emu-webgl2-getprocaddr', - 'libGL-mt-emu-webgl2-ofb-getprocaddr', - 'libsockets_proxy', - 'libfetch', - 'libfetch-mt', - 'libwasmfs', - 'giflib', - 'sdl2', - 'sdl2_image', - 'sdl2_image-legacysjlj', - 'sdl2_image-wasmsjlj', - 'sdl2_gfx', - 'sdl3', + *MINIMAL_TASKS, + 'libc-mt', + 'libc_optz-mt', + 'libc_optz-mt-debug', + 'libc++abi-mt', + 'libc++abi-mt-noexcept', + 'libc++abi-debug-mt', + 'libc++-mt', + 'libc++-mt-noexcept', + 'libc++-debug-mt', + 'libdlmalloc-mt', + 'libGL-emu', + 'libGL-emu-webgl2-getprocaddr', + 'libGL-mt-emu', + 'libGL-mt-emu-webgl2-getprocaddr', + 'libGL-mt-emu-webgl2-ofb-getprocaddr', + 'libsockets_proxy', + 'libfetch', + 'libfetch-mt', + 'libwasmfs', + 'giflib', + 'sdl2', + 'sdl2_image', + 'sdl2_image-legacysjlj', + 'sdl2_image-wasmsjlj', + 'sdl2_gfx', + 'sdl3', ] PORTS = sorted(list(ports.ports_by_name.keys()) + list(ports.port_variants.keys())) diff --git a/emcc.py b/emcc.py index aae61e47b1655..b3207c7a15c25 100644 --- a/emcc.py +++ b/emcc.py @@ -78,13 +78,13 @@ } | PREPROCESSED_EXTENSIONS LINK_ONLY_FLAGS = { - '--bind', '--closure', '--cpuprofiler', '--embed-file', - '--emit-symbol-map', '--emrun', '--exclude-file', '--extern-post-js', - '--extern-pre-js', '--ignore-dynamic-linking', '--js-library', - '--js-transform', '--oformat', '--output_eol', '--output-eol', - '--post-js', '--pre-js', '--preload-file', '--profiling-funcs', - '--proxy-to-worker', '--shell-file', '--source-map-base', - '--threadprofiler', '--use-preload-plugins', + '--bind', '--closure', '--cpuprofiler', '--embed-file', + '--emit-symbol-map', '--emrun', '--exclude-file', '--extern-post-js', + '--extern-pre-js', '--ignore-dynamic-linking', '--js-library', + '--js-transform', '--oformat', '--output_eol', '--output-eol', + '--post-js', '--pre-js', '--preload-file', '--profiling-funcs', + '--proxy-to-worker', '--shell-file', '--source-map-base', + '--threadprofiler', '--use-preload-plugins', } PASSTHROUGH_FLAGS = { diff --git a/system/lib/update_compiler_rt.py b/system/lib/update_compiler_rt.py index 5caa3703970a3..f799cebfe47ce 100755 --- a/system/lib/update_compiler_rt.py +++ b/system/lib/update_compiler_rt.py @@ -18,16 +18,16 @@ local_src = os.path.join(script_dir, 'compiler-rt') copy_dirs = [ - ('include', 'sanitizer'), - ('include', 'profile'), - ('lib', 'sanitizer_common'), - ('lib', 'asan'), - ('lib', 'interception'), - ('lib', 'builtins'), - ('lib', 'lsan'), - ('lib', 'ubsan'), - ('lib', 'ubsan_minimal'), - ('lib', 'profile'), + ('include', 'sanitizer'), + ('include', 'profile'), + ('lib', 'sanitizer_common'), + ('lib', 'asan'), + ('lib', 'interception'), + ('lib', 'builtins'), + ('lib', 'lsan'), + ('lib', 'ubsan'), + ('lib', 'ubsan_minimal'), + ('lib', 'profile'), ] preserve_files = ('readme.txt',) diff --git a/system/lib/update_llvm_libc.py b/system/lib/update_llvm_libc.py index 2fe742e9f6a1f..5c0411060e6d5 100755 --- a/system/lib/update_llvm_libc.py +++ b/system/lib/update_llvm_libc.py @@ -21,36 +21,36 @@ excludes = ('CMakeLists.txt', 'ryu_long_double_constants.h') libc_copy_dirs = [ - 'hdr', - 'include/llvm-libc-macros', - 'include/llvm-libc-types', - 'shared', - 'config', - 'src/__support', - 'src/assert', - 'src/complex', - 'src/errno', - 'src/inttypes', - 'src/math', - 'src/setjmp', - 'src/stdio/printf_core', - 'src/stdlib', - 'src/string', - 'src/strings', - 'src/wchar', + 'hdr', + 'include/llvm-libc-macros', + 'include/llvm-libc-types', + 'shared', + 'config', + 'src/__support', + 'src/assert', + 'src/complex', + 'src/errno', + 'src/inttypes', + 'src/math', + 'src/setjmp', + 'src/stdio/printf_core', + 'src/stdlib', + 'src/string', + 'src/strings', + 'src/wchar', ] libc_exclusion_patterns = [ - # float16 is unsupported in Emscripten. - 'src/complex/**/*f16*', - 'src/math/generic/*f16*', + # float16 is unsupported in Emscripten. + 'src/complex/**/*f16*', + 'src/math/generic/*f16*', - 'src/setjmp/**/*', # setjmp in Emscripten is implemented by the clang backend. + 'src/setjmp/**/*', # setjmp in Emscripten is implemented by the clang backend. - # locale_t is unsupported in Overlay Mode. - 'src/strings/str*casecmp_l*', - 'src/stdlib/str*_l.*', - 'src/string/str*_l.*', + # locale_t is unsupported in Overlay Mode. + 'src/strings/str*casecmp_l*', + 'src/stdlib/str*_l.*', + 'src/string/str*_l.*', ] diff --git a/system/lib/update_openmp.py b/system/lib/update_openmp.py index 7c47133d5d305..41376acb82497 100755 --- a/system/lib/update_openmp.py +++ b/system/lib/update_openmp.py @@ -26,13 +26,13 @@ # Files to ignore during copy_tree excludes = ( - 'doc', - 'build', - 'tests', - 'CMakeFiles', - 'libgomp.a', - 'libiomp5.a', - 'libomp.a', + 'doc', + 'build', + 'tests', + 'CMakeFiles', + 'libgomp.a', + 'libiomp5.a', + 'libomp.a', ) @@ -62,21 +62,21 @@ def main(): # Generates header files for OpenMP library build subprocess.run([ - os.path.join(emscripten_root, 'emcmake'), 'cmake', - '-S', upstream_runtimes, - '-B', build_dir, - '-G', 'Ninja', - '-DLLVM_ENABLE_RUNTIMES=openmp', - '-DLLVM_DEFAULT_TARGET_TRIPLE=wasm32-unknown-emscripten', - '-DOPENMP_ENABLE_LIBOMPTARGET=OFF', - '-DLIBOMP_HAVE_OMPT_SUPPORT=OFF', - '-DLIBOMP_OMPT_SUPPORT=OFF', - '-DLIBOMP_OMPD_SUPPORT=OFF', - '-DLIBOMP_USE_DEBUGGER=OFF', - '-DLIBOMP_FORTRAN_MODULES=OFF', - '-DLIBOMP_ENABLE_SHARED=OFF', - '-DLIBOMP_ARCH=wasm32', - '-DOPENMP_ENABLE_LIBOMPTARGET_PROFILING=OFF', + os.path.join(emscripten_root, 'emcmake'), 'cmake', + '-S', upstream_runtimes, + '-B', build_dir, + '-G', 'Ninja', + '-DLLVM_ENABLE_RUNTIMES=openmp', + '-DLLVM_DEFAULT_TARGET_TRIPLE=wasm32-unknown-emscripten', + '-DOPENMP_ENABLE_LIBOMPTARGET=OFF', + '-DLIBOMP_HAVE_OMPT_SUPPORT=OFF', + '-DLIBOMP_OMPT_SUPPORT=OFF', + '-DLIBOMP_OMPD_SUPPORT=OFF', + '-DLIBOMP_USE_DEBUGGER=OFF', + '-DLIBOMP_FORTRAN_MODULES=OFF', + '-DLIBOMP_ENABLE_SHARED=OFF', + '-DLIBOMP_ARCH=wasm32', + '-DOPENMP_ENABLE_LIBOMPTARGET_PROFILING=OFF', ], check=True) subprocess.run(['cmake', '--build', '.'], cwd=build_dir, check=True) diff --git a/test/clang_native.py b/test/clang_native.py index a835166bb65f9..25a8992b6c150 100644 --- a/test/clang_native.py +++ b/test/clang_native.py @@ -25,16 +25,16 @@ def get_native_triple(): return native_compilation_triple arch = { - 'aarch64': 'arm64', - 'arm64': 'arm64', # Python on Apple Silicon ARM64 reports lowercase arm64 - 'ARM64': 'arm64', # Python on Windows-on-ARM reports uppercase ARM64 - 'x86_64': 'x86_64', - 'AMD64': 'x86_64', + 'aarch64': 'arm64', + 'arm64': 'arm64', # Python on Apple Silicon ARM64 reports lowercase arm64 + 'ARM64': 'arm64', # Python on Windows-on-ARM reports uppercase ARM64 + 'x86_64': 'x86_64', + 'AMD64': 'x86_64', }[platform.machine()] OS = { - 'linux': 'linux', - 'darwin': 'darwin', - 'win32': 'windows-msvc', + 'linux': 'linux', + 'darwin': 'darwin', + 'win32': 'windows-msvc', }[sys.platform] return f'{arch}-{OS}' diff --git a/test/test_benchmark.py b/test/test_benchmark.py index 3311631a67439..803befe584d9d 100644 --- a/test/test_benchmark.py +++ b/test/test_benchmark.py @@ -1119,14 +1119,14 @@ def lib_builder(name, native, env_init): def test_zzz_bullet(self): self.cflags.remove('-Werror') bullet_cflags = [ - '-Wno-int-to-void-pointer-cast', - '-Wno-c++11-narrowing', - '-Wno-deprecated-register', - '-Wno-writable-strings', - '-Wno-shift-negative-value', - '-Wno-format', - '-Wno-nontrivial-memcall', - '-Wno-single-bit-bitfield-constant-conversion', + '-Wno-int-to-void-pointer-cast', + '-Wno-c++11-narrowing', + '-Wno-deprecated-register', + '-Wno-writable-strings', + '-Wno-shift-negative-value', + '-Wno-format', + '-Wno-nontrivial-memcall', + '-Wno-single-bit-bitfield-constant-conversion', ] src = read_file(test_file('third_party/bullet/Demos/Benchmarks/BenchmarkDemo.cpp')) src += read_file(test_file('third_party/bullet/Demos/Benchmarks/main.cpp')) diff --git a/test/test_core.py b/test/test_core.py index 2ed54cb4a3dec..47f160ce17647 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -7220,9 +7220,9 @@ def test_dyncall_specific(self): # more without them - we don't need to legalize) self.cflags += ['-sDYNCALLS', '-DWASM_BIGINT'] cases = [ - ('DIRECT', []), - ('DYNAMIC_SIG', ['-sDYNCALLS']), - ] + ('DIRECT', []), + ('DYNAMIC_SIG', ['-sDYNCALLS']), + ] if self.get_setting('MINIMAL_RUNTIME') == 0: cases += [ ('EXPORTED', []), diff --git a/test/test_emrun.py b/test/test_emrun.py index 7d80b675824c3..72c0da0d82826 100644 --- a/test/test_emrun.py +++ b/test/test_emrun.py @@ -102,11 +102,11 @@ def test_emrun(self): args_base += ['--browser_args', ' ' + ' '.join(browser_args)] for args in [ - [], - ['--port', '0'], - ['--private_browsing'], - ['--dump_out_directory', 'other dir/multiple'], - ['--dump_out_directory=foo_bar'], + [], + ['--port', '0'], + ['--private_browsing'], + ['--dump_out_directory', 'other dir/multiple'], + ['--dump_out_directory=foo_bar'], ]: args = args_base + args + [self.in_dir('test_emrun.html'), '--', '1', '2', '--3', 'escaped space', 'with_underscore'] print(shlex.join(args)) diff --git a/test/test_other.py b/test/test_other.py index 5b113141e2d0b..a2454958bb6f6 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -1575,8 +1575,8 @@ def test_whole_archive_48156(self): self.run_process([EMAR, 'rc', 'libfoo.a', 'foo.o']) self.run_process([EMAR, 'rc', 'libmain.a', 'main.o']) self.run_process([ - EMXX, test_file('test_whole_archive_init.cpp'), - '-O1', 'libfoo.a', '-Wl,--whole-archive', 'libmain.a', '-Wl,--no-whole-archive']) + EMXX, test_file('test_whole_archive_init.cpp'), + '-O1', 'libfoo.a', '-Wl,--whole-archive', 'libmain.a', '-Wl,--no-whole-archive']) self.assertContained('Result: 11', self.run_js('a.out.js')) def test_link_group_bitcode(self): @@ -4938,14 +4938,14 @@ def test_fs_after_main(self, args): def test_oz_size(self): sizes = {} for name, args in [ - ('0', []), - ('1', ['-O1']), - ('2', ['-O2']), - ('s', ['-Os']), - ('z', ['-Oz']), - ('3', ['-O3']), - ('g', ['-Og']), - ]: + ('0', []), + ('1', ['-O1']), + ('2', ['-O2']), + ('s', ['-Os']), + ('z', ['-Oz']), + ('3', ['-O3']), + ('g', ['-Og']), + ]: print(name, args) self.clear() self.run_process([EMCC, '-c', path_from_root('system/lib/dlmalloc.c')] + args) @@ -8460,10 +8460,10 @@ def test_initial_heap(self, args, expected_initial_heap): def test_memory_size(self): for args, expect_initial, expect_max in [ - ([], 320, 320), - (['-sALLOW_MEMORY_GROWTH'], 320, 32768), - (['-sALLOW_MEMORY_GROWTH', '-sMAXIMUM_MEMORY=40MB'], 320, 640), - ]: + ([], 320, 320), + (['-sALLOW_MEMORY_GROWTH'], 320, 32768), + (['-sALLOW_MEMORY_GROWTH', '-sMAXIMUM_MEMORY=40MB'], 320, 640), + ]: cmd = [EMCC, test_file('hello_world.c'), '-O2', '-sINITIAL_MEMORY=20MB'] + args print(' '.join(cmd)) self.run_process(cmd) @@ -8540,25 +8540,25 @@ def test_ctor_ordering(self, args): @crossplatform def test_binaryen_debug(self): for args, expect_clean_js, expect_whitespace_js, expect_closured in [ - (['-O0'], False, True, False), - (['-O0', '-g1'], False, True, False), - (['-O0', '-g2'], False, True, False), - (['-O0', '-g'], False, True, False), - (['-O0', '--profiling-funcs'], False, True, False), - (['-O0', '-gline-tables-only'], False, True, False), - (['-O1'], False, True, False), - (['-O3'], True, False, False), - (['-Oz', '-gsource-map'], True, False, False), - (['-O2'], True, False, False), - (['-O2', '-gz'], True, False, False), # -gz means debug compression, it should not enable debugging - (['-O2', '-g1'], False, True, False), - (['-O2', '-g'], False, True, False), - (['-O2', '--closure=1'], True, False, True), - (['-O2', '--closure=1', '-g1'], True, True, True), - (['-O2', '--minify=0'], False, True, False), - (['-O2', '--profiling-funcs'], True, False, False), - (['-O2', '--profiling'], False, True, False), - ]: + (['-O0'], False, True, False), + (['-O0', '-g1'], False, True, False), + (['-O0', '-g2'], False, True, False), + (['-O0', '-g'], False, True, False), + (['-O0', '--profiling-funcs'], False, True, False), + (['-O0', '-gline-tables-only'], False, True, False), + (['-O1'], False, True, False), + (['-O3'], True, False, False), + (['-Oz', '-gsource-map'], True, False, False), + (['-O2'], True, False, False), + (['-O2', '-gz'], True, False, False), # -gz means debug compression, it should not enable debugging + (['-O2', '-g1'], False, True, False), + (['-O2', '-g'], False, True, False), + (['-O2', '--closure=1'], True, False, True), + (['-O2', '--closure=1', '-g1'], True, True, True), + (['-O2', '--minify=0'], False, True, False), + (['-O2', '--profiling-funcs'], True, False, False), + (['-O2', '--profiling'], False, True, False), + ]: print(args, expect_clean_js, expect_whitespace_js, expect_closured) delete_file('a.out.wat') cmd = [EMCC, test_file('hello_world.c')] + args @@ -8574,9 +8574,9 @@ def test_binaryen_ignore_implicit_traps(self): sizes = [] with env_modify({'EMCC_DEBUG': '1'}): for args, expect in [ - ([], False), - (['-sBINARYEN_IGNORE_IMPLICIT_TRAPS'], True), - ]: + ([], False), + (['-sBINARYEN_IGNORE_IMPLICIT_TRAPS'], True), + ]: print(args, expect) cmd = [EMXX, test_file('hello_libcxx.cpp'), '-O3'] + args print(' '.join(cmd)) @@ -16040,8 +16040,8 @@ def test_cross_origin_storage_origins(self): def test_dead_code_esm(self): self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6', '-O2', '-o', 'hello.mjs']) rollup_cmd = shared.get_npm_cmd('rollup') + [ - 'hello.mjs', '--format', 'es', '--file', 'hello.rolled.mjs', - '--external', 'node:module', + 'hello.mjs', '--format', 'es', '--file', 'hello.rolled.mjs', + '--external', 'node:module', ] self.run_process(rollup_cmd) prettier_cmd = shared.get_npm_cmd('prettier') diff --git a/tools/building.py b/tools/building.py index fc85d5e61fb98..684146752d89d 100644 --- a/tools/building.py +++ b/tools/building.py @@ -1326,12 +1326,12 @@ def run_wasm_bindgen(infile): if not wasm_bindgen_bin: exit_with_error('wasm-bindgen executable not found in $PATH') cmd = [ - wasm_bindgen_bin, - infile, - '--keep-lld-exports', - '--keep-debug', - '--out-dir', - bindgen_out_dir, + wasm_bindgen_bin, + infile, + '--keep-lld-exports', + '--keep-debug', + '--out-dir', + bindgen_out_dir, ] check_call(cmd) diff --git a/tools/cmdline.py b/tools/cmdline.py index 9485c276fee17..974bf8d44084e 100644 --- a/tools/cmdline.py +++ b/tools/cmdline.py @@ -27,13 +27,13 @@ SIMD_INTEL_FEATURE_TOWER = ['-msse', '-msse2', '-msse3', '-mssse3', '-msse4.1', '-msse4.2', '-msse4', '-mavx', '-mavx2', '-mfma'] SIMD_NEON_FLAGS = ['-mfpu=neon'] CLANG_FLAGS_WITH_ARGS = { - '-MT', '-MF', '-MJ', '-MQ', '-D', '-U', '-o', '-x', - '-Xpreprocessor', '-include', '-imacros', '-idirafter', - '-iprefix', '-iwithprefix', '-iwithprefixbefore', - '-isysroot', '-imultilib', '-A', '-isystem', '-iquote', - '-install_name', '-compatibility_version', '-mllvm', - '-current_version', '-I', '-L', '-include-pch', '-u', - '-undefined', '-target', '-Xlinker', '-Xclang', '-z', + '-MT', '-MF', '-MJ', '-MQ', '-D', '-U', '-o', '-x', + '-Xpreprocessor', '-include', '-imacros', '-idirafter', + '-iprefix', '-iwithprefix', '-iwithprefixbefore', + '-isysroot', '-imultilib', '-A', '-isystem', '-iquote', + '-install_name', '-compatibility_version', '-mllvm', + '-current_version', '-I', '-L', '-include-pch', '-u', + '-undefined', '-target', '-Xlinker', '-Xclang', '-z', } diff --git a/tools/diagnostics.py b/tools/diagnostics.py index 9edea83e8c3f1..64df53c526438 100644 --- a/tools/diagnostics.py +++ b/tools/diagnostics.py @@ -20,13 +20,13 @@ # color for use for each diagnostic level level_colors = { - WARN: colored_logger.MAGENTA, - ERROR: colored_logger.RED, + WARN: colored_logger.MAGENTA, + ERROR: colored_logger.RED, } level_prefixes = { - WARN: 'warning: ', - ERROR: 'error: ', + WARN: 'warning: ', + ERROR: 'error: ', } diff --git a/tools/gen_struct_info.py b/tools/gen_struct_info.py index 7f6a1ecd4d69a..916744206e717 100755 --- a/tools/gen_struct_info.py +++ b/tools/gen_struct_info.py @@ -73,28 +73,28 @@ DEBUG = False CFLAGS = [ - # Avoid parsing problems due to gcc specific syntax. - '-D_GNU_SOURCE', + # Avoid parsing problems due to gcc specific syntax. + '-D_GNU_SOURCE', ] INTERNAL_CFLAGS = [ - '-I' + utils.path_from_root('system/lib/libc/musl/arch/emscripten'), - '-I' + utils.path_from_root('system/lib/libc/musl/arch/generic'), - '-I' + utils.path_from_root('system/lib/libc/musl/src/internal'), - '-I' + utils.path_from_root('system/lib/libc/musl/src/include'), - '-I' + utils.path_from_root('system/lib/pthread/'), + '-I' + utils.path_from_root('system/lib/libc/musl/arch/emscripten'), + '-I' + utils.path_from_root('system/lib/libc/musl/arch/generic'), + '-I' + utils.path_from_root('system/lib/libc/musl/src/internal'), + '-I' + utils.path_from_root('system/lib/libc/musl/src/include'), + '-I' + utils.path_from_root('system/lib/pthread/'), ] CXXFLAGS = [ - '-I' + utils.path_from_root('system/lib/libcxxabi/src'), - '-D__EMSCRIPTEN_EXCEPTIONS__', - '-I' + utils.path_from_root('system/lib/wasmfs/'), + '-I' + utils.path_from_root('system/lib/libcxxabi/src'), + '-D__EMSCRIPTEN_EXCEPTIONS__', + '-I' + utils.path_from_root('system/lib/wasmfs/'), ] DEFAULT_JSON_FILES = [ - utils.path_from_root('src/struct_info.json'), - utils.path_from_root('src/struct_info_internal.json'), - utils.path_from_root('src/struct_info_cxx.json'), + utils.path_from_root('src/struct_info.json'), + utils.path_from_root('src/struct_info_internal.json'), + utils.path_from_root('src/struct_info_cxx.json'), ] diff --git a/tools/link.py b/tools/link.py index 949207b1c65a2..5e97948b4be4e 100644 --- a/tools/link.py +++ b/tools/link.py @@ -72,25 +72,25 @@ EXECUTABLE_EXTENSIONS = ['.wasm', '.html', '.js', '.mjs', '.out', ''] # Supported LLD flags which we will pass through to the linker. -SUPPORTED_LINKER_FLAGS = ( - '--start-group', '--end-group', - '-(', '-)', - '--whole-archive', '--no-whole-archive', - '-whole-archive', '-no-whole-archive', - '-rpath', -) +SUPPORTED_LINKER_FLAGS = { + '--start-group', '--end-group', + '-(', '-)', + '--whole-archive', '--no-whole-archive', + '-whole-archive', '-no-whole-archive', + '-rpath', +} # Unsupported LLD flags which we will ignore. # Maps to true if the flag takes an argument. UNSUPPORTED_LLD_FLAGS = { - # macOS-specific linker flag that libtool (ltmain.sh) will if macOS is detected. - '-bind_at_load': False, - # wasm-ld doesn't support soname or other dynamic linking flags (yet). Ignore them - # in order to aid build systems that want to pass these flags. - '-allow-shlib-undefined': False, - '-rpath-link': True, - '-version-script': True, - '-install_name': True, + # macOS-specific linker flag that libtool (ltmain.sh) will if macOS is detected. + '-bind_at_load': False, + # wasm-ld doesn't support soname or other dynamic linking flags (yet). Ignore them + # in order to aid build systems that want to pass these flags. + '-allow-shlib-undefined': False, + '-rpath-link': True, + '-version-script': True, + '-install_name': True, } UBSAN_SANITIZERS = { diff --git a/tools/maint/add_license.py b/tools/maint/add_license.py index a624dad972a10..0d900cc5aa1ad 100755 --- a/tools/maint/add_license.py +++ b/tools/maint/add_license.py @@ -46,13 +46,13 @@ ''' exclude_filenames = [ - 'system/include/', - 'system/lib/libc/musl/', - 'system/lib/html5/dom_pk_codes.c', - 'system/lib/dlmalloc.c', - 'third_party/', - 'test/optimizer/', - 'site/source/_themes/', + 'system/include/', + 'system/lib/libc/musl/', + 'system/lib/html5/dom_pk_codes.c', + 'system/lib/dlmalloc.c', + 'third_party/', + 'test/optimizer/', + 'site/source/_themes/', ] exclude_contents = ['Copyright', 'LICENSE.TXT', 'PUBLIC DOMAIN'] diff --git a/tools/maint/create_release.py b/tools/maint/create_release.py index ce8bd028e4259..4d34e3a9b56a1 100755 --- a/tools/maint/create_release.py +++ b/tools/maint/create_release.py @@ -95,11 +95,11 @@ def create_draft_release(version, base_commit): # Create the draft release cmd = [ - 'gh', 'release', 'create', version, - '--draft', - '--title', version, - '--notes-file', notes_file, - '-R', REPO, + 'gh', 'release', 'create', version, + '--draft', + '--title', version, + '--notes-file', notes_file, + '-R', REPO, ] if base_commit: cmd.extend(['--target', base_commit]) diff --git a/tools/maint/gen_release_notes.py b/tools/maint/gen_release_notes.py index 6f6fc4d1dfd06..b10dc2832c705 100755 --- a/tools/maint/gen_release_notes.py +++ b/tools/maint/gen_release_notes.py @@ -115,10 +115,10 @@ def get_previous_version(changelog_path, version): def generate_default_notes(tag, previous_tag): cmd = [ - 'gh', 'api', - f'/repos/{REPO}/releases/generate-notes', - '-f', f'tag_name={tag}', - '-f', f'previous_tag_name={previous_tag}', + 'gh', 'api', + f'/repos/{REPO}/releases/generate-notes', + '-f', f'tag_name={tag}', + '-f', f'previous_tag_name={previous_tag}', ] result = subprocess.run(cmd, capture_output=True, text=True, check=True) return json.loads(result.stdout) diff --git a/tools/maint/gen_sig_info.py b/tools/maint/gen_sig_info.py index eb730c768dfc1..8f1f62922543a 100755 --- a/tools/maint/gen_sig_info.py +++ b/tools/maint/gen_sig_info.py @@ -228,18 +228,18 @@ def functype_to_str(t, t64): def write_sig_library(filename, sig_info): lines = [ - '/* Auto-generated by tools/maint/gen_sig_info.py. DO NOT EDIT. */', - '', - 'sigs = {', + '/* Auto-generated by tools/maint/gen_sig_info.py. DO NOT EDIT. */', + '', + 'sigs = {', ] for s, sig in sorted(sig_info.items()): lines.append(f" {s}__sig: '{sig}',") lines += [ - '}', - '', - '// We have to merge with `allowMissing` since this file contains signatures', - '// for functions that might not exist in all build configurations.', - 'addToLibrary(sigs, {allowMissing: true});', + '}', + '', + '// We have to merge with `allowMissing` since this file contains signatures', + '// for functions that might not exist in all build configurations.', + 'addToLibrary(sigs, {allowMissing: true});', ] utils.write_file(filename, '\n'.join(lines) + '\n') diff --git a/tools/ports/icu.py b/tools/ports/icu.py index 1da8bd4ec18d5..763dd7873ed75 100644 --- a/tools/ports/icu.py +++ b/tools/ports/icu.py @@ -32,23 +32,23 @@ def get(ports, settings, shared): def build_lib(lib_output, lib_src, other_includes, build_flags): additional_build_flags = [ - # TODO: investigate why this is needed and remove - '-Wno-macro-redefined', - '-Wno-deprecated-declarations', - '-Wno-array-compare', - '-Wno-unknown-warning-option', - '-Wno-unnecessary-virtual-specifier', - # usage of 'using namespace icu' is deprecated: icu v61 - '-DU_USING_ICU_NAMESPACE=0', - # make explicit inclusion of utf header: ref utf.h - '-DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1', - # mark UnicodeString constructors explicit : ref unistr.h - '-DUNISTR_FROM_CHAR_EXPLICIT=explicit', - '-DUNISTR_FROM_STRING_EXPLICIT=explicit', - # generate static - '-DU_STATIC_IMPLEMENTATION', - # CXXFLAGS - '-std=c++11', + # TODO: investigate why this is needed and remove + '-Wno-macro-redefined', + '-Wno-deprecated-declarations', + '-Wno-array-compare', + '-Wno-unknown-warning-option', + '-Wno-unnecessary-virtual-specifier', + # usage of 'using namespace icu' is deprecated: icu v61 + '-DU_USING_ICU_NAMESPACE=0', + # make explicit inclusion of utf header: ref utf.h + '-DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1', + # mark UnicodeString constructors explicit : ref unistr.h + '-DUNISTR_FROM_CHAR_EXPLICIT=explicit', + '-DUNISTR_FROM_STRING_EXPLICIT=explicit', + # generate static + '-DU_STATIC_IMPLEMENTATION', + # CXXFLAGS + '-std=c++11', ] if settings.PTHREADS: additional_build_flags.append('-pthread') @@ -83,10 +83,10 @@ def create_libicu_io(lib_output): build_lib(lib_output, lib_src, other_includes, ['-DU_IO_IMPLEMENTATION=1']) return [ - shared.cache.get_lib(get_lib_name(libname_libicu_common, settings), create_libicu_common), # this also prepares the build - shared.cache.get_lib(get_lib_name(libname_libicu_stubdata, settings), create_libicu_stubdata), - shared.cache.get_lib(get_lib_name(libname_libicu_i18n, settings), create_libicu_i18n), - shared.cache.get_lib(get_lib_name(libname_libicu_io, settings), create_libicu_io), + shared.cache.get_lib(get_lib_name(libname_libicu_common, settings), create_libicu_common), # this also prepares the build + shared.cache.get_lib(get_lib_name(libname_libicu_stubdata, settings), create_libicu_stubdata), + shared.cache.get_lib(get_lib_name(libname_libicu_i18n, settings), create_libicu_i18n), + shared.cache.get_lib(get_lib_name(libname_libicu_io, settings), create_libicu_io), ] diff --git a/tools/settings.py b/tools/settings.py index 2befd291a7853..699e65615d436 100644 --- a/tools/settings.py +++ b/tools/settings.py @@ -13,90 +13,90 @@ # Subset of settings that take a memory size (i.e. 1Gb, 64kb etc) MEM_SIZE_SETTINGS = { - 'GLOBAL_BASE', - 'STACK_SIZE', - 'TOTAL_STACK', - 'INITIAL_HEAP', - 'INITIAL_MEMORY', - 'MEMORY_GROWTH_LINEAR_STEP', - 'MEMORY_GROWTH_GEOMETRIC_CAP', - 'GL_MAX_TEMP_BUFFER_SIZE', - 'MAXIMUM_MEMORY', - 'DEFAULT_PTHREAD_STACK_SIZE', - 'ASYNCIFY_STACK_SIZE', + 'GLOBAL_BASE', + 'STACK_SIZE', + 'TOTAL_STACK', + 'INITIAL_HEAP', + 'INITIAL_MEMORY', + 'MEMORY_GROWTH_LINEAR_STEP', + 'MEMORY_GROWTH_GEOMETRIC_CAP', + 'GL_MAX_TEMP_BUFFER_SIZE', + 'MAXIMUM_MEMORY', + 'DEFAULT_PTHREAD_STACK_SIZE', + 'ASYNCIFY_STACK_SIZE', } PORTS_SETTINGS = { - # All port-related settings are valid at compile time - 'USE_SDL', - 'USE_LIBPNG', - 'USE_BULLET', - 'USE_ZLIB', - 'USE_BZIP2', - 'USE_VORBIS', - 'USE_COCOS2D', - 'USE_ICU', - 'USE_MODPLUG', - 'USE_SDL_MIXER', - 'USE_SDL_IMAGE', - 'USE_SDL_TTF', - 'USE_SDL_NET', - 'USE_SDL_GFX', - 'USE_LIBJPEG', - 'USE_OGG', - 'USE_REGAL', - 'USE_BOOST_HEADERS', - 'USE_HARFBUZZ', - 'USE_MPG123', - 'USE_GIFLIB', - 'USE_FREETYPE', - 'SDL2_MIXER_FORMATS', - 'SDL2_IMAGE_FORMATS', - 'USE_SQLITE3', + # All port-related settings are valid at compile time + 'USE_SDL', + 'USE_LIBPNG', + 'USE_BULLET', + 'USE_ZLIB', + 'USE_BZIP2', + 'USE_VORBIS', + 'USE_COCOS2D', + 'USE_ICU', + 'USE_MODPLUG', + 'USE_SDL_MIXER', + 'USE_SDL_IMAGE', + 'USE_SDL_TTF', + 'USE_SDL_NET', + 'USE_SDL_GFX', + 'USE_LIBJPEG', + 'USE_OGG', + 'USE_REGAL', + 'USE_BOOST_HEADERS', + 'USE_HARFBUZZ', + 'USE_MPG123', + 'USE_GIFLIB', + 'USE_FREETYPE', + 'SDL2_MIXER_FORMATS', + 'SDL2_IMAGE_FORMATS', + 'USE_SQLITE3', } # Subset of settings that apply only when generating JS JS_ONLY_SETTINGS = { - 'DEFAULT_LIBRARY_FUNCS_TO_INCLUDE', - 'INCLUDE_FULL_LIBRARY', - 'BUILD_AS_WORKER', - 'STRICT_JS', - 'SMALL_XHR_CHUNKS', - 'MODULARIZE', - 'EXPORT_ES6', - 'EXPORT_NAME', - 'DYNAMIC_EXECUTION', - 'PTHREAD_POOL_SIZE', - 'PTHREAD_POOL_SIZE_STRICT', - 'PTHREAD_POOL_DELAY_LOAD', - 'DEFAULT_PTHREAD_STACK_SIZE', + 'DEFAULT_LIBRARY_FUNCS_TO_INCLUDE', + 'INCLUDE_FULL_LIBRARY', + 'BUILD_AS_WORKER', + 'STRICT_JS', + 'SMALL_XHR_CHUNKS', + 'MODULARIZE', + 'EXPORT_ES6', + 'EXPORT_NAME', + 'DYNAMIC_EXECUTION', + 'PTHREAD_POOL_SIZE', + 'PTHREAD_POOL_SIZE_STRICT', + 'PTHREAD_POOL_DELAY_LOAD', + 'DEFAULT_PTHREAD_STACK_SIZE', } # Subset of settings that apply at compile time. # (Keep in sync with [compile] comments in settings.js) COMPILE_TIME_SETTINGS = { - 'MEMORY64', - 'INLINING_LIMIT', - 'DISABLE_EXCEPTION_CATCHING', - 'DISABLE_EXCEPTION_THROWING', - 'WASM_LEGACY_EXCEPTIONS', - 'MAIN_MODULE', - 'SIDE_MODULE', - 'LINKABLE', - 'STRICT', - 'EMSCRIPTEN_TRACING', - 'PTHREADS', - 'USE_PTHREADS', # legacy name of PTHREADS setting - 'SHARED_MEMORY', - 'SUPPORT_LONGJMP', - 'WASM_OBJECT_FILES', - 'WASM_WORKERS', - - # Internal settings used during compilation - 'EXCEPTION_CATCHING_ALLOWED', - 'WASM_EXCEPTIONS', - 'OPT_LEVEL', - 'DEBUG_LEVEL', + 'MEMORY64', + 'INLINING_LIMIT', + 'DISABLE_EXCEPTION_CATCHING', + 'DISABLE_EXCEPTION_THROWING', + 'WASM_LEGACY_EXCEPTIONS', + 'MAIN_MODULE', + 'SIDE_MODULE', + 'LINKABLE', + 'STRICT', + 'EMSCRIPTEN_TRACING', + 'PTHREADS', + 'USE_PTHREADS', # legacy name of PTHREADS setting + 'SHARED_MEMORY', + 'SUPPORT_LONGJMP', + 'WASM_OBJECT_FILES', + 'WASM_WORKERS', + + # Internal settings used during compilation + 'EXCEPTION_CATCHING_ALLOWED', + 'WASM_EXCEPTIONS', + 'OPT_LEVEL', + 'DEBUG_LEVEL', }.union(PORTS_SETTINGS) # Unlike `LEGACY_SETTINGS`, deprecated settings can still be used @@ -107,66 +107,66 @@ # # All settings here should be tagged as `[deprecated]` in settings.js DEPRECATED_SETTINGS = { - 'RUNTIME_LINKED_LIBS': 'you can simply list the libraries directly on the commandline now', - 'CLOSURE_WARNINGS': 'use -Wclosure/-Wno-closure instead', - 'WASM_BIGINT': 'no longer needed. Should only ever be implicitly disabled by -sWASM=0', - 'ASYNCIFY_EXPORTS': 'please use JSPI_EXPORTS instead', - 'LINKABLE': 'under consideration for removal (https://github.com/emscripten-core/emscripten/issues/25262)', - 'EXPORT_EXCEPTION_HANDLING_HELPERS': 'getExceptionMessage is exported anyway when ASSERTIONS or EXCEPTION_STACK_TRACES is set, which are set by default at -O0. At -O1 or above, you can export it separately by -sEXPORTED_RUNTIME_METHODS=getExceptionMessage,decrementExceptionRefcount.', - 'DETERMINISTIC': 'under consideration for removal (https://github.com/emscripten-core/emscripten/issues/26647)', - 'USE_PTHREADS': 'prefer the standard -pthread flag', - 'MEMORY64': 'prefer the standard -m64 or --target=wasm64 flags', - 'SOCKET_WEBRTC': 'under consideration for removal (https://github.com/emscripten-core/emscripten/issues/27366)', - 'WASM=0': 'under consideration for removal (https://github.com/emscripten-core/emscripten/issues/27608)', - 'WASM=2': 'under consideration for removal (https://github.com/emscripten-core/emscripten/issues/27608)', + 'RUNTIME_LINKED_LIBS': 'you can simply list the libraries directly on the commandline now', + 'CLOSURE_WARNINGS': 'use -Wclosure/-Wno-closure instead', + 'WASM_BIGINT': 'no longer needed. Should only ever be implicitly disabled by -sWASM=0', + 'ASYNCIFY_EXPORTS': 'please use JSPI_EXPORTS instead', + 'LINKABLE': 'under consideration for removal (https://github.com/emscripten-core/emscripten/issues/25262)', + 'EXPORT_EXCEPTION_HANDLING_HELPERS': 'getExceptionMessage is exported anyway when ASSERTIONS or EXCEPTION_STACK_TRACES is set, which are set by default at -O0. At -O1 or above, you can export it separately by -sEXPORTED_RUNTIME_METHODS=getExceptionMessage,decrementExceptionRefcount.', + 'DETERMINISTIC': 'under consideration for removal (https://github.com/emscripten-core/emscripten/issues/26647)', + 'USE_PTHREADS': 'prefer the standard -pthread flag', + 'MEMORY64': 'prefer the standard -m64 or --target=wasm64 flags', + 'SOCKET_WEBRTC': 'under consideration for removal (https://github.com/emscripten-core/emscripten/issues/27366)', + 'WASM=0': 'under consideration for removal (https://github.com/emscripten-core/emscripten/issues/27608)', + 'WASM=2': 'under consideration for removal (https://github.com/emscripten-core/emscripten/issues/27608)', } # Settings that don't need to be externalized when serializing to json because they # are not used by the JS compiler. INTERNAL_SETTINGS = { - 'SIDE_MODULE_IMPORTS', + 'SIDE_MODULE_IMPORTS', } # List of incompatible settings, of the form (SETTINGS_A, SETTING_B, OPTIONAL_REASON_FOR_INCOMPAT) INCOMPATIBLE_SETTINGS = [ - ('MINIMAL_RUNTIME', 'MAIN_MODULE', None), - ('WASM_WORKERS', 'MAIN_MODULE', 'dynamic linking is not supported with -sWASM_WORKERS'), - ('WASM2JS', 'MAIN_MODULE', 'wasm2js does not support dynamic linking'), - ('WASM2JS', 'SIDE_MODULE', 'wasm2js does not support dynamic linking'), - ('WASM2JS', 'GROWABLE_ARRAYBUFFERS', None), - ('MAIN_MODULE', 'NO_WASM_ASYNC_COMPILATION', 'dynamic linking requires async wasm compilation'), - ('MODULARIZE', 'NO_DECLARE_ASM_MODULE_EXPORTS', None), - ('EVAL_CTORS', 'WASM2JS', None), - # In Asyncify exports can be called more than once, and this seems to not - # work properly yet (see test_emscripten_scan_registers). - ('EVAL_CTORS', 'ASYNCIFY', None), - ('PTHREADS_PROFILING', 'NO_ASSERTIONS', 'only works with ASSERTIONS enabled'), - ('SOURCE_PHASE_IMPORTS', 'NO_EXPORT_ES6', None), - ('STANDALONE_WASM', 'MINIMAL_RUNTIME', None), - ('STRICT_JS', 'EXPORT_ES6', None), - ('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION', 'MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION', 'they are mutually exclusive'), - ('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION', 'SINGLE_FILE', None), - ('MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION', 'SINGLE_FILE', None), - ('SEPARATE_DWARF', 'WASM2JS', 'as there is no wasm file'), - ('GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS', 'NO_GL_SUPPORT_SIMPLE_ENABLE_EXTENSIONS', None), - ('LEGACY_VM_SUPPORT', 'MEMORY64', None), - ('CROSS_ORIGIN', 'NO_DYNAMIC_EXECUTION', None), - ('CROSS_ORIGIN', 'NO_PTHREADS', None), - ('CROSS_ORIGIN_STORAGE', 'SINGLE_FILE', 'the .wasm binary is inlined directly into the JS output and has no fetchable URL to key the hash on'), - ('CROSS_ORIGIN_STORAGE', 'NO_WASM_ASYNC_COMPILATION', 'synchronous instantiation does not use the COS fetch path'), - ('CROSS_ORIGIN_STORAGE', 'SIDE_MODULE', 'no JS glue is emitted to carry the hash or perform the COS lookup'), - ('NODERAWSOCKETS', 'WASMFS', 'the node:net backend is not wired into WASMFS sockets'), - ('NODERAWSOCKETS', 'PROXY_POSIX_SOCKETS', 'they are alternative socket backends'), + ('MINIMAL_RUNTIME', 'MAIN_MODULE', None), + ('WASM_WORKERS', 'MAIN_MODULE', 'dynamic linking is not supported with -sWASM_WORKERS'), + ('WASM2JS', 'MAIN_MODULE', 'wasm2js does not support dynamic linking'), + ('WASM2JS', 'SIDE_MODULE', 'wasm2js does not support dynamic linking'), + ('WASM2JS', 'GROWABLE_ARRAYBUFFERS', None), + ('MAIN_MODULE', 'NO_WASM_ASYNC_COMPILATION', 'dynamic linking requires async wasm compilation'), + ('MODULARIZE', 'NO_DECLARE_ASM_MODULE_EXPORTS', None), + ('EVAL_CTORS', 'WASM2JS', None), + # In Asyncify exports can be called more than once, and this seems to not + # work properly yet (see test_emscripten_scan_registers). + ('EVAL_CTORS', 'ASYNCIFY', None), + ('PTHREADS_PROFILING', 'NO_ASSERTIONS', 'only works with ASSERTIONS enabled'), + ('SOURCE_PHASE_IMPORTS', 'NO_EXPORT_ES6', None), + ('STANDALONE_WASM', 'MINIMAL_RUNTIME', None), + ('STRICT_JS', 'EXPORT_ES6', None), + ('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION', 'MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION', 'they are mutually exclusive'), + ('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION', 'SINGLE_FILE', None), + ('MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION', 'SINGLE_FILE', None), + ('SEPARATE_DWARF', 'WASM2JS', 'as there is no wasm file'), + ('GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS', 'NO_GL_SUPPORT_SIMPLE_ENABLE_EXTENSIONS', None), + ('LEGACY_VM_SUPPORT', 'MEMORY64', None), + ('CROSS_ORIGIN', 'NO_DYNAMIC_EXECUTION', None), + ('CROSS_ORIGIN', 'NO_PTHREADS', None), + ('CROSS_ORIGIN_STORAGE', 'SINGLE_FILE', 'the .wasm binary is inlined directly into the JS output and has no fetchable URL to key the hash on'), + ('CROSS_ORIGIN_STORAGE', 'NO_WASM_ASYNC_COMPILATION', 'synchronous instantiation does not use the COS fetch path'), + ('CROSS_ORIGIN_STORAGE', 'SIDE_MODULE', 'no JS glue is emitted to carry the hash or perform the COS lookup'), + ('NODERAWSOCKETS', 'WASMFS', 'the node:net backend is not wired into WASMFS sockets'), + ('NODERAWSOCKETS', 'PROXY_POSIX_SOCKETS', 'they are alternative socket backends'), ] EXPERIMENTAL_SETTINGS = { - 'SPLIT_MODULE': '-sSPLIT_MODULE is experimental and subject to change', - 'SOURCE_PHASE_IMPORTS': '-sSOURCE_PHASE_IMPORTS is experimental and not yet supported in browsers', - 'JS_BASE64_API': '-sJS_BASE64_API is experimental and not yet supported in browsers', - 'CROSS_ORIGIN_STORAGE': '-sCROSS_ORIGIN_STORAGE is experimental; the underlying browser API is not yet shipped in any browser', - 'SUPPORT_BIG_ENDIAN': '-sSUPPORT_BIG_ENDIAN is experimental, not all features are fully supported.', - 'WASM_ESM_INTEGRATION': '-sWASM_ESM_INTEGRATION is still experimental and not yet supported in browsers', - 'WASM_BINDGEN': '-sWASM_BINDGEN is experimental and subject to change', + 'SPLIT_MODULE': '-sSPLIT_MODULE is experimental and subject to change', + 'SOURCE_PHASE_IMPORTS': '-sSOURCE_PHASE_IMPORTS is experimental and not yet supported in browsers', + 'JS_BASE64_API': '-sJS_BASE64_API is experimental and not yet supported in browsers', + 'CROSS_ORIGIN_STORAGE': '-sCROSS_ORIGIN_STORAGE is experimental; the underlying browser API is not yet shipped in any browser', + 'SUPPORT_BIG_ENDIAN': '-sSUPPORT_BIG_ENDIAN is experimental, not all features are fully supported.', + 'WASM_ESM_INTEGRATION': '-sWASM_ESM_INTEGRATION is still experimental and not yet supported in browsers', + 'WASM_BINDGEN': '-sWASM_BINDGEN is experimental and subject to change', } # For renamed settings the format is: @@ -182,91 +182,91 @@ # we can set POSSIBLE_VALUES to an impossible value (like "disallowed" for a # numeric setting, or -1 for a string setting). LEGACY_SETTINGS = [ - ['BINARYEN', 'WASM'], - ['TOTAL_STACK', 'STACK_SIZE'], - ['BINARYEN_ASYNC_COMPILATION', 'WASM_ASYNC_COMPILATION'], - ['UNALIGNED_MEMORY', [0], 'forced unaligned memory not supported in fastcomp'], - ['FORCE_ALIGNED_MEMORY', [0], 'forced aligned memory is not supported in fastcomp'], - ['PGO', [0], 'pgo no longer supported'], - ['QUANTUM_SIZE', [4], 'altering the QUANTUM_SIZE is not supported'], - ['FUNCTION_POINTER_ALIGNMENT', [2], 'Starting from Emscripten 1.37.29, no longer available (https://github.com/emscripten-core/emscripten/pull/6091)'], - # Reserving function pointers is not needed - allowing table growth allows any number of new functions to be added. - ['RESERVED_FUNCTION_POINTERS', 'ALLOW_TABLE_GROWTH'], - ['BUILD_AS_SHARED_LIB', [0], 'Starting from Emscripten 1.38.16, no longer available (https://github.com/emscripten-core/emscripten/pull/7433)'], - ['SAFE_SPLIT_MEMORY', [0], 'Starting from Emscripten 1.38.19, SAFE_SPLIT_MEMORY codegen is no longer available (https://github.com/emscripten-core/emscripten/pull/7465)'], - ['SPLIT_MEMORY', [0], 'Starting from Emscripten 1.38.19, SPLIT_MEMORY codegen is no longer available (https://github.com/emscripten-core/emscripten/pull/7465)'], - ['BINARYEN_METHOD', ['native-wasm'], 'Starting from Emscripten 1.38.23, Emscripten now always builds either to Wasm (-sWASM - default), or to JavaScript (-sWASM=0), other methods are not supported (https://github.com/emscripten-core/emscripten/pull/7836)'], - ['BINARYEN_TRAP_MODE', [-1], 'The wasm backend does not support a trap mode (it always clamps, in effect)'], - ['PRECISE_I64_MATH', [1, 2], 'Starting from Emscripten 1.38.26, PRECISE_I64_MATH is always enabled (https://github.com/emscripten-core/emscripten/pull/7935)'], - ['MEMFS_APPEND_TO_TYPED_ARRAYS', [1], 'Starting from Emscripten 1.38.26, MEMFS_APPEND_TO_TYPED_ARRAYS=0 is no longer supported. MEMFS no longer supports using JS arrays for file data (https://github.com/emscripten-core/emscripten/pull/7918)'], - ['ERROR_ON_MISSING_LIBRARIES', [1], 'missing libraries are always an error now'], - ['EMITTING_JS', [1], 'The new STANDALONE_WASM flag replaces this (replace EMITTING_JS=0 with STANDALONE_WASM=1)'], - ['SKIP_STACK_IN_SMALL', [0, 1], 'SKIP_STACK_IN_SMALL is no longer needed as the backend can optimize it directly'], - ['SAFE_STACK', [0], 'Replace SAFE_STACK=1 with STACK_OVERFLOW_CHECK=2'], - ['MEMORY_GROWTH_STEP', 'MEMORY_GROWTH_LINEAR_STEP'], - ['ELIMINATE_DUPLICATE_FUNCTIONS', [0, 1], 'Duplicate function elimination for wasm is handled automatically by binaryen'], - ['ELIMINATE_DUPLICATE_FUNCTIONS_DUMP_EQUIVALENT_FUNCTIONS', [0], 'Duplicate function elimination for wasm is handled automatically by binaryen'], - ['ELIMINATE_DUPLICATE_FUNCTIONS_PASSES', [5], 'Duplicate function elimination for wasm is handled automatically by binaryen'], - ['WASM_OBJECT_FILES', [1], 'For LTO, use -flto or -fto=thin instead. Otherwise, Wasm object files are the default'], - ['TOTAL_MEMORY', 'INITIAL_MEMORY'], - ['WASM_MEM_MAX', 'MAXIMUM_MEMORY'], - ['BINARYEN_MEM_MAX', 'MAXIMUM_MEMORY'], - ['BINARYEN_PASSES', [''], 'Use BINARYEN_EXTRA_PASSES to add additional passes'], - ['SWAPPABLE_ASM_MODULE', [0], 'Fully swappable asm modules are no longer supported'], - ['ASM_JS', [1], 'asm.js output is not supported anymore'], - ['FINALIZE_ASM_JS', [0, 1], 'asm.js output is not supported anymore'], - ['ASYNCIFY_WHITELIST', 'ASYNCIFY_ONLY'], - ['ASYNCIFY_BLACKLIST', 'ASYNCIFY_REMOVE'], - ['EXCEPTION_CATCHING_WHITELIST', 'EXCEPTION_CATCHING_ALLOWED'], - ['SEPARATE_ASM', [0], 'Separate asm.js only made sense for fastcomp with asm.js output'], - ['SEPARATE_ASM_MODULE_NAME', [''], 'Separate asm.js only made sense for fastcomp with asm.js output'], - ['FAST_UNROLLED_MEMCPY_AND_MEMSET', [0, 1], 'The wasm backend implements memcpy/memset in C'], - ['DOUBLE_MODE', [0, 1], 'The wasm backend always implements doubles normally'], - ['PRECISE_F32', [0, 1, 2], 'The wasm backend always implements floats normally'], - ['ALIASING_FUNCTION_POINTERS', [0, 1], 'The wasm backend always uses a single index space for function pointers, in a single Table'], - ['AGGRESSIVE_VARIABLE_ELIMINATION', [0, 1], 'Wasm ignores asm.js-specific optimization flags'], - ['SIMPLIFY_IFS', [1], 'Wasm ignores asm.js-specific optimization flags'], - ['DEAD_FUNCTIONS', [[]], 'The wasm backend does not support dead function removal'], - ['WASM_BACKEND', [-1], 'Only the wasm backend is now supported (note that setting it as -s has never been allowed anyhow)'], - ['EXPORT_BINDINGS', [0, 1], 'No longer needed'], - ['RUNNING_JS_OPTS', [0], 'Fastcomp cared about running JS which could alter asm.js validation, but not upstream'], - ['EXPORT_FUNCTION_TABLES', [0], 'No longer needed'], - ['BINARYEN_SCRIPTS', [''], 'No longer needed'], - ['WARN_UNALIGNED', [0, 1], 'No longer needed'], - ['ASM_PRIMITIVE_VARS', [[]], 'No longer needed'], - ['WORKAROUND_IOS_9_RIGHT_SHIFT_BUG', [0], 'Wasm2JS does not support iPhone 4s, iPad 2, iPad 3, iPad Mini 1, Pod Touch 5 (devices with end-of-life at iOS 9.3.5) and older'], - ['RUNTIME_FUNCS_TO_IMPORT', [[]], 'No longer needed'], - ['LIBRARY_DEPS_TO_AUTOEXPORT', [[]], 'No longer needed'], - ['EMIT_EMSCRIPTEN_METADATA', [0], 'No longer supported'], - ['SHELL_FILE', [''], 'No longer supported'], - ['LLD_REPORT_UNDEFINED', [1], 'Disabling is no longer supported'], - ['MEM_INIT_METHOD', [0], 'No longer supported'], - ['USE_PTHREADS', [0, 1], 'No longer needed. Use -pthread instead'], - ['USES_DYNAMIC_ALLOC', [1], 'No longer supported. Use -sMALLOC=none'], - ['REVERSE_DEPS', ['auto', 'all', 'none'], 'No longer needed'], - ['RUNTIME_LOGGING', 'RUNTIME_DEBUG'], - ['MIN_EDGE_VERSION', [0x7FFFFFFF], 'No longer supported'], - ['MIN_IE_VERSION', [0x7FFFFFFF], 'No longer supported'], - ['WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG', [0], 'No longer supported'], - ['AUTO_ARCHIVE_INDEXES', [0, 1], 'No longer needed'], - ['USE_ES6_IMPORT_META', [1], 'Disabling is no longer supported'], - ['EXTRA_EXPORTED_RUNTIME_METHODS', [[]], 'No longer supported, use EXPORTED_RUNTIME_METHODS'], - ['SUPPORT_ERRNO', [0], 'No longer supported'], - ['DEMANGLE_SUPPORT', [0], 'No longer supported'], - ['MAYBE_WASM2JS', [0], 'No longer supported (use -sWASM=2)'], - ['HEADLESS', [0], 'No longer supported, use headless browsers or Node.js with JSDOM'], - ['USE_OFFSET_COVERTER', [0], 'No longer supported, not needed with modern v8 versions'], - ['ASYNCIFY_LAZY_LOAD_CODE', [0], 'No longer supported'], - ['USE_WEBGPU', [0], 'No longer supported; replaced by --use-port=emdawnwebgpu, which implements a newer (but incompatible) version of webgpu.h - see tools/ports/emdawnwebgpu.py'], - ['PROXY_TO_WORKER', [0], 'No longer supported'], - ['NODEJS_CATCH_EXIT', [0], 'No longer supported'], - ['NODEJS_CATCH_REJECTION', [0], 'No longer supported'], - ['POLYFILL_OLD_MATH_FUNCTIONS', [0], 'No longer supported'], - ['RELOCATABLE', [0], 'No longer supported'], - ['WASM_JS_TYPES', [0], 'No longer supported'], - ['DETERMINISTIC', [0], 'No longer supported'], - ['LEGALIZE_JS_FFI', [0], 'legacy JS FFI legalization is no longer supported'], - ['SOCKET_WEBRTC', [0], 'No longer supported'], + ['BINARYEN', 'WASM'], + ['TOTAL_STACK', 'STACK_SIZE'], + ['BINARYEN_ASYNC_COMPILATION', 'WASM_ASYNC_COMPILATION'], + ['UNALIGNED_MEMORY', [0], 'forced unaligned memory not supported in fastcomp'], + ['FORCE_ALIGNED_MEMORY', [0], 'forced aligned memory is not supported in fastcomp'], + ['PGO', [0], 'pgo no longer supported'], + ['QUANTUM_SIZE', [4], 'altering the QUANTUM_SIZE is not supported'], + ['FUNCTION_POINTER_ALIGNMENT', [2], 'Starting from Emscripten 1.37.29, no longer available (https://github.com/emscripten-core/emscripten/pull/6091)'], + # Reserving function pointers is not needed - allowing table growth allows any number of new functions to be added. + ['RESERVED_FUNCTION_POINTERS', 'ALLOW_TABLE_GROWTH'], + ['BUILD_AS_SHARED_LIB', [0], 'Starting from Emscripten 1.38.16, no longer available (https://github.com/emscripten-core/emscripten/pull/7433)'], + ['SAFE_SPLIT_MEMORY', [0], 'Starting from Emscripten 1.38.19, SAFE_SPLIT_MEMORY codegen is no longer available (https://github.com/emscripten-core/emscripten/pull/7465)'], + ['SPLIT_MEMORY', [0], 'Starting from Emscripten 1.38.19, SPLIT_MEMORY codegen is no longer available (https://github.com/emscripten-core/emscripten/pull/7465)'], + ['BINARYEN_METHOD', ['native-wasm'], 'Starting from Emscripten 1.38.23, Emscripten now always builds either to Wasm (-sWASM - default), or to JavaScript (-sWASM=0), other methods are not supported (https://github.com/emscripten-core/emscripten/pull/7836)'], + ['BINARYEN_TRAP_MODE', [-1], 'The wasm backend does not support a trap mode (it always clamps, in effect)'], + ['PRECISE_I64_MATH', [1, 2], 'Starting from Emscripten 1.38.26, PRECISE_I64_MATH is always enabled (https://github.com/emscripten-core/emscripten/pull/7935)'], + ['MEMFS_APPEND_TO_TYPED_ARRAYS', [1], 'Starting from Emscripten 1.38.26, MEMFS_APPEND_TO_TYPED_ARRAYS=0 is no longer supported. MEMFS no longer supports using JS arrays for file data (https://github.com/emscripten-core/emscripten/pull/7918)'], + ['ERROR_ON_MISSING_LIBRARIES', [1], 'missing libraries are always an error now'], + ['EMITTING_JS', [1], 'The new STANDALONE_WASM flag replaces this (replace EMITTING_JS=0 with STANDALONE_WASM=1)'], + ['SKIP_STACK_IN_SMALL', [0, 1], 'SKIP_STACK_IN_SMALL is no longer needed as the backend can optimize it directly'], + ['SAFE_STACK', [0], 'Replace SAFE_STACK=1 with STACK_OVERFLOW_CHECK=2'], + ['MEMORY_GROWTH_STEP', 'MEMORY_GROWTH_LINEAR_STEP'], + ['ELIMINATE_DUPLICATE_FUNCTIONS', [0, 1], 'Duplicate function elimination for wasm is handled automatically by binaryen'], + ['ELIMINATE_DUPLICATE_FUNCTIONS_DUMP_EQUIVALENT_FUNCTIONS', [0], 'Duplicate function elimination for wasm is handled automatically by binaryen'], + ['ELIMINATE_DUPLICATE_FUNCTIONS_PASSES', [5], 'Duplicate function elimination for wasm is handled automatically by binaryen'], + ['WASM_OBJECT_FILES', [1], 'For LTO, use -flto or -fto=thin instead. Otherwise, Wasm object files are the default'], + ['TOTAL_MEMORY', 'INITIAL_MEMORY'], + ['WASM_MEM_MAX', 'MAXIMUM_MEMORY'], + ['BINARYEN_MEM_MAX', 'MAXIMUM_MEMORY'], + ['BINARYEN_PASSES', [''], 'Use BINARYEN_EXTRA_PASSES to add additional passes'], + ['SWAPPABLE_ASM_MODULE', [0], 'Fully swappable asm modules are no longer supported'], + ['ASM_JS', [1], 'asm.js output is not supported anymore'], + ['FINALIZE_ASM_JS', [0, 1], 'asm.js output is not supported anymore'], + ['ASYNCIFY_WHITELIST', 'ASYNCIFY_ONLY'], + ['ASYNCIFY_BLACKLIST', 'ASYNCIFY_REMOVE'], + ['EXCEPTION_CATCHING_WHITELIST', 'EXCEPTION_CATCHING_ALLOWED'], + ['SEPARATE_ASM', [0], 'Separate asm.js only made sense for fastcomp with asm.js output'], + ['SEPARATE_ASM_MODULE_NAME', [''], 'Separate asm.js only made sense for fastcomp with asm.js output'], + ['FAST_UNROLLED_MEMCPY_AND_MEMSET', [0, 1], 'The wasm backend implements memcpy/memset in C'], + ['DOUBLE_MODE', [0, 1], 'The wasm backend always implements doubles normally'], + ['PRECISE_F32', [0, 1, 2], 'The wasm backend always implements floats normally'], + ['ALIASING_FUNCTION_POINTERS', [0, 1], 'The wasm backend always uses a single index space for function pointers, in a single Table'], + ['AGGRESSIVE_VARIABLE_ELIMINATION', [0, 1], 'Wasm ignores asm.js-specific optimization flags'], + ['SIMPLIFY_IFS', [1], 'Wasm ignores asm.js-specific optimization flags'], + ['DEAD_FUNCTIONS', [[]], 'The wasm backend does not support dead function removal'], + ['WASM_BACKEND', [-1], 'Only the wasm backend is now supported (note that setting it as -s has never been allowed anyhow)'], + ['EXPORT_BINDINGS', [0, 1], 'No longer needed'], + ['RUNNING_JS_OPTS', [0], 'Fastcomp cared about running JS which could alter asm.js validation, but not upstream'], + ['EXPORT_FUNCTION_TABLES', [0], 'No longer needed'], + ['BINARYEN_SCRIPTS', [''], 'No longer needed'], + ['WARN_UNALIGNED', [0, 1], 'No longer needed'], + ['ASM_PRIMITIVE_VARS', [[]], 'No longer needed'], + ['WORKAROUND_IOS_9_RIGHT_SHIFT_BUG', [0], 'Wasm2JS does not support iPhone 4s, iPad 2, iPad 3, iPad Mini 1, Pod Touch 5 (devices with end-of-life at iOS 9.3.5) and older'], + ['RUNTIME_FUNCS_TO_IMPORT', [[]], 'No longer needed'], + ['LIBRARY_DEPS_TO_AUTOEXPORT', [[]], 'No longer needed'], + ['EMIT_EMSCRIPTEN_METADATA', [0], 'No longer supported'], + ['SHELL_FILE', [''], 'No longer supported'], + ['LLD_REPORT_UNDEFINED', [1], 'Disabling is no longer supported'], + ['MEM_INIT_METHOD', [0], 'No longer supported'], + ['USE_PTHREADS', [0, 1], 'No longer needed. Use -pthread instead'], + ['USES_DYNAMIC_ALLOC', [1], 'No longer supported. Use -sMALLOC=none'], + ['REVERSE_DEPS', ['auto', 'all', 'none'], 'No longer needed'], + ['RUNTIME_LOGGING', 'RUNTIME_DEBUG'], + ['MIN_EDGE_VERSION', [0x7FFFFFFF], 'No longer supported'], + ['MIN_IE_VERSION', [0x7FFFFFFF], 'No longer supported'], + ['WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG', [0], 'No longer supported'], + ['AUTO_ARCHIVE_INDEXES', [0, 1], 'No longer needed'], + ['USE_ES6_IMPORT_META', [1], 'Disabling is no longer supported'], + ['EXTRA_EXPORTED_RUNTIME_METHODS', [[]], 'No longer supported, use EXPORTED_RUNTIME_METHODS'], + ['SUPPORT_ERRNO', [0], 'No longer supported'], + ['DEMANGLE_SUPPORT', [0], 'No longer supported'], + ['MAYBE_WASM2JS', [0], 'No longer supported (use -sWASM=2)'], + ['HEADLESS', [0], 'No longer supported, use headless browsers or Node.js with JSDOM'], + ['USE_OFFSET_COVERTER', [0], 'No longer supported, not needed with modern v8 versions'], + ['ASYNCIFY_LAZY_LOAD_CODE', [0], 'No longer supported'], + ['USE_WEBGPU', [0], 'No longer supported; replaced by --use-port=emdawnwebgpu, which implements a newer (but incompatible) version of webgpu.h - see tools/ports/emdawnwebgpu.py'], + ['PROXY_TO_WORKER', [0], 'No longer supported'], + ['NODEJS_CATCH_EXIT', [0], 'No longer supported'], + ['NODEJS_CATCH_REJECTION', [0], 'No longer supported'], + ['POLYFILL_OLD_MATH_FUNCTIONS', [0], 'No longer supported'], + ['RELOCATABLE', [0], 'No longer supported'], + ['WASM_JS_TYPES', [0], 'No longer supported'], + ['DETERMINISTIC', [0], 'No longer supported'], + ['LEGALIZE_JS_FFI', [0], 'legacy JS FFI legalization is no longer supported'], + ['SOCKET_WEBRTC', [0], 'No longer supported'], ] user_settings: dict[str, str] = {} diff --git a/tools/system_libs.py b/tools/system_libs.py index bbdf3944b8983..aa6dbd857fcc7 100644 --- a/tools/system_libs.py +++ b/tools/system_libs.py @@ -951,13 +951,13 @@ class libclang_rt_builtins(MTLibrary, SjLjLibrary): force_object_files = True cflags = [ - '-fno-builtin', - '-DNDEBUG', - '-DCOMPILER_RT_HAS_ATOMICS=1', - # TODO: Remove this if the emutls_key_created variable in emutls.c is - # fixed or if the scope of the warning is modified again (see - # https://github.com/llvm/llvm-project/pull/178342) - '-Wno-unused-but-set-variable', + '-fno-builtin', + '-DNDEBUG', + '-DCOMPILER_RT_HAS_ATOMICS=1', + # TODO: Remove this if the emutls_key_created variable in emutls.c is + # fixed or if the scope of the warning is modified again (see + # https://github.com/llvm/llvm-project/pull/178342) + '-Wno-unused-but-set-variable', ] src_dir = 'system/lib/compiler-rt/lib/builtins' profile_src_dir = 'system/lib/compiler-rt/lib/profile' @@ -1019,28 +1019,28 @@ class llvmlibc(DebugLibrary, AsanInstrumentedLibrary, MTLibrary): never_force = True includes = ['system/lib/llvm-libc'] cflags = [ - '-Os', - '-DLIBC_NAMESPACE=__llvm_libc', - '-DLLVM_LIBC', - '-DLIBC_COPT_PUBLIC_PACKAGING', - # Disable accurate pass to speed up certain math operations - '-DLIBC_MATH=LIBC_MATH_FAST', - '-D__LIBC_USE_BUILTIN_CEIL_FLOOR_RINT_TRUNC', - # Reduce size bloats from string conversions. - '-DLIBC_COPT_STRTOFLOAT_DISABLE_EISEL_LEMIRE', - # To Enable FMA, we need to set the following flags. But we can't really ship this in a default libc build. - # Once llvm-libc gets used, we might need to have a FMA-enalbed flavor to enable these following flags. - '-Wno-unused-variable', - '-mrelaxed-simd', - '-ffp-contract=fast', + '-Os', + '-DLIBC_NAMESPACE=__llvm_libc', + '-DLLVM_LIBC', + '-DLIBC_COPT_PUBLIC_PACKAGING', + # Disable accurate pass to speed up certain math operations + '-DLIBC_MATH=LIBC_MATH_FAST', + '-D__LIBC_USE_BUILTIN_CEIL_FLOOR_RINT_TRUNC', + # Reduce size bloats from string conversions. + '-DLIBC_COPT_STRTOFLOAT_DISABLE_EISEL_LEMIRE', + # To Enable FMA, we need to set the following flags. But we can't really ship this in a default libc build. + # Once llvm-libc gets used, we might need to have a FMA-enalbed flavor to enable these following flags. + '-Wno-unused-variable', + '-mrelaxed-simd', + '-ffp-contract=fast', ] def get_files(self): # Overlay mode doesn't support mbstate_t which is used by these sources. mbstate_t_excludes = { - 'wcrtomb.cpp', 'mbrtowc.cpp', 'mbrlen.cpp', 'mbsinit.cpp', - 'mbsnrtowcs.cpp', 'mbsrtowcs.cpp', 'wcsnrtombs.cpp', 'wcsrtombs.cpp', - 'mblen.cpp', 'mbtowc.cpp', 'wctomb.cpp', 'mbstowcs.cpp', 'wcstombs.cpp', + 'wcrtomb.cpp', 'mbrtowc.cpp', 'mbrlen.cpp', 'mbsinit.cpp', + 'mbsnrtowcs.cpp', 'mbsrtowcs.cpp', 'wcsnrtombs.cpp', 'wcsrtombs.cpp', + 'mblen.cpp', 'mbtowc.cpp', 'wctomb.cpp', 'mbstowcs.cpp', 'wcstombs.cpp', } files = glob_in_path('system/lib/llvm-libc/src/assert', '*.cpp') @@ -1173,27 +1173,27 @@ def get_files(self): # musl modules ignore = [ - 'ipc', 'passwd', 'signal', 'sched', 'time', 'linux', - 'aio', 'legacy', 'mq', 'setjmp', - 'ldso', 'malloc', + 'ipc', 'passwd', 'signal', 'sched', 'time', 'linux', + 'aio', 'legacy', 'mq', 'setjmp', + 'ldso', 'malloc', ] # individual files ignore += [ - 'memcpy.c', 'memset.c', 'memmove.c', 'getaddrinfo.c', 'getnameinfo.c', - 'res_query.c', 'res_querydomain.c', - 'proto.c', - 'syscall.c', 'popen.c', 'pclose.c', - 'getgrouplist.c', 'initgroups.c', 'wordexp.c', 'timer_create.c', - 'getauxval.c', - 'lookup_name.c', - # 'process' exclusions - 'fork.c', 'vfork.c', 'posix_spawn.c', 'posix_spawnp.c', 'execve.c', 'waitid.c', 'system.c', - '_Fork.c', - # 'env' exclusions - '__reset_tls.c', '__init_tls.c', '__libc_start_main.c', - # 'exit' exclusions - 'assert.c', 'exit.c', + 'memcpy.c', 'memset.c', 'memmove.c', 'getaddrinfo.c', 'getnameinfo.c', + 'res_query.c', 'res_querydomain.c', + 'proto.c', + 'syscall.c', 'popen.c', 'pclose.c', + 'getgrouplist.c', 'initgroups.c', 'wordexp.c', 'timer_create.c', + 'getauxval.c', + 'lookup_name.c', + # 'process' exclusions + 'fork.c', 'vfork.c', 'posix_spawn.c', 'posix_spawnp.c', 'execve.c', 'waitid.c', 'system.c', + '_Fork.c', + # 'env' exclusions + '__reset_tls.c', '__init_tls.c', '__libc_start_main.c', + # 'exit' exclusions + 'assert.c', 'exit.c', ] ignore += LIBC_SOCKETS @@ -1628,14 +1628,14 @@ def can_use(self): class libcxxabi(ExceptionLibrary, MTLibrary, DebugLibrary): name = 'libc++abi' cflags = [ - '-Oz', - '-D_LIBCXXABI_USE_FUTEX', - '-D_LIBCPP_BUILDING_LIBRARY', - '-D_LIBCXXABI_BUILDING_LIBRARY', - '-DLIBCXXABI_NON_DEMANGLING_TERMINATE', - '-std=c++23', - '-Wno-unused-but-set-variable', - ] + '-Oz', + '-D_LIBCXXABI_USE_FUTEX', + '-D_LIBCPP_BUILDING_LIBRARY', + '-D_LIBCXXABI_BUILDING_LIBRARY', + '-DLIBCXXABI_NON_DEMANGLING_TERMINATE', + '-std=c++23', + '-Wno-unused-but-set-variable', + ] includes = ['system/lib/libcxx/src', 'system/lib/libunwind/include'] def __init__(self, **kwargs): @@ -1734,7 +1734,7 @@ class libcxx(ExceptionLibrary, MTLibrary, DebugLibrary): 'time_zone.cpp', 'tzdb.cpp', 'tzdb_list.cpp', - } + } class libunwind(ExceptionLibrary, MTLibrary):