diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2013-07-23 00:25:18 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2013-07-23 00:25:18 +0000 |
commit | b3da613977f6b77dee2b382eeff5713168a4ca18 (patch) | |
tree | b4eeb45783da55ed2725032a2e3ce9c00c5c25e1 /lib/Lex/PPExpressions.cpp | |
parent | 08bf33aebeb68a98c1ecad0e87a9aa709409e11d (diff) |
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.)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186903 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PPExpressions.cpp')
-rw-r--r-- | lib/Lex/PPExpressions.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Lex/PPExpressions.cpp b/lib/Lex/PPExpressions.cpp index 1514069758..5cba35b2af 100644 --- a/lib/Lex/PPExpressions.cpp +++ b/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); } } |