]> granicus.if.org Git - clang/commitdiff
Fix PR3938 by taking into account C99 6.10p4.
authorChris Lattner <sabre@nondot.org>
Sat, 18 Apr 2009 01:34:22 +0000 (01:34 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 18 Apr 2009 01:34:22 +0000 (01:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69413 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PPDirectives.cpp
test/Preprocessor/if_warning.c

index 502da7384258d135f7f1055c581a1cf34b328970..be4da35f938d8442530a78c785b28694c8150881 100644 (file)
@@ -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.
index acb6d5ea422de92e2eba40c01f79ce7d8c7220d2..5fc8c347a6c4274e1e8f5effda0189ab64d254b5 100644 (file)
@@ -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