[cfe-commits] r91888 - in /cfe/trunk: lib/Sema/SemaChecking.cpp test/Sema/format-strings.c
Chris Lattner
sabre at nondot.org
Mon Dec 21 22:00:13 PST 2009
Author: lattner
Date: Tue Dec 22 00:00:13 2009
New Revision: 91888
URL: http://llvm.org/viewvc/llvm-project?rev=91888&view=rev
Log:
fix a bug handling the gnu ?: extension. Patch by Storlek on IRC,
who prefers to be stealthy and mysterious.
Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/Sema/format-strings.c
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=91888&r1=91887&r2=91888&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Tue Dec 22 00:00:13 2009
@@ -800,7 +800,7 @@
switch (E->getStmtClass()) {
case Stmt::ConditionalOperatorClass: {
const ConditionalOperator *C = cast<ConditionalOperator>(E);
- return SemaCheckStringLiteral(C->getLHS(), TheCall,
+ return SemaCheckStringLiteral(C->getTrueExpr(), TheCall,
HasVAListArg, format_idx, firstDataArg)
&& SemaCheckStringLiteral(C->getRHS(), TheCall,
HasVAListArg, format_idx, firstDataArg);
Modified: cfe/trunk/test/Sema/format-strings.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/format-strings.c?rev=91888&r1=91887&r2=91888&view=diff
==============================================================================
--- cfe/trunk/test/Sema/format-strings.c (original)
+++ cfe/trunk/test/Sema/format-strings.c Tue Dec 22 00:00:13 2009
@@ -50,6 +50,7 @@
printf(i == 1 ? "yes" : "no"); // no-warning
printf(i == 0 ? (i == 1 ? "yes" : "no") : "dont know"); // no-warning
printf(i == 0 ? (i == 1 ? s : "no") : "dont know"); // expected-warning{{format string is not a string literal}}
+ printf("yes" ?: "no %d", 1); // expected-warning{{more data arguments than '%' conversions}}
}
void check_writeback_specifier()
More information about the cfe-commits
mailing list