[cfe-commits] r59865 - in /cfe/trunk/lib/Lex: Lexer.cpp LiteralSupport.cpp
Chris Lattner
sabre at nondot.org
Fri Nov 21 23:39:04 PST 2008
Author: lattner
Date: Sat Nov 22 01:39:03 2008
New Revision: 59865
URL: http://llvm.org/viewvc/llvm-project?rev=59865&view=rev
Log:
Fix a weird inconsistency with hex floats. Previously the lexer
would not eat the "-1" in "0x0p-1", but LiteralSupport would accept
it when extensions are on. This caused strangeness and failures
when hexfloats were properly treated as an extension (not error)
in LiteralSupport.
Modified:
cfe/trunk/lib/Lex/Lexer.cpp
cfe/trunk/lib/Lex/LiteralSupport.cpp
Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=59865&r1=59864&r2=59865&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Sat Nov 22 01:39:03 2008
@@ -574,8 +574,8 @@
return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result));
// If we have a hex FP constant, continue.
- if (Features.HexFloats &&
- (C == '-' || C == '+') && (PrevCh == 'P' || PrevCh == 'p'))
+ if ((C == '-' || C == '+') && (PrevCh == 'P' || PrevCh == 'p') &&
+ (Features.HexFloats || !Features.NoExtensions))
return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result));
// Update the location of token as well as BufferPtr.
Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=59865&r1=59864&r2=59865&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Sat Nov 22 01:39:03 2008
@@ -378,10 +378,8 @@
}
s = first_non_digit;
- if (!PP.getLangOptions().HexFloats) {
+ if (!PP.getLangOptions().HexFloats)
PP.Diag(TokLoc, diag::ext_hexconstant_invalid);
- hadError = true;
- }
} else if (saw_period) {
PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-ThisTokBegin),
diag::err_hexconstant_requires_exponent);
More information about the cfe-commits
mailing list