aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-13 18:10:28 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-11-13 18:10:28 -0800
commit0f90bdc8768020f793bbd7ebd02aed021aba53c4 (patch)
tree02ed11a2b082b4bc0ae7306ae21b5ecde5dff7b5
parent2e227ca660def7703684093a26b813c468efacc3 (diff)
warn on missing symbols by default; fixes #1794
-rw-r--r--src/settings.js13
-rw-r--r--tests/test_other.py35
2 files changed, 23 insertions, 25 deletions
diff --git a/src/settings.js b/src/settings.js
index 0d8d3da5..bc665973 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -390,13 +390,16 @@ var FAKE_X86_FP80 = 1; // Replaces x86_fp80 with double. This loses precision. I
var GC_SUPPORT = 1; // Enables GC, see gc.h (this does not add overhead, so it is on by default)
-var WARN_ON_UNDEFINED_SYMBOLS = 0; // If set to 1, we will warn on any undefined symbols that
- // are not resolved by the library_*.js files. We by default
- // do not warn because (1) it is normal in large projects to
+var WARN_ON_UNDEFINED_SYMBOLS = 1; // If set to 1, we will warn on any undefined symbols that
+ // are not resolved by the library_*.js files. Note that
+ // it is common in large projects to
// not implement everything, when you know what is not
// going to actually be called (and don't want to mess with
- // the existing buildsystem), and (2) functions might be
- // implemented later on, say in --pre-js
+ // the existing buildsystem), and functions might be
+ // implemented later on, say in --pre-js, so you may
+ // want to build with -s WARN_ON_UNDEFINED_SYMBOLS=0 to
+ // disable the warnings if they annoy you.
+ // See also ERROR_ON_UNDEFINED_SYMBOLS
var ERROR_ON_UNDEFINED_SYMBOLS = 0; // If set to 1, we will give a compile-time error on any
// undefined symbols (see WARN_ON_UNDEFINED_SYMBOLS).
diff --git a/tests/test_other.py b/tests/test_other.py
index e54add18..ba4ed0ba 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -1455,26 +1455,21 @@ f.close()
def clear(): try_delete('a.out.js')
for args in [[], ['-O2']]:
- clear()
- print 'warn', args
- output = Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp'), '-s', 'WARN_ON_UNDEFINED_SYMBOLS=1'] + args, stderr=PIPE).communicate()
- self.assertContained('unresolved symbol: something', output[1])
-
- clear()
- output = Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp')] + args, stderr=PIPE).communicate()
- self.assertNotContained('unresolved symbol: something\n', output[1])
-
- for args in [[], ['-O2']]:
- clear()
- print 'error', args
- output = Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp'), '-s', 'ERROR_ON_UNDEFINED_SYMBOLS=1'] + args, stderr=PIPE).communicate()
- self.assertContained('unresolved symbol: something', output[1])
- assert not os.path.exists('a.out.js')
-
- clear()
- output = Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp')] + args, stderr=PIPE).communicate()
- self.assertNotContained('unresolved symbol: something\n', output[1])
- assert os.path.exists('a.out.js')
+ for action in ['WARN', 'ERROR', None]:
+ for value in ([0, 1] if action else [0]):
+ clear()
+ print 'warn', args, action, value
+ extra = ['-s', action + '_ON_UNDEFINED_SYMBOLS=%d' % value] if action else []
+ output = Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp')] + extra + args, stderr=PIPE).communicate()
+ if action == None or (action == 'WARN' and value):
+ self.assertContained('unresolved symbol: something', output[1])
+ assert os.path.exists('a.out.js')
+ elif action == 'ERROR' and value:
+ self.assertContained('unresolved symbol: something', output[1])
+ assert not os.path.exists('a.out.js')
+ elif action == 'WARN' and not value:
+ self.assertNotContained('unresolved symbol', output[1])
+ assert os.path.exists('a.out.js')
def test_toobig(self):
# very large [N x i8], we should not oom in the compiler