summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Lex/Lexer.cpp4
-rw-r--r--clang/test/Preprocessor/_Pragma.c8
2 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index 3f78be68c13..c2ffd6d4339 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/lib/Lex/Lexer.cpp
@@ -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);
diff --git a/clang/test/Preprocessor/_Pragma.c b/clang/test/Preprocessor/_Pragma.c
index d449dc08b69..9c0c97d1f01 100644
--- a/clang/test/Preprocessor/_Pragma.c
+++ b/clang/test/Preprocessor/_Pragma.c
@@ -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
OpenPOWER on IntegriCloud