Skip to content

Remove undocumented and unused getFuncWrapper() #16618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions src/library_browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -779,36 +779,6 @@ var LibraryBrowser = {
},
},

$funcWrappers: {},

$getFuncWrapper__deps: ['$funcWrappers', '$dynCall'],
$getFuncWrapper: function(func, sig) {
if (!func) return; // on null pointer, return undefined
assert(sig);
if (!funcWrappers[sig]) {
funcWrappers[sig] = {};
}
var sigCache = funcWrappers[sig];
if (!sigCache[func]) {
// optimize away arguments usage in common cases
if (sig.length === 1) {
sigCache[func] = function dynCall_wrapper() {
return dynCall(sig, func);
};
} else if (sig.length === 2) {
sigCache[func] = function dynCall_wrapper(arg) {
return dynCall(sig, func, [arg]);
};
} else {
// general case
sigCache[func] = function dynCall_wrapper() {
return dynCall(sig, func, Array.prototype.slice.call(arguments));
};
}
}
return sigCache[func];
},

emscripten_run_preload_plugins__deps: ['$PATH',
#if !MINIMAL_RUNTIME
'$runtimeKeepalivePush', '$runtimeKeepalivePop',
Expand Down
1 change: 0 additions & 1 deletion src/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ function exportRuntime() {
'registerFunctions',
'addFunction',
'removeFunction',
'getFuncWrapper',
'prettyPrint',
'dynCall',
'getCompilerSetting',
Expand Down
23 changes: 0 additions & 23 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6981,29 +6981,6 @@ def test_add_function(self):
self.set_setting('ASSERTIONS', 2)
self.do_run_in_out_file_test('interop/test_add_function.cpp', interleaved_output=False)

def test_getFuncWrapper_sig_alias(self):
self.set_setting('DEFAULT_LIBRARY_FUNCS_TO_INCLUDE', ['$getFuncWrapper'])
src = r'''
#include <stdio.h>
#include <emscripten.h>

void func1(int a) {
printf("func1\n");
}
void func2(int a, int b) {
printf("func2\n");
}

int main() {
EM_ASM({
getFuncWrapper($0, 'vi')(0);
getFuncWrapper($1, 'vii')(0, 0);
}, func1, func2);
return 0;
}
'''
self.do_run(src, 'func1\nfunc2\n')

def test_emulate_function_pointer_casts(self):
# Forcibly disable EXIT_RUNTIME due to:
# https://github.com/emscripten-core/emscripten/issues/15081
Expand Down