diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-05-21 04:26:04 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-05-21 04:26:04 +0000 |
commit | 627c14a0684c00be0a40e942bb96bc30962844ae (patch) | |
tree | 15c883671ca4fc84e2ea35bde1dc6f1bc660f9f8 /clang/lib/Lex/PPDirectives.cpp | |
parent | faeb520c973410f930dc09a4d8c955ea50a88d7d (diff) | |
download | bcm5719-llvm-627c14a0684c00be0a40e942bb96bc30962844ae.tar.gz bcm5719-llvm-627c14a0684c00be0a40e942bb96bc30962844ae.zip |
Only ignore extra tokens after #else if we skip it, otherwise warn. Fixes rdar://9475098.
llvm-svn: 131788
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index af3fa6e2add..66e44bbc6dd 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -323,7 +323,6 @@ 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. - DiscardUntilEndOfDirective(); // C99 6.10p4. PPConditionalInfo &CondInfo = CurPPLexer->peekConditionalLevel(); // If this is a #else with a #else before it, report the error. @@ -339,7 +338,10 @@ void Preprocessor::SkipExcludedConditionalBlock(SourceLocation IfTokenLoc, // entered, enter the #else block now. if (!CondInfo.WasSkipping && !CondInfo.FoundNonSkip) { CondInfo.FoundNonSkip = true; + CheckEndOfDirective("else"); break; + } else { + DiscardUntilEndOfDirective(); // C99 6.10p4. } } else if (Sub == "lif") { // "elif". PPConditionalInfo &CondInfo = CurPPLexer->peekConditionalLevel(); |