[cfe-commits] r69422 - in /cfe/trunk: include/clang/Basic/DiagnosticLexKinds.td lib/Lex/PPDirectives.cpp test/Preprocessor/line-directive.c

Chris Lattner sabre at nondot.org
Fri Apr 17 23:38:25 PDT 2009


Author: lattner
Date: Sat Apr 18 01:38:24 2009
New Revision: 69422

URL: http://llvm.org/viewvc/llvm-project?rev=69422&view=rev
Log:
second half of PR3940: #line requires simple digit sequence.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
    cfe/trunk/lib/Lex/PPDirectives.cpp
    cfe/trunk/test/Preprocessor/line-directive.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=69422&r1=69421&r2=69422&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Sat Apr 18 01:38:24 2009
@@ -229,6 +229,8 @@
   "invalid filename for #line directive">;
 def warn_pp_line_decimal : Warning<
   "#line directive requires decimal line number">;
+def warn_pp_line_digit_sequence : Warning<
+  "#line directive requires a simple digit sequence">;
 def err_pp_linemarker_requires_integer : Error<
   "line marker directive requires a positive integer argument">;
 def err_pp_linemarker_invalid_filename : Error<

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=69422&r1=69421&r2=69422&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Sat Apr 18 01:38:24 2009
@@ -654,7 +654,8 @@
   // because it is octal.
   if (Literal.getRadix() != 10) 
     PP.Diag(DigitTok, diag::warn_pp_line_decimal);
-  
+  else if (Literal.hasSuffix())
+    PP.Diag(DigitTok, diag::warn_pp_line_digit_sequence);
   return false;
 }
 

Modified: cfe/trunk/test/Preprocessor/line-directive.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/line-directive.c?rev=69422&r1=69421&r2=69422&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/line-directive.c (original)
+++ cfe/trunk/test/Preprocessor/line-directive.c Sat Apr 18 01:38:24 2009
@@ -70,3 +70,6 @@
 
 // PR3940
 #line 0xf  // expected-warning {{#line directive requires decimal line number}}
+#line 42U  // expected-warning {{#line directive requires a simple digit sequence}}
+
+





More information about the cfe-commits mailing list