diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-02-04 18:19:37 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-02-04 18:19:37 -0500 |
commit | 1968ba1aa8a899193483c917e8c2534a4836e4fa (patch) | |
tree | 32344c67e35d7bbf410ed66517ac23549fffcc31 /tests/test_other.py | |
parent | 42c6bbe2eaa2f1ceedb8c0b9d4d44bb8b676dcb8 (diff) |
WARN_UNALIGNED option for fastcomp
Diffstat (limited to 'tests/test_other.py')
-rw-r--r-- | tests/test_other.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_other.py b/tests/test_other.py index 47d26416..a6a9c52f 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -2353,3 +2353,24 @@ int main() { err = Popen([PYTHON, EMCC, 'src.cpp', '-include', 'header.h', '-Xclang', '-print-stats'], stderr=PIPE).communicate() assert '*** PCH/Modules Loaded:\nModule: header.h.gch' not in err[1], err[1] + def test_warn_unaligned(self): + if os.environ.get('EMCC_FAST_COMPILER') != '1': return self.skip('need fastcomp') + open('src.cpp', 'w').write(r''' +#include <stdio.h> +static const double grid[4][2] = {{-3 / 3., -1 / 3.}, + {+1 / 3., -3 / 3.}, + {-1 / 3., +3 / 3.}, + {+3 / 3., +1 / 3.}}; +int main() { + for (int i = 0; i < 4; i++) + printf("%d:%.2f,%.2f ", i, grid[i][0], grid[i][1]); + printf("\n"); + return 0; +} +''') + output = Popen([PYTHON, EMCC, 'src.cpp', '-O1', '-s', 'WARN_UNALIGNED=1'], stderr=PIPE).communicate() + assert 'emcc: warning: unaligned store' in output[1] + output = Popen([PYTHON, EMCC, 'src.cpp', '-s', 'WARN_UNALIGNED=1', '-g'], stderr=PIPE).communicate() + assert 'emcc: warning: unaligned store' in output[1] + assert '@line 9 "src.cpp"' in output[1] + |