Skip to content
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
6 changes: 5 additions & 1 deletion emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3812,7 +3812,11 @@ def parse_string_list(text):
return parse_string_list(text)

try:
return int(text)
if text.startswith('0x'):
base = 16
else:
base = 10
return int(text, base)
except ValueError:
return parse_string_value(text)

Expand Down
5 changes: 5 additions & 0 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -6556,6 +6556,11 @@ def test_dash_s_no_space(self):
err = self.expect_fail([EMXX, test_file('hello_world.cpp'), '-sEXPORTED_FUNCTIONS=foo'])
self.assertContained('error: undefined exported symbol: "foo"', err)

def test_dash_s_hex(self):
self.run_process([EMCC, test_file('hello_world.c'), '-nostdlib', '-sERROR_ON_UNDEFINED_SYMBOLS=0'])
# Ensure that 0x0 is parsed as a zero and not as the string '0x0'.
self.run_process([EMCC, test_file('hello_world.c'), '-nostdlib', '-sERROR_ON_UNDEFINED_SYMBOLS=0x0'])

def test_zeroinit(self):
create_file('src.c', r'''
#include <stdio.h>
Expand Down