diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-04-11 14:20:39 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-04-11 14:20:39 -0700 |
commit | ca58e841497c9a3f0ee2af91b436000ef8afe8cc (patch) | |
tree | c7b3565e61a813745f760b9480209068dcb362a7 /src | |
parent | 332e7a0ffb65a4b86efa8bb2d10110515feb2d4e (diff) |
show compiler warnings to console, not in source
Diffstat (limited to 'src')
-rw-r--r-- | src/intertyper.js | 2 | ||||
-rw-r--r-- | src/parseTools.js | 15 | ||||
-rw-r--r-- | src/utility.js | 18 |
3 files changed, 17 insertions, 18 deletions
diff --git a/src/intertyper.js b/src/intertyper.js index 26f55392..0f9ce659 100644 --- a/src/intertyper.js +++ b/src/intertyper.js @@ -118,7 +118,7 @@ function intertyper(data, sidePass, baseLineNums) { var func = funcHeader.processItem(tokenizer.processItem({ lineText: currFunctionLines[0], lineNum: currFunctionLineNum }, true))[0]; if (SKIP_STACK_IN_SMALL && /emscripten_autodebug/.exec(func.ident)) { - warn('Disabling SKIP_STACK_IN_SMALL because we are apparently processing autodebugger data'); + warnOnce('Disabling SKIP_STACK_IN_SMALL because we are apparently processing autodebugger data'); SKIP_STACK_IN_SMALL = 0; } diff --git a/src/parseTools.js b/src/parseTools.js index 8c655904..6c3726b0 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1293,17 +1293,11 @@ function makeGetSlabs(ptr, type, allowMultiple, unsigned) { } } else { // USE_TYPED_ARRAYS == 2) if (isPointerType(type)) type = 'i32'; // Hardcoded 32-bit - var warn64 = function() { - warnOnce('.ll contains i64 or double values. These 64-bit values are dangerous in USE_TYPED_ARRAYS == 2. ' + - 'We store i64 as i32, and double as float. This can cause serious problems!'); - }; switch(type) { case 'i1': case 'i8': return [unsigned ? 'HEAPU8' : 'HEAP8']; break; case 'i16': return [unsigned ? 'HEAPU16' : 'HEAP16']; break; - case 'i64': warn64(); - case 'i32': return [unsigned ? 'HEAPU32' : 'HEAP32']; break; - case 'float': return ['HEAPF32']; break; - case 'double': warn64(); return ['HEAPF32']; break; + case 'i32': case 'i64': return [unsigned ? 'HEAPU32' : 'HEAP32']; break; + case 'float': case 'double': return ['HEAPF32']; break; default: { throw 'what, exactly, can we do for unknown types in TA2?! ' + new Error().stack; } @@ -1322,8 +1316,7 @@ function finalizeLLVMFunctionCall(item, noIndexizeFunctions) { var newType = item.type; if (isPossiblyFunctionType(oldType) && isPossiblyFunctionType(newType) && countNormalArgs(oldType) != countNormalArgs(newType)) { - warn('Casting a function pointer type to another with a different number of arguments. See more info in the source (grep for this text). ' + - oldType + ' ==> ' + newType); + warnOnce('Casting a function pointer type to another with a different number of arguments. See more info in the source'); // This may be dangerous as clang generates different code for C and C++ calling conventions. The only problem // case appears to be passing a structure by value, C will have (field1, field2) as function args, and the // function will internally create a structure with that data, while C++ will have (struct* byVal) and it @@ -1417,7 +1410,7 @@ function handleOverflow(text, bits) { // TODO: handle overflows of i64s if (!bits) return text; var correct = correctOverflows(); - warn(!correct || bits <= 32, 'Cannot correct overflows of this many bits: ' + bits + ' at line ' + Framework.currItem.lineNum); + warnOnce(!correct || bits <= 32, 'Cannot correct overflows of this many bits: ' + bits); if (CHECK_OVERFLOWS) return 'CHECK_OVERFLOW(' + text + ', ' + bits + ', ' + Math.floor(correctSpecificOverflow() && !PGO) + ( PGO ? ', "' + Debugging.getIdentifier() + '"' : '' ) + ')'; diff --git a/src/utility.js b/src/utility.js index 31eff100..7d5e0970 100644 --- a/src/utility.js +++ b/src/utility.js @@ -62,15 +62,21 @@ function warn(a, msg) { a = false; } if (!a) { - dprint('Warning: ' + msg); + printErr('Warning: ' + msg); } } -function warnOnce(msg) { - if (!warnOnce.msgs) warnOnce.msgs = {}; - if (msg in warnOnce.msgs) return; - warnOnce.msgs[msg] = true; - dprint('Warning: ' + msg); +function warnOnce(a, msg) { + if (!msg) { + msg = a; + a = false; + } + if (!a) { + if (!warnOnce.msgs) warnOnce.msgs = {}; + if (msg in warnOnce.msgs) return; + warnOnce.msgs[msg] = true; + printErr('Warning: ' + msg); + } } function dedup(items, ident) { |