|
23 | 23 | from tools import shared
|
24 | 24 | from tools import gen_struct_info
|
25 | 25 | from tools import webassembly
|
26 |
| -from tools.shared import WINDOWS, asstr, path_from_root, exit_with_error, asmjs_mangle, treat_as_user_function |
| 26 | +from tools.shared import WINDOWS, path_from_root, exit_with_error, asmjs_mangle, treat_as_user_function |
27 | 27 | from tools.toolchain_profiler import ToolchainProfiler
|
28 | 28 |
|
29 | 29 | logger = logging.getLogger('emscripten')
|
@@ -188,12 +188,11 @@ def set_memory(static_bump):
|
188 | 188 | def report_missing_symbols(all_implemented, pre):
|
189 | 189 | # the initial list of missing functions are that the user explicitly exported
|
190 | 190 | # but were not implemented in compiled code
|
191 |
| - missing = list(set(shared.Settings.USER_EXPORTED_FUNCTIONS) - all_implemented) |
| 191 | + missing = set(shared.Settings.USER_EXPORTED_FUNCTIONS) - all_implemented |
192 | 192 |
|
193 |
| - for requested in missing: |
194 |
| - if ('function ' + asstr(requested) + '(') in pre: |
195 |
| - continue |
196 |
| - diagnostics.warning('undefined', 'undefined exported symbol: "%s"', requested) |
| 193 | + for requested in sorted(missing): |
| 194 | + if (f'function {requested}(') not in pre: |
| 195 | + diagnostics.warning('undefined', f'undefined exported symbol: "{requested}"') |
197 | 196 |
|
198 | 197 | # Special hanlding for the `_main` symbol
|
199 | 198 |
|
@@ -455,7 +454,6 @@ def finalize_wasm(infile, outfile, memfile, DEBUG):
|
455 | 454 | def create_asm_consts(metadata):
|
456 | 455 | asm_consts = {}
|
457 | 456 | for addr, const in metadata['asmConsts'].items():
|
458 |
| - const = asstr(const) |
459 | 457 | const = trim_asm_const_body(const)
|
460 | 458 | args = []
|
461 | 459 | max_arity = 16
|
@@ -484,7 +482,7 @@ def create_em_js(forwarded_json, metadata):
|
484 | 482 | else:
|
485 | 483 | args = args.split(',')
|
486 | 484 | arg_names = [arg.split()[-1].replace("*", "") for arg in args if arg]
|
487 |
| - func = 'function {}({}){}'.format(name, ','.join(arg_names), asstr(body)) |
| 485 | + func = 'function {}({}){}'.format(name, ','.join(arg_names), body) |
488 | 486 | em_js_funcs.append(func)
|
489 | 487 | forwarded_json['Functions']['libraryFunctions'][name] = 1
|
490 | 488 |
|
@@ -778,14 +776,6 @@ def load_metadata_wasm(metadata_raw, DEBUG):
|
778 | 776 | for key, value in metadata_json.items():
|
779 | 777 | if key in legacy_keys:
|
780 | 778 | continue
|
781 |
| - # json.loads returns `unicode` for strings but other code in this file |
782 |
| - # generally works with utf8 encoded `str` objects, and they don't alwasy |
783 |
| - # mix well. e.g. s.replace(x, y) will blow up is `s` a uts8 str containing |
784 |
| - # non-ascii and either x or y are unicode objects. |
785 |
| - # TODO(sbc): Remove this encoding if we switch to unicode elsewhere |
786 |
| - # (specifically the glue returned from compile_settings) |
787 |
| - if type(value) == list: |
788 |
| - value = [asstr(v) for v in value] |
789 | 779 | if key not in metadata:
|
790 | 780 | exit_with_error('unexpected metadata key received from wasm-emscripten-finalize: %s', key)
|
791 | 781 | metadata[key] = value
|
|
0 commit comments