[cfe-commits] r44120 - in /cfe/trunk: Lex/LiteralSupport.cpp test/Lexer/c90.c

Chris Lattner sabre at nondot.org
Wed Nov 14 08:14:51 PST 2007


Author: lattner
Date: Wed Nov 14 10:14:50 2007
New Revision: 44120

URL: http://llvm.org/viewvc/llvm-project?rev=44120&view=rev
Log:
Fix a bug handling hex floats in c90 mode, pointed out by Neil.

Added:
    cfe/trunk/test/Lexer/c90.c
Modified:
    cfe/trunk/Lex/LiteralSupport.cpp

Modified: cfe/trunk/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Lex/LiteralSupport.cpp?rev=44120&r1=44119&r2=44120&view=diff

==============================================================================
--- cfe/trunk/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/Lex/LiteralSupport.cpp Wed Nov 14 10:14:50 2007
@@ -224,7 +224,7 @@
       }
       // A binary exponent can appear with or with a '.'. If dotted, the
       // binary exponent is required. 
-      if (*s == 'p' || *s == 'P') { 
+      if ((*s == 'p' || *s == 'P') && PP.getLangOptions().HexFloats) { 
         s++;
         saw_exponent = true;
         if (*s == '+' || *s == '-')  s++; // sign

Added: cfe/trunk/test/Lexer/c90.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/c90.c?rev=44120&view=auto

==============================================================================
--- cfe/trunk/test/Lexer/c90.c (added)
+++ cfe/trunk/test/Lexer/c90.c Wed Nov 14 10:14:50 2007
@@ -0,0 +1,5 @@
+// RUN: clang -std=c90 -fsyntax-only %s -verify
+
+enum { cast_hex = (long) (
+      0x0p-1   /* expected-error {{invalid suffix 'p' on integer constant}} */
+     ) };





More information about the cfe-commits mailing list