diff options
-rw-r--r-- | clang/lib/Lex/Pragma.cpp | 2 | ||||
-rw-r--r-- | clang/test/Preprocessor/_Pragma.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp index 356ab2bc9b3..af65bbfc9b1 100644 --- a/clang/lib/Lex/Pragma.cpp +++ b/clang/lib/Lex/Pragma.cpp @@ -193,7 +193,7 @@ void Preprocessor::Handle_Pragma(Token &Tok) { if (!tok::isStringLiteral(Tok.getKind())) { Diag(PragmaLoc, diag::err__Pragma_malformed); // Skip this token, and the ')', if present. - if (Tok.isNot(tok::r_paren)) + if (Tok.isNot(tok::r_paren) && Tok.isNot(tok::eof)) Lex(Tok); if (Tok.is(tok::r_paren)) Lex(Tok); diff --git a/clang/test/Preprocessor/_Pragma.c b/clang/test/Preprocessor/_Pragma.c index 15725a42229..120e754cb98 100644 --- a/clang/test/Preprocessor/_Pragma.c +++ b/clang/test/Preprocessor/_Pragma.c @@ -11,3 +11,5 @@ _Pragma("message(\"foo \\\\\\\\ bar\")") // expected-warning {{foo \\ bar}} #ifdef macro #error #define invalid #endif + +_Pragma( // expected-error{{_Pragma takes a parenthesized string literal}} |