summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPDirectives.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-05-21 04:26:04 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-05-21 04:26:04 +0000
commit627c14a0684c00be0a40e942bb96bc30962844ae (patch)
tree15c883671ca4fc84e2ea35bde1dc6f1bc660f9f8 /clang/lib/Lex/PPDirectives.cpp
parentfaeb520c973410f930dc09a4d8c955ea50a88d7d (diff)
downloadbcm5719-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.cpp4
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();
OpenPOWER on IntegriCloud