do not warn on unimplemented js library funcs

This commit is contained in:
Alon Zakai 2015-06-30 13:35:44 -07:00
Родитель 69188388a7
Коммит f00eeabbff
2 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -258,8 +258,11 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
original_exports = settings['ORIGINAL_EXPORTED_FUNCTIONS']
if original_exports[0] == '@': original_exports = json.loads(open(original_exports[1:]).read())
for requested in original_exports:
# check if already implemented
# special-case malloc, EXPORTED by default for internal use, but we bake in a trivial allocator and warn at runtime if used in ASSERTIONS \
if requested not in all_implemented and \
requested != '_malloc': # special-case malloc, EXPORTED by default for internal use, but we bake in a trivial allocator and warn at runtime if used in ASSERTIONS
requested != '_malloc' and \
('function ' + requested) not in pre: # could be a js library func
logging.warning('function requested to be exported, but not implemented: "%s"', requested)
asm_consts = [0]*len(metadata['asmConsts'])

Просмотреть файл

@ -4915,3 +4915,8 @@ int main() { printf("Mary had a little lamb.\n"); }
f.write(d)
out = run_js('a.out.js', assert_returncode=None, stderr=subprocess.STDOUT)
self.assertContained('Assertion failed: memory initializer checksum', out)
def test_no_warn_exported_jslibfunc(self):
out, err = Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world.c'), '-s', 'DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=["alGetError"]', '-s', 'EXPORTED_FUNCTIONS=["_main", "_alGetError"]'], stdout=PIPE, stderr=PIPE).communicate()
self.assertNotContained('''function requested to be exported, but not implemented: "_alGetError"''', err)