Skip to content

Commit d317380

Browse files
committed
Unify handling of deprecated settings
Unlike `LEGACY_SETTINGS`, deprecated settings can continue to be used and the values passed in will continue to be honored. Once folks have stopped using them we can move them to `LEGACY_SETTINGS`.
1 parent a95c44e commit d317380

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

test/test_other.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8514,7 +8514,7 @@ def test_exported_runtime_methods_metadce(self, use_legacy_name):
85148514
setting_name = 'EXTRA_EXPORTED_RUNTIME_METHODS'
85158515
err = self.run_process([EMCC, test_file('hello_world.c'), '-Os', '-s%s=%s' % (setting_name, ','.join(exports))], stderr=PIPE).stderr
85168516
if use_legacy_name:
8517-
self.assertContained('warning: EXTRA_EXPORTED_RUNTIME_METHODS is deprecated, please use EXPORTED_RUNTIME_METHODS instead [-Wdeprecated]', err)
8517+
self.assertContained('warning: EXTRA_EXPORTED_RUNTIME_METHODS is deprecated (please use EXPORTED_RUNTIME_METHODS instead). Please open a bug if you have a continuing need for this setting [-Wdeprecated]', err)
85188518
js = read_file('a.out.js')
85198519
for export in exports:
85208520
self.assertContained(f'Module["{export}"]', js)

tools/link.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from .shared import in_temp, safe_copy, do_replace, OFormat
3939
from .shared import DEBUG, WINDOWS, DYNAMICLIB_ENDINGS, STATICLIB_ENDINGS
4040
from .shared import unsuffixed, unsuffixed_basename, get_file_suffix
41-
from .settings import settings, default_setting, user_settings, JS_ONLY_SETTINGS
41+
from .settings import settings, default_setting, user_settings, JS_ONLY_SETTINGS, DEPRECATED_SETTINGS
4242
from .minimal_runtime_shell import generate_minimal_runtime_html
4343

4444
import tools.line_endings
@@ -698,14 +698,11 @@ def phase_linker_setup(options, state, newargs):
698698

699699
final_suffix = get_file_suffix(target)
700700

701-
if 'SUPPORT_ERRNO' in user_settings:
702-
diagnostics.warning('deprecated', 'SUPPORT_ERRNO is deprecated since emscripten no longer uses the setErrNo library function')
703-
704-
if 'DEMANGLE_SUPPORT' in user_settings:
705-
diagnostics.warning('deprecated', 'DEMANGLE_SUPPORT is deprecated since mangled names no longer appear in stack traces')
701+
for s, reason in DEPRECATED_SETTINGS.items():
702+
if s in user_settings:
703+
diagnostics.warning('deprecated', f'{s} is deprecated ({reason}). Please open a bug if you have a continuing need for this setting')
706704

707705
if settings.EXTRA_EXPORTED_RUNTIME_METHODS:
708-
diagnostics.warning('deprecated', 'EXTRA_EXPORTED_RUNTIME_METHODS is deprecated, please use EXPORTED_RUNTIME_METHODS instead')
709706
settings.EXPORTED_RUNTIME_METHODS += settings.EXTRA_EXPORTED_RUNTIME_METHODS
710707

711708
# If no output format was specified we try to deduce the format based on

tools/settings.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@
109109
'RUNTIME_LINKED_LIBS',
110110
}.union(PORTS_SETTINGS)
111111

112+
# Unlike `LEGACY_SETTINGS`, deprecated settings can still be used
113+
# both on the command line and in the emscripten codebase.
114+
#
115+
# At some point in the future, once folks have stopped using these
116+
# settings we can move them to `LEGACY_SETTINGS`.
117+
DEPRECATED_SETTINGS = {
118+
'SUPPORT_ERRNO': 'emscripten no longer uses the setErrNo library function',
119+
'EXTRA_EXPORTED_RUNTIME_METHODS': 'please use EXPORTED_RUNTIME_METHODS instead',
120+
'DEMANGLE_SUPPORT': 'mangled names no longer appear in stack traces',
121+
}
112122

113123
# Settings that don't need to be externalized when serializing to json because they
114124
# are not used by the JS compiler.

0 commit comments

Comments
 (0)