aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-05-01 08:03:28 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-05-01 08:03:28 -0700
commitab754ce645f4d89fa92e25545523cc9c3c2eff21 (patch)
tree9bb97a7157a11016a21129a0557fb324edbc8843
parent1b2b60f55ad88b170078214b39a589e43c9e1c2d (diff)
warn about inttoptr/ptrtoint in QUANTUM == 1
-rw-r--r--src/parseTools.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 41bb97f8..5cfd20f8 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -978,8 +978,20 @@ function processMathop(item) { with(item) {
return '((' + ident1 + ') & ' + (Math.pow(2, bitsLeft)-1) + ')';
}
case 'select': return ident1 + ' ? ' + ident2 + ' : ' + ident3;
- case 'ptrtoint': return ident1;
- case 'inttoptr': return ident1;
+ case 'ptrtoint': case 'inttoptr': {
+ var ret = '';
+ if (QUANTUM_SIZE == 1) {
+ if (!Debugging.shownPtrtointWarning) {
+ dprint('WARNING: .ll contains ptrtoint and/or inttoptr. These may be dangerous in QUANTUM == 1.');
+ dprint(' The safest thing is to investigate every appearance, and modify the source code to avoid this.');
+ dprint(' Emscripten will print a list of the .ll lines, and also annotate the .js.');
+ Debugging.shownPtrtointWarning = true;
+ }
+ dprint(' ' + op + ' on .ll line ' + item.lineNum);
+ ret = ' /* Warning: ' + op + ', .ll line ' + item.lineNum + ' */';
+ }
+ return ident1 + ret;
+ }
default: throw 'Unknown mathcmp op: ' + item.op;
}
} }