aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-07-17 18:48:50 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-07-17 18:48:50 -0700
commit2acb8de3405c4a23b636dd86b66cda4fb7964b0d (patch)
tree1df13ea7ce21cbc6af5767c3c8964a7e43b79b93
parent1f4ad8a57b7762e9db3209fd84cedeb54cb8336d (diff)
use compiler opts in -E, to use our target, system dirs, etc.; fixes #2534
-rwxr-xr-xemcc2
-rw-r--r--tests/test_other.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/emcc b/emcc
index 8ad2adad..15cfbb7b 100755
--- a/emcc
+++ b/emcc
@@ -744,7 +744,7 @@ if '-M' in sys.argv or '-MM' in sys.argv:
if '-E' in sys.argv:
# Just run the preprocessor
- cmd = [CC] + sys.argv[1:]
+ cmd = [CC] + shared.COMPILER_OPTS + sys.argv[1:]
logging.debug('just preprocessor ' + ' '.join(cmd))
exit(subprocess.call(cmd))
diff --git a/tests/test_other.py b/tests/test_other.py
index 0f71751a..2bbe0a30 100644
--- a/tests/test_other.py
+++ b/tests/test_other.py
@@ -3086,6 +3086,13 @@ minor: %d
tiny: %d
''' % (EMSCRIPTEN_VERSION_MAJOR, EMSCRIPTEN_VERSION_MINOR, EMSCRIPTEN_VERSION_TINY), run_js('a.out.js'))
+ def test_dashE(self):
+ open('src.cpp', 'w').write(r'''#include <emscripten.h>
+EMSCRIPTEN_KEEPALIVE __EMSCRIPTEN_major__ __EMSCRIPTEN_minor__ __EMSCRIPTEN_tiny__ EMSCRIPTEN_KEEPALIVE
+''')
+ out = Popen([PYTHON, EMCC, 'src.cpp', '-E'], stdout=PIPE).communicate()[0]
+ self.assertContained(r'''__attribute__((used)) %d %d %d __attribute__((used))''' % (EMSCRIPTEN_VERSION_MAJOR, EMSCRIPTEN_VERSION_MINOR, EMSCRIPTEN_VERSION_TINY), out)
+
def test_malloc_implicit(self):
open('src.cpp', 'w').write(r'''
#include <stdlib.h>