Skip to content

Commit cc32e3c

Browse files
committed
Centralize experimental settings. NFC
1 parent 79bf3e0 commit cc32e3c

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

@@ -1773,9 +1766,6 @@ def get_full_import_name(name):
17731766
if settings.ASYNCIFY == 2:
17741767
diagnostics.warning('experimental', '-sASYNCIFY=2 (JSPI) is still experimental')
17751768

1776-
if settings.SOURCE_PHASE_IMPORTS:
1777-
diagnostics.warning('experimental', '-sSOURCE_PHASE_IMPORTS is still experimental and not yet supported in browsers')
1778-
17791769
if settings.WASM2JS:
17801770
if settings.GENERATE_SOURCE_MAP:
17811771
exit_with_error('wasm2js does not support source maps yet (debug in wasm for now)')
@@ -1878,7 +1868,7 @@ def get_full_import_name(name):
18781868
if settings.USE_CLOSURE_COMPILER or not settings.MINIFY_WHITESPACE:
18791869
settings.MAYBE_CLOSURE_COMPILER = 1
18801870

1881-
report_incompatible_settings()
1871+
check_settings()
18821872

18831873
return target, wasm_target
18841874

@@ -2252,7 +2242,6 @@ def phase_final_emitting(options, target, js_target, wasm_target):
22522242
generate_worker_js(target, options, js_target, target_basename)
22532243

22542244
if settings.SPLIT_MODULE:
2255-
diagnostics.warning('experimental', 'the SPLIT_MODULE setting is experimental and subject to change')
22562245
do_split_module(wasm_target, options)
22572246

22582247
if options.executable:

tools/settings.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,16 @@
163163
('CROSS_ORIGIN', 'NO_PTHREADS', None),
164164
]
165165

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

0 commit comments

Comments
 (0)