[cfe-commits] r69413 - in /cfe/trunk: lib/Lex/PPDirectives.cpp test/Preprocessor/if_warning.c
Chris Lattner
sabre at nondot.org
Fri Apr 17 18:34:22 PDT 2009
Author: lattner
Date: Fri Apr 17 20:34:22 2009
New Revision: 69413
URL: http://llvm.org/viewvc/llvm-project?rev=69413&view=rev
Log:
Fix PR3938 by taking into account C99 6.10p4.
Modified:
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/test/Preprocessor/if_warning.c
Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=69413&r1=69412&r2=69413&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Fri Apr 17 20:34:22 2009
@@ -268,7 +268,7 @@
// #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.
Modified: cfe/trunk/test/Preprocessor/if_warning.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/if_warning.c?rev=69413&r1=69412&r2=69413&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/if_warning.c (original)
+++ cfe/trunk/test/Preprocessor/if_warning.c Fri Apr 17 20:34:22 2009
@@ -11,3 +11,10 @@
#if defined(foo)
#endif
+
+// PR3938
+#if 0
+#ifdef D
+#else 1 // Should not warn due to C99 6.10p4
+#endif
+#endif
More information about the cfe-commits
mailing list