Skip to content
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

Fix Closure compiler error with -sASSERTIONS=1 #15

Merged
merged 2 commits into from
Jun 26, 2022
Merged
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
10 changes: 8 additions & 2 deletions src/wasm32/ffi.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ _Static_assert(MAX_ALIGN == __alignof__(max_align_t), "max_align_t must be 8");

#define VARARGS_FLAG 1

#define FFI_OK_MACRO 0
_Static_assert(FFI_OK_MACRO == FFI_OK, "FFI_OK must be 0");

#define FFI_BAD_TYPEDEF_MACRO 1
_Static_assert(FFI_BAD_TYPEDEF_MACRO == FFI_BAD_TYPEDEF, "FFI_BAD_TYPEDEF must be 1");

ffi_status FFI_HIDDEN
ffi_prep_cif_machdep(ffi_cif *cif)
{
Expand Down Expand Up @@ -670,13 +676,13 @@ ffi_prep_closure_loc_helper,
try {
var wasm_trampoline = convertJsFunctionToWasm(trampoline, sig);
} catch(e) {
return FFI_BAD_TYPEDEF;
return FFI_BAD_TYPEDEF_MACRO;
}
wasmTable.set(codeloc, wasm_trampoline);
CLOSURE__cif(closure) = cif;
CLOSURE__fun(closure) = fun;
CLOSURE__user_data(closure) = user_data;
return 0 /* FFI_OK */;
return FFI_OK_MACRO;
})

// EM_JS does not correctly handle function pointer arguments, so we need a
Expand Down