diff options
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 2 | ||||
-rw-r--r-- | clang/test/Preprocessor/if_warning.c | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 502da738425..be4da35f938 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -268,7 +268,7 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc, // #else directive in a skipping conditional. If not in some other // skipping conditional, and if #else hasn't already been seen, enter it // as a non-skipping conditional. - CheckEndOfDirective("else"); + DiscardUntilEndOfDirective(); // C99 6.10p4. PPConditionalInfo &CondInfo = CurPPLexer->peekConditionalLevel(); // If this is a #else with a #else before it, report the error. diff --git a/clang/test/Preprocessor/if_warning.c b/clang/test/Preprocessor/if_warning.c index acb6d5ea422..5fc8c347a6c 100644 --- a/clang/test/Preprocessor/if_warning.c +++ b/clang/test/Preprocessor/if_warning.c @@ -11,3 +11,10 @@ extern int x; #if defined(foo) #endif + +// PR3938 +#if 0 +#ifdef D +#else 1 // Should not warn due to C99 6.10p4 +#endif +#endif |