Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ def compile_source_file(input_file):
# driver to perform linking which would be big change.
cmd += ['-Xclang', '-split-dwarf-file', '-Xclang', unsuffixed_basename(input_file) + '.dwo']
cmd += ['-Xclang', '-split-dwarf-output', '-Xclang', unsuffixed_basename(input_file) + '.dwo']
print(" ".join(cmd))
shared.check_call(cmd)
if not shared.SKIP_SUBPROCS:
assert os.path.exists(output_file)
Expand Down
10 changes: 10 additions & 0 deletions system/include/emscripten/em_asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,14 @@ const char __em_asm_sig_builder<__em_asm_type_tuple<Args...> >::buffer[] = { __e
#define EM_ASM_INT_V(code) EM_ASM_INT(code)
#define EM_ASM_DOUBLE_V(code) EM_ASM_DOUBLE(code)

#if defined(true) && defined(false)
#undef true
#undef false
// These work for both C and javascript.
// In C !!0 ==> 0 and in javascript !!0 ==> false
// In C !!1 ==> 1 and in javascript !!1 ==> true
#define true (!!1)
#define false (!!0)
#endif

#endif // !defined(__cplusplus) && defined(__STRICT_ANSI__)
11 changes: 11 additions & 0 deletions system/include/emscripten/em_js.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,14 @@

#define EM_ASYNC_JS(ret, name, params, ...) _EM_JS(ret, name, __asyncjs__##name, params, \
"{ return Asyncify.handleAsync(async () => " #__VA_ARGS__ "); }")


#if defined(true) && defined(false)
#undef true
#undef false
// These work for both C and javascript.
// In C !!0 ==> 0 and in javascript !!0 ==> false
// In C !!1 ==> 1 and in javascript !!1 ==> true
#define true (!!1)
#define false (!!0)
#endif
21 changes: 21 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -16060,3 +16060,24 @@ def test_getentropy_d8(self):
self.do_runf('main.c', msg, assert_returncode=1)
self.v8_args += ['--enable-os-system']
self.do_runf('main.c')

def test_js_bool_type(self):
create_file('main.c', '''
#include <emscripten.h>

#define EM_JS_MACROS(ret, func_name, args, body...) \
EM_JS(ret, func_name, args, body)

EM_JS_MACROS(void, check_bool_type, (void), {
if (typeof true !== "boolean") {
throw new Error("typeof true is " + typeof true + " not boolean");
}
})

int main() {
check_bool_type();
return 0;
}
''')
self.do_runf('main.c')