Skip to content

Commit

Permalink
Warn on the incompatibility between source maps and SINGLE_FILE (emsc…
Browse files Browse the repository at this point in the history
…ripten-core#23292)

Source maps require a source map file, which SINGLE_FILE disallows. We
disable source maps in that case, but did not show a warning before
this PR.

Fixes emscripten-core#23257
  • Loading branch information
kripken authored Jan 6, 2025
1 parent 512e600 commit 2396d3e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -9541,6 +9541,11 @@ def test_single_file_no_clobber_wasm(self):
self.assertExists('hello_world.js')
self.assertFileContents('hello_world.wasm', 'not wasm')

def test_single_file_disables_source_map(self):
cmd = [EMCC, test_file('hello_world.c'), '-sSINGLE_FILE', '-gsource-map']
stderr = self.run_process(cmd, stderr=PIPE).stderr
self.assertContained('warning: SINGLE_FILE disables source map support', stderr)

def test_wasm2js_no_clobber_wasm(self):
create_file('hello_world.wasm', 'not wasm')
self.do_runf('hello_world.c', emcc_args=['-sWASM=0'])
Expand Down
3 changes: 2 additions & 1 deletion tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,8 @@ def phase_linker_setup(options, state, newargs): # noqa: C901, PLR0912, PLR0915
if settings.WASM_BIGINT:
settings.LEGALIZE_JS_FFI = 0

if settings.SINGLE_FILE:
if settings.SINGLE_FILE and settings.GENERATE_SOURCE_MAP:
diagnostics.warning('emcc', 'SINGLE_FILE disables source map support (which requires a .map file)')
settings.GENERATE_SOURCE_MAP = 0

if settings.EVAL_CTORS:
Expand Down

0 comments on commit 2396d3e

Please sign in to comment.