Skip to content

Commit 305bbe4

Browse files
committed
Add EMSCRIPTEN_STRICT as a linker setting as well.
1 parent 5f8e7eb commit 305bbe4

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

emcc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ def detect_fixed_language_mode(args):
939939
if found: break
940940
if found: break
941941
if not found and lib not in ['GL', 'GLU', 'glut', 'm', 'c', 'SDL', 'stdc++', 'pthread']: # whitelist our default libraries
942-
emscripten_strict_mode = os.environ.get('EMSCRIPTEN_STRICT') and int(os.environ.get('EMSCRIPTEN_STRICT')) != 0
942+
emscripten_strict_mode = (os.environ.get('EMSCRIPTEN_STRICT') and int(os.environ.get('EMSCRIPTEN_STRICT')) != 0) or 'EMSCRIPTEN_STRICT=1' in settings_changes
943943
error_on_missing_libraries = (emscripten_strict_mode and not 'ERROR_ON_MISSING_LIBRARIES=0' in settings_changes) or 'ERROR_ON_MISSING_LIBRARIES=1' in settings_changes
944944
if error_on_missing_libraries:
945945
logging.fatal('emcc: cannot find library "%s"', lib)

src/settings.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,10 @@ var LINKABLE = 0; // If set to 1, this file can be linked with others, either as
482482
// LINKABLE of 0 is very useful in that we can reduce the size of the
483483
// generated code very significantly, by removing everything not actually used.
484484

485+
var EMSCRIPTEN_STRICT = 0; // Emscripten 'strict' build mode: Drop supporting any deprecated build options.
486+
// Set the environment variable EMSCRIPTEN_STRICT=1 or pass -s EMSCRIPTEN_STRICT=1
487+
// to test that a codebase builds nicely in forward compatible manner.
488+
485489
var WARN_ON_UNDEFINED_SYMBOLS = 1; // If set to 1, we will warn on any undefined symbols that
486490
// are not resolved by the library_*.js files. Note that
487491
// it is common in large projects to

tools/shared.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,8 @@ def load(self, args=[]):
11151115

11161116
# Apply default values for settings that are configured from environment variables.
11171117
if os.environ.get('EMSCRIPTEN_STRICT') and int(os.environ.get('EMSCRIPTEN_STRICT')) != 0:
1118-
# The default value -s ERROR_ON_UNDEFINED_SYMBOLS=0 is deprecated. Use the default value 1 in strict mode.
1118+
# Specify default values for Emscripten strict mode.
1119+
self.attrs['EMSCRIPTEN_STRICT'] = 1
11191120
self.attrs['ERROR_ON_UNDEFINED_SYMBOLS'] = 1
11201121
self.attrs['ERROR_ON_MISSING_LIBRARIES'] = 1
11211122

0 commit comments

Comments
 (0)