fix warning on EXPORTED_FUNCTIONS, and improve test
This commit is contained in:
Родитель
9b275b24a9
Коммит
2f57b4b2ce
|
@ -932,7 +932,9 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
|
|||
exported_implemented_functions.add(key)
|
||||
implemented_functions = set(metadata['implementedFunctions'])
|
||||
if settings['ASSERTIONS'] and settings.get('ORIGINAL_EXPORTED_FUNCTIONS'):
|
||||
for requested in settings['ORIGINAL_EXPORTED_FUNCTIONS']:
|
||||
original_exports = settings['ORIGINAL_EXPORTED_FUNCTIONS']
|
||||
if original_exports[0] == '@': original_exports = json.loads(open(original_exports[1:]).read())
|
||||
for requested in original_exports:
|
||||
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
|
||||
logging.warning('function requested to be exported, but not implemented: "%s"', requested)
|
||||
|
|
|
@ -5982,20 +5982,22 @@ def process(filename):
|
|||
src = r'''
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <emscripten.h>
|
||||
|
||||
extern "C" {
|
||||
int other_function() { return 5; }
|
||||
}
|
||||
|
||||
int main() {
|
||||
printf("waka!\n");
|
||||
int x = EM_ASM_INT_V({ return Module._other_function() });
|
||||
printf("waka %d!\n", x);
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
open('exps', 'w').write('["_main","_other_function"]')
|
||||
|
||||
self.emcc_args += ['-s', 'EXPORTED_FUNCTIONS=@exps']
|
||||
self.do_run(src, '''waka!''')
|
||||
self.do_run(src, '''waka 5!''')
|
||||
assert 'other_function' in open('src.cpp.o.js').read()
|
||||
|
||||
def test_add_function(self):
|
||||
|
|
Загрузка…
Ссылка в новой задаче