[cfe-commits] r120735 - in /cfe/trunk: lib/Analysis/PrintfFormatString.cpp test/Sema/format-strings.c
Ted Kremenek
kremenek at apple.com
Thu Dec 2 12:57:51 PST 2010
Author: kremenek
Date: Thu Dec 2 14:57:51 2010
New Revision: 120735
URL: http://llvm.org/viewvc/llvm-project?rev=120735&view=rev
Log:
Fix range in printf warnings for invalid conversion specifiers.
Modified:
cfe/trunk/lib/Analysis/PrintfFormatString.cpp
cfe/trunk/test/Sema/format-strings.c
Modified: cfe/trunk/lib/Analysis/PrintfFormatString.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/PrintfFormatString.cpp?rev=120735&r1=120734&r2=120735&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/PrintfFormatString.cpp (original)
+++ cfe/trunk/lib/Analysis/PrintfFormatString.cpp Thu Dec 2 14:57:51 2010
@@ -200,7 +200,7 @@
if (k == ConversionSpecifier::InvalidSpecifier) {
// Assume the conversion takes one argument.
- return !H.HandleInvalidPrintfConversionSpecifier(FS, Beg, I - Beg);
+ return !H.HandleInvalidPrintfConversionSpecifier(FS, Start, I - Start);
}
return PrintfSpecifierResult(Start, FS);
}
Modified: cfe/trunk/test/Sema/format-strings.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/format-strings.c?rev=120735&r1=120734&r2=120735&view=diff
==============================================================================
--- cfe/trunk/test/Sema/format-strings.c (original)
+++ cfe/trunk/test/Sema/format-strings.c Thu Dec 2 14:57:51 2010
@@ -174,6 +174,7 @@
printf("%.0Lf", (long double) 1.0); // no-warning
printf("%c\n", "x"); // expected-warning{{conversion specifies type 'int' but the argument has type 'char *'}}
printf("%c\n", 1.23); // expected-warning{{conversion specifies type 'int' but the argument has type 'double'}}
+ printf("Format %d, is %! %f", 1, 2, 4.4); // expected-warning{{invalid conversion specifier '!'}}
}
typedef unsigned char uint8_t;
More information about the cfe-commits
mailing list