Skip to content

Commit 9b727e8

Browse files
committed
Apply code review to Emscripten strict mode.
1 parent 8455fba commit 9b727e8

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

emcc.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -925,18 +925,23 @@ def detect_fixed_language_mode(args):
925925
if 'EMCC_STRICT' in os.environ:
926926
shared.Settings.STRICT = os.environ.get('EMCC_STRICT') != '0'
927927

928-
STRICT = ([None] + filter(lambda x: x.startswith('STRICT='), settings_changes))[-1]
929-
if STRICT:
930-
shared.Settings.STRICT = int(STRICT[len('STRICT='):])
928+
# Libraries are searched before settings_changes are applied, so apply the value for STRICT and ERROR_ON_MISSING_LIBRARIES from
929+
# command line already now.
930+
931+
def get_last_setting_change(setting):
932+
return ([None] + filter(lambda x: x.startswith(setting + '='), settings_changes))[-1]
933+
934+
strict_cmdline = get_last_setting_change('STRICT')
935+
if strict_cmdline:
936+
shared.Settings.STRICT = int(strict_cmdline[len('STRICT='):])
931937

932938
if shared.Settings.STRICT:
933939
shared.Settings.ERROR_ON_UNDEFINED_SYMBOLS = 1
934940
shared.Settings.ERROR_ON_MISSING_LIBRARIES = 1
935941

936-
# Libraries are searched before settings_changes are applied, so pull its value from the command line already here.
937-
ERROR_ON_MISSING_LIBRARIES = ([None] + filter(lambda x: x.startswith('ERROR_ON_MISSING_LIBRARIES='), settings_changes))[-1]
938-
if ERROR_ON_MISSING_LIBRARIES:
939-
shared.Settings.ERROR_ON_MISSING_LIBRARIES = int(ERROR_ON_MISSING_LIBRARIES[len('ERROR_ON_MISSING_LIBRARIES='):])
942+
error_on_missing_libraries_cmdline = get_last_setting_change('ERROR_ON_MISSING_LIBRARIES')
943+
if error_on_missing_libraries_cmdline:
944+
shared.Settings.ERROR_ON_MISSING_LIBRARIES = int(error_on_missing_libraries_cmdline[len('ERROR_ON_MISSING_LIBRARIES='):])
940945

941946
system_js_libraries = []
942947

0 commit comments

Comments
 (0)