]> granicus.if.org Git - clang/commitdiff
Tighten format string diagnostic and make it a bit clearer (and a bit closer to GCC's).
authorTed Kremenek <kremenek@apple.com>
Fri, 20 Jan 2012 21:52:58 +0000 (21:52 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 20 Jan 2012 21:52:58 +0000 (21:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148579 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
test/Analysis/taint-generic.c
test/Sema/block-printf-attribute-1.c
test/Sema/format-strings-c90.c
test/Sema/format-strings-int-typedefs.c
test/Sema/format-strings-scanf.c
test/Sema/format-strings-size_t.c
test/Sema/format-strings.c
test/Sema/no-format-y2k-turnsoff-format.c
test/SemaCXX/format-strings-0x.cpp
test/SemaObjC/format-strings-objc.m

index 41e723722fdc3947e91477c563dc438eca7da6bb..f685c9f2b759d1ab1b693bc58ceb7c6aed0cce15 100644 (file)
@@ -4791,7 +4791,7 @@ def warn_scanf_nonzero_width : Warning<
   "zero field width in scanf format string is unused">,
   InGroup<Format>;
 def warn_printf_conversion_argument_type_mismatch : Warning<
-  "conversion specifies type %0 but the argument has type %1">,
+  "format specifies type %0 but the argument has type %1">,
   InGroup<Format>;
 def warn_printf_positional_arg_exceeds_data_args : Warning <
   "data argument position '%0' exceeds the number of data arguments (%1)">,
index 65e519e6ae3adce3d3fbb29302f6a63374f51086..be20f2c24f600dfcfbc85a329f3b96e3548a84dc 100644 (file)
@@ -65,7 +65,7 @@ void bufferScanfAssignment(int x) {
 
 void scanfArg() {
   int t = 0;
-  scanf("%d", t); // expected-warning {{conversion specifies type 'int *' but the argument has type 'int'}}
+  scanf("%d", t); // expected-warning {{format specifies type 'int *' but the argument has type 'int'}}
 }
 
 void bufferGetchar(int x) {
index c19b3788a3a42b8f88646cb990a52d4d14aecb9d..8188ba5b55f4b3ee43359385fdd1b6b3a6e8e540 100644 (file)
@@ -6,6 +6,6 @@ int main() {
  
   void (^z) (int arg, const char * format, ...) __attribute__ ((__format__ (__printf__, 2, 3))) = ^ __attribute__ ((__format__ (__printf__, 2, 3))) (int arg, const char * format, ...) {};
 
-  z(1, "%s", 1); // expected-warning{{conversion specifies type 'char *' but the argument has type 'int'}}
+  z(1, "%s", 1); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
   z(1, "%s", "HELLO"); // no-warning
 }
index 678a6ef373a6ecf0604dd65524a6b3644075b995..0b32e82d872335cb48b6189580d380fa342b7f29 100644 (file)
@@ -21,7 +21,7 @@ void foo(char **sp, float *fp, int *ip) {
   scanf("%da", ip);
 
   /* Test argument type check for the 'a' length modifier. */
-  scanf("%as", fp); /* expected-warning{{conversion specifies type 'char **' but the argument has type 'float *'}} */
-  scanf("%aS", fp); /* expected-warning{{conversion specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'}} */
-  scanf("%a[abc]", fp); /* expected-warning{{conversion specifies type 'char **' but the argument has type 'float *'}} */
+  scanf("%as", fp); /* expected-warning{{format specifies type 'char **' but the argument has type 'float *'}} */
+  scanf("%aS", fp); /* expected-warning{{format specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'}} */
+  scanf("%a[abc]", fp); /* expected-warning{{format specifies type 'char **' but the argument has type 'float *'}} */
 }
index 8d5dff1523481179d6adf855df7adb8ccc29a0a2..341d49c500f43d962fba80a4ca5c7d59a8c01e87 100644 (file)
@@ -4,23 +4,23 @@ int printf(char const *, ...);
 int scanf(char const *, ...);
 
 void test(void) {
-  printf("%jd", 42.0); // expected-warning {{conversion specifies type 'intmax_t' (aka 'long long')}}
-  printf("%ju", 42.0); // expected-warning {{conversion specifies type 'uintmax_t' (aka 'unsigned long long')}}
-  printf("%zu", 42.0); // expected-warning {{conversion specifies type 'size_t' (aka 'unsigned long')}}
-  printf("%td", 42.0); // expected-warning {{conversion specifies type 'ptrdiff_t' (aka 'int')}}
-  printf("%lc", 42.0); // expected-warning {{conversion specifies type 'wint_t' (aka 'int')}}
-  printf("%ls", 42.0); // expected-warning {{conversion specifies type 'wchar_t *' (aka 'int *')}}
-  printf("%S", 42.0);  // expected-warning {{conversion specifies type 'wchar_t *' (aka 'int *')}}
-  printf("%C", 42.0);  // expected-warning {{conversion specifies type 'wchar_t' (aka 'int')}}
+  printf("%jd", 42.0); // expected-warning {{format specifies type 'intmax_t' (aka 'long long')}}
+  printf("%ju", 42.0); // expected-warning {{format specifies type 'uintmax_t' (aka 'unsigned long long')}}
+  printf("%zu", 42.0); // expected-warning {{format specifies type 'size_t' (aka 'unsigned long')}}
+  printf("%td", 42.0); // expected-warning {{format specifies type 'ptrdiff_t' (aka 'int')}}
+  printf("%lc", 42.0); // expected-warning {{format specifies type 'wint_t' (aka 'int')}}
+  printf("%ls", 42.0); // expected-warning {{format specifies type 'wchar_t *' (aka 'int *')}}
+  printf("%S", 42.0);  // expected-warning {{format specifies type 'wchar_t *' (aka 'int *')}}
+  printf("%C", 42.0);  // expected-warning {{format specifies type 'wchar_t' (aka 'int')}}
 
-  scanf("%jd", 0); // expected-warning {{conversion specifies type 'intmax_t *' (aka 'long long *')}}
-  scanf("%ju", 0); // expected-warning {{conversion specifies type 'uintmax_t *' (aka 'unsigned long long *')}}
-  scanf("%zu", 0); // expected-warning {{conversion specifies type 'size_t *' (aka 'unsigned long *')}}
-  scanf("%td", 0); // expected-warning {{conversion specifies type 'ptrdiff_t *' (aka 'int *')}}
-  scanf("%lc", 0); // expected-warning {{conversion specifies type 'wchar_t *' (aka 'int *')}}
-  scanf("%ls", 0); // expected-warning {{conversion specifies type 'wchar_t *' (aka 'int *')}}
-  scanf("%S",  0);  // expected-warning {{conversion specifies type 'wchar_t *' (aka 'int *')}}
-  scanf("%C",  0);  // expected-warning {{conversion specifies type 'wchar_t *' (aka 'int *')}}
+  scanf("%jd", 0); // expected-warning {{format specifies type 'intmax_t *' (aka 'long long *')}}
+  scanf("%ju", 0); // expected-warning {{format specifies type 'uintmax_t *' (aka 'unsigned long long *')}}
+  scanf("%zu", 0); // expected-warning {{format specifies type 'size_t *' (aka 'unsigned long *')}}
+  scanf("%td", 0); // expected-warning {{format specifies type 'ptrdiff_t *' (aka 'int *')}}
+  scanf("%lc", 0); // expected-warning {{format specifies type 'wchar_t *' (aka 'int *')}}
+  scanf("%ls", 0); // expected-warning {{format specifies type 'wchar_t *' (aka 'int *')}}
+  scanf("%S",  0);  // expected-warning {{format specifies type 'wchar_t *' (aka 'int *')}}
+  scanf("%C",  0);  // expected-warning {{format specifies type 'wchar_t *' (aka 'int *')}}
 
 
   // typedef size_t et al. to something crazy.
@@ -30,8 +30,8 @@ void test(void) {
   typedef void *ptrdiff_t;
 
   // The warning still fires, because it checks the underlying type.
-  printf("%jd", (intmax_t)42); // expected-warning {{conversion specifies type 'intmax_t' (aka 'long long') but the argument has type 'intmax_t' (aka 'void *')}}
-  printf("%ju", (uintmax_t)42); // expected-warning {{conversion specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'void *')}}
-  printf("%zu", (size_t)42); // expected-warning {{conversion specifies type 'size_t' (aka 'unsigned long') but the argument has type 'size_t' (aka 'void *')}}
-  printf("%td", (ptrdiff_t)42); // expected-warning {{conversion specifies type 'ptrdiff_t' (aka 'int') but the argument has type 'ptrdiff_t' (aka 'void *')}}
+  printf("%jd", (intmax_t)42); // expected-warning {{format specifies type 'intmax_t' (aka 'long long') but the argument has type 'intmax_t' (aka 'void *')}}
+  printf("%ju", (uintmax_t)42); // expected-warning {{format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'void *')}}
+  printf("%zu", (size_t)42); // expected-warning {{format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'size_t' (aka 'void *')}}
+  printf("%td", (ptrdiff_t)42); // expected-warning {{format specifies type 'ptrdiff_t' (aka 'int') but the argument has type 'ptrdiff_t' (aka 'void *')}}
 }
index be70357560ca94809f49a2d821260ff443c8c357..e954958c523c8e7e5c3570dd1cda07bef2ee60a1 100644 (file)
@@ -59,9 +59,9 @@ void test_variants(int *i, const char *s, ...) {
   FILE *f = 0;
   char buf[100];
 
-  fscanf(f, "%ld", i); // expected-warning{{conversion specifies type 'long *' but the argument has type 'int *'}}
-  sscanf(buf, "%ld", i); // expected-warning{{conversion specifies type 'long *' but the argument has type 'int *'}}
-  my_scanf("%ld", i); // expected-warning{{conversion specifies type 'long *' but the argument has type 'int *'}}
+  fscanf(f, "%ld", i); // expected-warning{{format specifies type 'long *' but the argument has type 'int *'}}
+  sscanf(buf, "%ld", i); // expected-warning{{format specifies type 'long *' but the argument has type 'int *'}}
+  my_scanf("%ld", i); // expected-warning{{format specifies type 'long *' but the argument has type 'int *'}}
 
   va_list ap;
   va_start(ap, s);
@@ -72,7 +72,7 @@ void test_variants(int *i, const char *s, ...) {
 }
 
 void test_scanlist(int *ip, char *sp) {
-  scanf("%[abc]", ip); // expected-warning{{conversion specifies type 'char *' but the argument has type 'int *'}}
+  scanf("%[abc]", ip); // expected-warning{{format specifies type 'char *' but the argument has type 'int *'}}
   scanf("%h[abc]", sp); // expected-warning{{length modifier 'h' results in undefined behavior or no effect with '[' conversion specifier}}
 }
 
@@ -80,9 +80,9 @@ void test_alloc_extension(char **sp, wchar_t **lsp, float *fp) {
   /* Make sure "%a" gets parsed as a conversion specifier for float,
    * even when followed by an 's', 'S' or '[', which would cause it to be
    * parsed as a length modifier in C90. */
-  scanf("%as", sp); // expected-warning{{conversion specifies type 'float *' but the argument has type 'char **'}}
-  scanf("%aS", lsp); // expected-warning{{conversion specifies type 'float *' but the argument has type 'wchar_t **'}}
-  scanf("%a[bcd]", sp); // expected-warning{{conversion specifies type 'float *' but the argument has type 'char **'}}
+  scanf("%as", sp); // expected-warning{{format specifies type 'float *' but the argument has type 'char **'}}
+  scanf("%aS", lsp); // expected-warning{{format specifies type 'float *' but the argument has type 'wchar_t **'}}
+  scanf("%a[bcd]", sp); // expected-warning{{format specifies type 'float *' but the argument has type 'char **'}}
 
   // Test that the 'm' length modifier is only allowed with s, S, c, C or [.
   // TODO: Warn that 'm' is an extension.
@@ -94,9 +94,9 @@ void test_alloc_extension(char **sp, wchar_t **lsp, float *fp) {
   scanf("%md", sp); // expected-warning{{length modifier 'm' results in undefined behavior or no effect with 'd' conversion specifier}}
 
   // Test argument type check for the 'm' length modifier.
-  scanf("%ms", fp); // expected-warning{{conversion specifies type 'char **' but the argument has type 'float *'}}
-  scanf("%mS", fp); // expected-warning{{conversion specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'}}
-  scanf("%mc", fp); // expected-warning{{conversion specifies type 'char **' but the argument has type 'float *'}}
-  scanf("%mC", fp); // expected-warning{{conversion specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'}}
-  scanf("%m[abc]", fp); // expected-warning{{conversion specifies type 'char **' but the argument has type 'float *'}}
+  scanf("%ms", fp); // expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
+  scanf("%mS", fp); // expected-warning{{format specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'}}
+  scanf("%mc", fp); // expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
+  scanf("%mC", fp); // expected-warning{{format specifies type 'wchar_t **' (aka 'int **') but the argument has type 'float *'}}
+  scanf("%m[abc]", fp); // expected-warning{{format specifies type 'char **' but the argument has type 'float *'}}
 }
index 2f6a25f66e80db3fc15fbb4e36674d75a35d992d..7f88ff38c302490daa328102eeb26dedba2ec9a3 100644 (file)
@@ -4,12 +4,12 @@ int printf(char const *, ...);
 
 void test(void) {
   // size_t
-  printf("%zu", (double)42); // expected-warning {{conversion specifies type 'size_t' (aka 'unsigned long') but the argument has type 'double'}}
+  printf("%zu", (double)42); // expected-warning {{format specifies type 'size_t' (aka 'unsigned long') but the argument has type 'double'}}
 
   // intmax_t / uintmax_t
-  printf("%jd", (double)42); // expected-warning {{conversion specifies type 'intmax_t' (aka 'long') but the argument has type 'double'}}
-  printf("%ju", (double)42); // expected-warning {{conversion specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'double'}}
+  printf("%jd", (double)42); // expected-warning {{format specifies type 'intmax_t' (aka 'long') but the argument has type 'double'}}
+  printf("%ju", (double)42); // expected-warning {{format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'double'}}
 
   // ptrdiff_t
-  printf("%td", (double)42); // expected-warning {{conversion specifies type 'ptrdiff_t' (aka 'long') but the argument has type 'double'}}
+  printf("%td", (double)42); // expected-warning {{format specifies type 'ptrdiff_t' (aka 'long') but the argument has type 'double'}}
 }
index c4bbc836d458b8a73e4df7e0ee0895afc372f3d9..e32ad245e37afeba756079138207037c27ebdf5e 100644 (file)
@@ -71,8 +71,8 @@ void check_invalid_specifier(FILE* fp, char *buf)
 {
   printf("%s%lb%d","unix",10,20); // expected-warning {{invalid conversion specifier 'b'}}
   fprintf(fp,"%%%l"); // expected-warning {{incomplete format specifier}}
-  sprintf(buf,"%%%%%ld%d%d", 1, 2, 3); // expected-warning{{conversion specifies type 'long' but the argument has type 'int'}}
-  snprintf(buf, 2, "%%%%%ld%;%d", 1, 2, 3); // expected-warning{{conversion specifies type 'long' but the argument has type 'int'}} expected-warning {{invalid conversion specifier ';'}}
+  sprintf(buf,"%%%%%ld%d%d", 1, 2, 3); // expected-warning{{format specifies type 'long' but the argument has type 'int'}}
+  snprintf(buf, 2, "%%%%%ld%;%d", 1, 2, 3); // expected-warning{{format specifies type 'long' but the argument has type 'int'}} expected-warning {{invalid conversion specifier ';'}}
 }
 
 void check_null_char_string(char* b)
@@ -166,33 +166,33 @@ void test10(int x, float f, int i, long long lli) {
   printf("%"); // expected-warning{{incomplete format specifier}}
   printf("%.d", x); // no-warning
   printf("%.", x);  // expected-warning{{incomplete format specifier}}
-  printf("%f", 4); // expected-warning{{conversion specifies type 'double' but the argument has type 'int'}}
+  printf("%f", 4); // expected-warning{{format specifies type 'double' but the argument has type 'int'}}
   printf("%qd", lli);
   printf("hhX %hhX", (unsigned char)10); // no-warning
   printf("llX %llX", (long long) 10); // no-warning
   // This is fine, because there is an implicit conversion to an int.
   printf("%d", (unsigned char) 10); // no-warning
-  printf("%d", (long long) 10); // expected-warning{{conversion specifies type 'int' but the argument has type 'long long'}}
+  printf("%d", (long long) 10); // expected-warning{{format specifies type 'int' but the argument has type 'long long'}}
   printf("%Lf\n", (long double) 1.0); // no-warning
-  printf("%f\n", (long double) 1.0); // expected-warning{{conversion specifies type 'double' but the argument has type 'long double'}}
+  printf("%f\n", (long double) 1.0); // expected-warning{{format specifies type 'double' but the argument has type 'long double'}}
   // The man page says that a zero precision is okay.
   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("%c\n", "x"); // expected-warning{{format specifies type 'int' but the argument has type 'char *'}}
+  printf("%c\n", 1.23); // expected-warning{{format 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;
 
 void should_understand_small_integers() {
-  printf("%hhu", (short) 10); // expected-warning{{conversion specifies type 'unsigned char' but the argument has type 'short'}}
-  printf("%hu\n", (unsigned char) 1); // expected-warning{{conversion specifies type 'unsigned short' but the argument has type 'unsigned char'}}
-  printf("%hu\n", (uint8_t)1); // expected-warning{{conversion specifies type 'unsigned short' but the argument has type 'uint8_t'}}
+  printf("%hhu", (short) 10); // expected-warning{{format specifies type 'unsigned char' but the argument has type 'short'}}
+  printf("%hu\n", (unsigned char) 1); // expected-warning{{format specifies type 'unsigned short' but the argument has type 'unsigned char'}}
+  printf("%hu\n", (uint8_t)1); // expected-warning{{format specifies type 'unsigned short' but the argument has type 'uint8_t'}}
 }
 
 void test11(void *p, char *s) {
   printf("%p", p); // no-warning
-  printf("%p", 123); // expected-warning{{conversion specifies type 'void *' but the argument has type 'int'}}
+  printf("%p", 123); // expected-warning{{format specifies type 'void *' but the argument has type 'int'}}
   printf("%.4p", p); // expected-warning{{precision used with 'p' conversion specifier, resulting in undefined behavior}}
   printf("%+p", p); // expected-warning{{flag '+' results in undefined behavior with 'p' conversion specifier}}
   printf("% p", p); // expected-warning{{flag ' ' results in undefined behavior with 'p' conversion specifier}}
@@ -206,16 +206,16 @@ void test11(void *p, char *s) {
 void test12(char *b) {
   unsigned char buf[4];
   printf ("%.4s\n", buf); // no-warning
-  printf ("%.4s\n", &buf); // expected-warning{{conversion specifies type 'char *' but the argument has type 'unsigned char (*)[4]'}}
+  printf ("%.4s\n", &buf); // expected-warning{{format specifies type 'char *' but the argument has type 'unsigned char (*)[4]'}}
   
   // Verify that we are checking asprintf
-  asprintf(&b, "%d", "asprintf"); // expected-warning{{conversion specifies type 'int' but the argument has type 'char *'}}
+  asprintf(&b, "%d", "asprintf"); // expected-warning{{format specifies type 'int' but the argument has type 'char *'}}
 }
 
 void test13(short x) {
   char bel = 007;
   printf("bel: '0%hhd'\n", bel); // no-warning
-  printf("x: '0%hhd'\n", x); // expected-warning {{conversion specifies type 'char' but the argument has type 'short'}}
+  printf("x: '0%hhd'\n", x); // expected-warning {{format specifies type 'char' but the argument has type 'short'}}
 }
 
 typedef struct __aslclient *aslclient;
@@ -237,7 +237,7 @@ typedef __WCHAR_TYPE__ wchar_t;
 
 void test_unicode_conversions(wchar_t *s) {
   printf("%S", s); // no-warning
-  printf("%s", s); // expected-warning{{conversion specifies type 'char *' but the argument has type 'wchar_t *'}}
+  printf("%s", s); // expected-warning{{format specifies type 'char *' but the argument has type 'wchar_t *'}}
   printf("%C", s[0]); // no-warning
   printf("%c", s[0]);
   // FIXME: This test reports inconsistent results. On Windows, '%C' expects
@@ -255,7 +255,7 @@ void test_positional_arguments() {
   printf("%1$*0$d", (int) 2); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}}
   printf("%1$d", (int) 2); // no-warning
   printf("%1$d", (int) 2, 2); // expected-warning{{data argument not used by format string}}
-  printf("%1$d%1$f", (int) 2); // expected-warning{{conversion specifies type 'double' but the argument has type 'int'}}
+  printf("%1$d%1$f", (int) 2); // expected-warning{{format specifies type 'double' but the argument has type 'int'}}
   printf("%1$2.2d", (int) 2); // no-warning
   printf("%2$*1$.2d", (int) 2, (int) 3); // no-warning
   printf("%2$*8$d", (int) 2, (int) 3); // expected-warning{{specified field width is missing a matching 'int' argument}}
@@ -267,13 +267,13 @@ void test_positional_arguments() {
 void myprintf_PR_6697(const char *format, int x, ...) __attribute__((__format__(printf,1, 3)));
 void test_pr_6697() {
   myprintf_PR_6697("%s\n", 1, "foo"); // no-warning
-  myprintf_PR_6697("%s\n", 1, (int)0); // expected-warning{{conversion specifies type 'char *' but the argument has type 'int'}}
+  myprintf_PR_6697("%s\n", 1, (int)0); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
   // FIXME: Not everything should clearly support positional arguments,
   // but we need a way to identify those cases.
   myprintf_PR_6697("%1$s\n", 1, "foo"); // no-warning
   myprintf_PR_6697("%2$s\n", 1, "foo"); // expected-warning{{data argument position '2' exceeds the number of data arguments (1)}}
   myprintf_PR_6697("%18$s\n", 1, "foo"); // expected-warning{{data argument position '18' exceeds the number of data arguments (1)}}
-  myprintf_PR_6697("%1$s\n", 1, (int) 0); // expected-warning{{conversion specifies type 'char *' but the argument has type 'int'}}
+  myprintf_PR_6697("%1$s\n", 1, (int) 0); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
 }
 
 void rdar8026030(FILE *fp) {
@@ -359,7 +359,7 @@ void posix_extensions() {
 #pragma GCC diagnostic ignored "-Wformat-security"
 
 void pr8486() {
-  printf("%s", 1); // expected-warning{{conversion specifies type 'char *' but the argument has type 'int'}}
+  printf("%s", 1); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
 }
 
 // PR9314
@@ -372,7 +372,7 @@ void pr9314() {
 int printf(const char * restrict, ...) __attribute__((__format__ (__printf__, 1, 2)));
 
 void rdar9612060(void) {
-  printf("%s", 2); // expected-warning{{conversion specifies type 'char *' but the argument has type 'int'}}
+  printf("%s", 2); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
 }
 
 void check_char(unsigned char x, signed char y) {
@@ -421,8 +421,8 @@ void pr9751() {
   printf("%.", 5); // expected-warning{{incomplete format specifier}}
 
   const char kFormat6[] = "%s"; // expected-note{{format string is defined here}}
-  printf(kFormat6, 5); // expected-warning{{conversion specifies type 'char *' but the argument has type 'int'}}
-  printf("%s", 5); // expected-warning{{conversion specifies type 'char *' but the argument has type 'int'}}
+  printf(kFormat6, 5); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
+  printf("%s", 5); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}}
 
   const char kFormat7[] = "%0$"; // expected-note{{format string is defined here}}
   printf(kFormat7, 5); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}}
index bd06e506ce099300e1b7136857d5c0e066f2112f..b206ecdfc155c8425c254bdc31ebe75e3c8b57c7 100644 (file)
@@ -4,6 +4,6 @@
 void foo(const char *, ...) __attribute__((__format__ (__printf__, 1, 2)));
 
 void bar(unsigned int a) {
-        foo("%s", a); // expected-warning {{conversion specifies type 'char *' but the argument has type 'unsigned int'}}
+        foo("%s", a); // expected-warning {{format specifies type 'char *' but the argument has type 'unsigned int'}}
 }
 
index 61bdbe188def53118cad77e2ff024b425b72309c..9359c7b1f99aaaddb38fdafb1c43cd5d11dfbe35 100644 (file)
@@ -6,7 +6,7 @@ extern int printf(const char *restrict, ...);
 }
 
 void f(char **sp, float *fp) {
-  scanf("%as", sp); // expected-warning{{conversion specifies type 'float *' but the argument has type 'char **'}}
+  scanf("%as", sp); // expected-warning{{format specifies type 'float *' but the argument has type 'char **'}}
 
   printf("%a", 1.0);
   scanf("%afoobar", fp);
index 29e3a3f49657be653d44c5727fb327902d410749..3fb7c9e435190a7c0cf57f90fb357e3c6a6bfe4d 100644 (file)
@@ -47,8 +47,8 @@ extern void CFStringCreateWithFormat2(int *format, ...) __attribute__((format(CF
 // <rdar://problem/7068334> - Catch use of long long with int arguments.
 void rdar_7068334() {
   long long test = 500;  
-  printf("%i ",test); // expected-warning{{conversion specifies type 'int' but the argument has type 'long long'}}
-  NSLog(@"%i ",test); // expected-warning{{conversion specifies type 'int' but the argument has type 'long long'}}
+  printf("%i ",test); // expected-warning{{format specifies type 'int' but the argument has type 'long long'}}
+  NSLog(@"%i ",test); // expected-warning{{format specifies type 'int' but the argument has type 'long long'}}
 }
 
 // <rdar://problem/7697748>