Index: lib/Lex/Pragma.cpp =================================================================== --- lib/Lex/Pragma.cpp +++ lib/Lex/Pragma.cpp @@ -192,9 +192,7 @@ Lex(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) && Tok.isNot(tok::eof)) - Lex(Tok); + // Skip this token if it's a ')'. if (Tok.is(tok::r_paren)) Lex(Tok); return _PragmaLexing.failed(); Index: test/Preprocessor/_Pragma.c =================================================================== --- test/Preprocessor/_Pragma.c +++ test/Preprocessor/_Pragma.c @@ -12,4 +12,6 @@ #error #define invalid #endif -_Pragma( // expected-error{{_Pragma takes a parenthesized string literal}} +// expected-error@+2{{unterminated conditional directive}} +// expected-error@+1{{expected value in expression}} +#if _Pragma( // expected-error{{_Pragma takes a parenthesized string literal}}