summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPExpressions.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2013-07-23 00:25:18 +0000
committerEli Friedman <eli.friedman@gmail.com>2013-07-23 00:25:18 +0000
commit088d39afc6c4fbaadb25fc31e733de2ce4422cab (patch)
tree79524a848da90b6f5c83a591c4bfeddc3eb888e4 /clang/lib/Lex/PPExpressions.cpp
parent9974c88f7697a569ade90f7b136a2d07e98d9fe0 (diff)
downloadbcm5719-llvm-088d39afc6c4fbaadb25fc31e733de2ce4422cab.tar.gz
bcm5719-llvm-088d39afc6c4fbaadb25fc31e733de2ce4422cab.zip
Integers which are too large should be an error.
Switch some warnings over to errors which should never have been warnings in the first place. (Also, a minor fix to the preprocessor rules for integer literals while I'm here.) llvm-svn: 186903
Diffstat (limited to 'clang/lib/Lex/PPExpressions.cpp')
-rw-r--r--clang/lib/Lex/PPExpressions.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Lex/PPExpressions.cpp b/clang/lib/Lex/PPExpressions.cpp
index 15140697588..5cba35b2af1 100644
--- a/clang/lib/Lex/PPExpressions.cpp
+++ b/clang/lib/Lex/PPExpressions.cpp
@@ -245,7 +245,7 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT,
// Parse the integer literal into Result.
if (Literal.GetIntegerValue(Result.Val)) {
// Overflow parsing integer literal.
- if (ValueLive) PP.Diag(PeekTok, diag::warn_integer_too_large);
+ if (ValueLive) PP.Diag(PeekTok, diag::err_integer_too_large);
Result.Val.setIsUnsigned(true);
} else {
// Set the signedness of the result to match whether there was a U suffix
@@ -257,9 +257,9 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT,
// large that it is unsigned" e.g. on 12345678901234567890 where intmax_t
// is 64-bits.
if (!Literal.isUnsigned && Result.Val.isNegative()) {
- // Don't warn for a hex literal: 0x8000..0 shouldn't warn.
- if (ValueLive && Literal.getRadix() != 16)
- PP.Diag(PeekTok, diag::warn_integer_too_large_for_signed);
+ // Don't warn for a hex or octal literal: 0x8000..0 shouldn't warn.
+ if (ValueLive && Literal.getRadix() == 10)
+ PP.Diag(PeekTok, diag::err_integer_too_large_for_signed);
Result.Val.setIsUnsigned(true);
}
}
OpenPOWER on IntegriCloud