]> granicus.if.org Git - clang/commitdiff
Fix rdar://6880630 - # in _Pragma does not start a preprocessor directive.
authorChris Lattner <sabre@nondot.org>
Wed, 13 May 2009 06:10:29 +0000 (06:10 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 13 May 2009 06:10:29 +0000 (06:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71643 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/Lexer.cpp
test/Preprocessor/_Pragma.c

index 3f78be68c13a587f0e8571378ca8ac77f382fd02..c2ffd6d4339e68872dad94c9c13e81ebed9f94f9 100644 (file)
@@ -1631,7 +1631,7 @@ LexNextToken:
         // it's actually the start of a preprocessing directive.  Callback to
         // the preprocessor to handle it.
         // FIXME: -fpreprocessed mode??
-        if (Result.isAtStartOfLine() && !LexingRawMode) {
+        if (Result.isAtStartOfLine() && !LexingRawMode && !Is_PragmaLexer) {
           FormTokenWithChars(Result, CurPtr, tok::hash);
           PP->HandleDirective(Result);
           
@@ -1762,7 +1762,7 @@ LexNextToken:
       // it's actually the start of a preprocessing directive.  Callback to
       // the preprocessor to handle it.
       // FIXME: -fpreprocessed mode??
-      if (Result.isAtStartOfLine() && !LexingRawMode) {
+      if (Result.isAtStartOfLine() && !LexingRawMode && !Is_PragmaLexer) {
         FormTokenWithChars(Result, CurPtr, tok::hash);
         PP->HandleDirective(Result);
         
index d449dc08b69b995e8a48c84dcb4f4381b32d87bb..9c0c97d1f011c0670e6d6ac490f84d18ca85c987 100644 (file)
@@ -1,4 +1,10 @@
-// RUN: clang-cc %s -E -verify
+// RUN: clang-cc %s -verify -Wall
 
 _Pragma ("GCC system_header")  // expected-warning {{system_header ignored in main file}}
 
+// rdar://6880630
+_Pragma("#define macro")    // expected-warning {{unknown pragma ignored}}
+
+#ifdef macro
+#error #define invalid
+#endif