diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-18 01:34:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-18 01:34:22 +0000 |
commit | bc63de144fbaea908ac011a3b458fd7ec4a3f645 (patch) | |
tree | 1e3f0690f431d7d9515cd20bbceca3eda5cccea8 | |
parent | b547394ba5ed6dde4ac3c4f990e5e442077b6ae0 (diff) | |
download | bcm5719-llvm-bc63de144fbaea908ac011a3b458fd7ec4a3f645.tar.gz bcm5719-llvm-bc63de144fbaea908ac011a3b458fd7ec4a3f645.zip |
Fix PR3938 by taking into account C99 6.10p4.
llvm-svn: 69413
-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 |