Skip to content

Commit 245a15d

Browse files
authored
Move INCOMPATIBLE_SETTINGS to settings.py. NFC (#25586)
1 parent 338339d commit 245a15d

File tree

2 files changed

+31
-30
lines changed

2 files changed

+31
-30
lines changed

tools/link.py

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
from .utils import unsuffixed, unsuffixed_basename, get_file_suffix
4040
from .shared import in_temp, do_replace
4141
from .shared import DEBUG, WINDOWS, DYLIB_EXTENSIONS
42-
from .settings import settings, default_setting, user_settings, JS_ONLY_SETTINGS, DEPRECATED_SETTINGS
42+
from .settings import settings, default_setting, user_settings
43+
from .settings import JS_ONLY_SETTINGS, DEPRECATED_SETTINGS, INCOMPATIBLE_SETTINGS
4344
from .minimal_runtime_shell import generate_minimal_runtime_html
4445

4546
logger = logging.getLogger('link')
@@ -653,35 +654,7 @@ def add_system_js_lib(lib):
653654

654655

655656
def report_incompatible_settings():
656-
# List of incompatible settings, of the form (SETTINGS_A, SETTING_B, OPTIONAL_REASON_FOR_INCOMPAT)
657-
incompatible_settings = [
658-
('MINIMAL_RUNTIME', 'RELOCATABLE', None),
659-
('WASM2JS', 'RELOCATABLE', None),
660-
('MODULARIZE', 'PROXY_TO_WORKER', 'if you want to run in a worker with -sMODULARIZE, you likely want to do the worker side setup manually'),
661-
('MODULARIZE', 'NO_DECLARE_ASM_MODULE_EXPORTS', None),
662-
('EVAL_CTORS', 'WASM2JS', None),
663-
('EVAL_CTORS', 'RELOCATABLE', 'movable segments'),
664-
# In Asyncify exports can be called more than once, and this seems to not
665-
# work properly yet (see test_emscripten_scan_registers).
666-
('EVAL_CTORS', 'ASYNCIFY', None),
667-
('PTHREADS_PROFILING', 'NO_ASSERTIONS', 'only works with ASSERTIONS enabled'),
668-
('SOURCE_PHASE_IMPORTS', 'NO_EXPORT_ES6', None),
669-
('STANDALONE_WASM', 'MINIMAL_RUNTIME', None),
670-
('STRICT_JS', 'MODULARIZE', None),
671-
('STRICT_JS', 'EXPORT_ES6', None),
672-
('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION', 'MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION', 'they are mutually exclusive'),
673-
('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION', 'SINGLE_FILE', None),
674-
('MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION', 'SINGLE_FILE', None),
675-
('SEPARATE_DWARF', 'WASM2JS', 'as there is no wasm file'),
676-
('GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS', 'NO_GL_SUPPORT_SIMPLE_ENABLE_EXTENSIONS', None),
677-
('MODULARIZE', 'NODEJS_CATCH_REJECTION', None),
678-
('MODULARIZE', 'NODEJS_CATCH_EXIT', None),
679-
('LEGACY_VM_SUPPORT', 'MEMORY64', None),
680-
('CROSS_ORIGIN', 'NO_DYNAMIC_EXECUTION', None),
681-
('CROSS_ORIGIN', 'NO_PTHREADS', None),
682-
]
683-
684-
for a, b, reason in incompatible_settings:
657+
for a, b, reason in INCOMPATIBLE_SETTINGS:
685658
invert_b = b.startswith('NO_')
686659
if invert_b:
687660
b = b[3:]

tools/settings.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,34 @@
134134
'SIDE_MODULE_IMPORTS',
135135
}
136136

137+
# List of incompatible settings, of the form (SETTINGS_A, SETTING_B, OPTIONAL_REASON_FOR_INCOMPAT)
138+
INCOMPATIBLE_SETTINGS = [
139+
('MINIMAL_RUNTIME', 'RELOCATABLE', None),
140+
('WASM2JS', 'RELOCATABLE', None),
141+
('MODULARIZE', 'PROXY_TO_WORKER', 'if you want to run in a worker with -sMODULARIZE, you likely want to do the worker side setup manually'),
142+
('MODULARIZE', 'NO_DECLARE_ASM_MODULE_EXPORTS', None),
143+
('EVAL_CTORS', 'WASM2JS', None),
144+
('EVAL_CTORS', 'RELOCATABLE', 'movable segments'),
145+
# In Asyncify exports can be called more than once, and this seems to not
146+
# work properly yet (see test_emscripten_scan_registers).
147+
('EVAL_CTORS', 'ASYNCIFY', None),
148+
('PTHREADS_PROFILING', 'NO_ASSERTIONS', 'only works with ASSERTIONS enabled'),
149+
('SOURCE_PHASE_IMPORTS', 'NO_EXPORT_ES6', None),
150+
('STANDALONE_WASM', 'MINIMAL_RUNTIME', None),
151+
('STRICT_JS', 'MODULARIZE', None),
152+
('STRICT_JS', 'EXPORT_ES6', None),
153+
('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION', 'MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION', 'they are mutually exclusive'),
154+
('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION', 'SINGLE_FILE', None),
155+
('MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION', 'SINGLE_FILE', None),
156+
('SEPARATE_DWARF', 'WASM2JS', 'as there is no wasm file'),
157+
('GL_SUPPORT_AUTOMATIC_ENABLE_EXTENSIONS', 'NO_GL_SUPPORT_SIMPLE_ENABLE_EXTENSIONS', None),
158+
('MODULARIZE', 'NODEJS_CATCH_REJECTION', None),
159+
('MODULARIZE', 'NODEJS_CATCH_EXIT', None),
160+
('LEGACY_VM_SUPPORT', 'MEMORY64', None),
161+
('CROSS_ORIGIN', 'NO_DYNAMIC_EXECUTION', None),
162+
('CROSS_ORIGIN', 'NO_PTHREADS', None),
163+
]
164+
137165
user_settings: Dict[str, str] = {}
138166

139167

0 commit comments

Comments
 (0)