Skip to content

Commit a7ffb49

Browse files
authored
Centralize experimental settings. NFC (#25671)
1 parent 0563bf8 commit a7ffb49

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

‎tools/link.py‎

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from .minimal_runtime_shell import generate_minimal_runtime_html
3838
from .settings import (
3939
DEPRECATED_SETTINGS,
40+
EXPERIMENTAL_SETTINGS,
4041
INCOMPATIBLE_SETTINGS,
4142
JS_ONLY_SETTINGS,
4243
default_setting,
@@ -664,7 +665,11 @@ def add_system_js_lib(lib):
664665
settings.JS_LIBRARIES.append(lib)
665666

666667

667-
def report_incompatible_settings():
668+
def check_settings():
669+
for name, msg in EXPERIMENTAL_SETTINGS.items():
670+
if getattr(settings, name):
671+
diagnostics.warning('experimental', msg)
672+
668673
for a, b, reason in INCOMPATIBLE_SETTINGS:
669674
invert_b = b.startswith('NO_')
670675
if invert_b:
@@ -826,19 +831,10 @@ def phase_linker_setup(options, linker_args): # noqa: C901, PLR0912, PLR0915
826831

827832
settings.OUTPUT_FORMAT = options.oformat.name
828833

829-
if settings.JS_BASE64_API:
830-
diagnostics.warning('experimental', '-sJS_BASE64_API is still experimental and not yet supported in browsers')
831-
832-
if settings.GROWABLE_ARRAYBUFFERS:
833-
diagnostics.warning('experimental', '-sGROWABLE_ARRAYBUFFERS is still experimental and not yet supported in browsers')
834-
835-
if settings.SUPPORT_BIG_ENDIAN:
836-
diagnostics.warning('experimental', '-sSUPPORT_BIG_ENDIAN is experimental, not all features are fully supported.')
837-
if settings.WASM2JS:
838-
exit_with_error('WASMJ2S is currently not compatible with SUPPORT_BIG_ENDIAN')
834+
if settings.SUPPORT_BIG_ENDIAN and settings.WASM2JS:
835+
exit_with_error('WASMJ2S is currently not compatible with SUPPORT_BIG_ENDIAN')
839836

840837
if settings.WASM_ESM_INTEGRATION:
841-
diagnostics.warning('experimental', '-sWASM_ESM_INTEGRATION is still experimental and not yet supported in browsers')
842838
default_setting('MODULARIZE', 'instance')
843839
if not settings.EXPORT_ES6:
844840
exit_with_error('WASM_ESM_INTEGRATION requires EXPORT_ES6')
@@ -857,9 +853,6 @@ def phase_linker_setup(options, linker_args): # noqa: C901, PLR0912, PLR0915
857853
if settings.ABORT_ON_WASM_EXCEPTIONS:
858854
exit_with_error('WASM_ESM_INTEGRATION is not compatible with ABORT_ON_WASM_EXCEPTIONS')
859855

860-
if settings.WASM_JS_TYPES:
861-
diagnostics.warning('experimental', '-sWASM_JS_TYPES is only supported under a flag in certain browsers')
862-
863856
if settings.MODULARIZE and settings.MODULARIZE not in [1, 'instance']:
864857
exit_with_error(f'Invalid setting "{settings.MODULARIZE}" for MODULARIZE.')
865858

@@ -1770,9 +1763,6 @@ def get_full_import_name(name):
17701763
if settings.ASYNCIFY == 2:
17711764
diagnostics.warning('experimental', '-sASYNCIFY=2 (JSPI) is still experimental')
17721765

1773-
if settings.SOURCE_PHASE_IMPORTS:
1774-
diagnostics.warning('experimental', '-sSOURCE_PHASE_IMPORTS is still experimental and not yet supported in browsers')
1775-
17761766
if settings.WASM2JS:
17771767
if settings.GENERATE_SOURCE_MAP:
17781768
exit_with_error('wasm2js does not support source maps yet (debug in wasm for now)')
@@ -1875,7 +1865,7 @@ def get_full_import_name(name):
18751865
if settings.USE_CLOSURE_COMPILER or not settings.MINIFY_WHITESPACE:
18761866
settings.MAYBE_CLOSURE_COMPILER = 1
18771867

1878-
report_incompatible_settings()
1868+
check_settings()
18791869

18801870
return target, wasm_target
18811871

@@ -2249,7 +2239,6 @@ def phase_final_emitting(options, target, js_target, wasm_target):
22492239
generate_worker_js(target, options, js_target, target_basename)
22502240

22512241
if settings.SPLIT_MODULE:
2252-
diagnostics.warning('experimental', 'the SPLIT_MODULE setting is experimental and subject to change')
22532242
do_split_module(wasm_target, options)
22542243

22552244
if options.executable:

‎tools/settings.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@
160160
('CROSS_ORIGIN', 'NO_PTHREADS', None),
161161
]
162162

163+
EXPERIMENTAL_SETTINGS = {
164+
'SPLIT_MODULE': '-sSPLIT_MODULE is experimental and subject to change',
165+
'WASM_JS_TYPES': '-sWASM_JS_TYPES is only supported under a flag in certain browsers',
166+
'SOURCE_PHASE_IMPORTS': '-sSOURCE_PHASE_IMPORTS is experimental and not yet supported in browsers',
167+
'JS_BASE64_API': '-sJS_BASE64_API is experimental and not yet supported in browsers',
168+
'GROWABLE_ARRAYBUFFERS': '-sGROWABLE_ARRAYBUFFERS is experimental and not yet supported in browsers',
169+
'SUPPORT_BIG_ENDIAN': '-sSUPPORT_BIG_ENDIAN is experimental, not all features are fully supported.',
170+
'WASM_ESM_INTEGRATION': '-sWASM_ESM_INTEGRATION is still experimental and not yet supported in browsers',
171+
}
172+
163173
# For renamed settings the format is:
164174
# [OLD_NAME, NEW_NAME]
165175
# For removed settings (which now effectively have a fixed value and can no

0 commit comments

Comments
 (0)