warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘const char *[-Wformat=]
Function test_mismatching_types
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 9
Column 18
9 printf("hello %i", msg); /* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
~^ ~~~
| |
int const char *
%s
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -6,7 +6,7 @@
 
 void test_mismatching_types (const char *msg)
 {
-  printf("hello %i", msg);  /* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
+  printf("hello %s", msg);  /* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
 
 /* { dg-begin-multiline-output "" }
    printf("hello %i", msg);
warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int[-Wformat=]
Function test_mismatching_types
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 20
Column 18
20 printf("hello %s", 42); /* { dg-warning "format '%s' expects argument of type 'char \\*', but argument 2 has type 'int'" } */
~^ ~~
| |
| int
char *
%d
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -17,7 +17,7 @@
    { dg-end-multiline-output "" } */
 
 
-  printf("hello %s", 42);  /* { dg-warning "format '%s' expects argument of type 'char \\*', but argument 2 has type 'int'" } */
+  printf("hello %d", 42);  /* { dg-warning "format '%s' expects argument of type 'char \\*', but argument 2 has type 'int'" } */
 /* { dg-begin-multiline-output "" }
    printf("hello %s", 42);
                  ~^   ~~
warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘long int[-Wformat=]
Function test_mismatching_types
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 30
Column 18
30 printf("hello %i", (long)0); /* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'long int' " } */
~^ ~~~~~~~
| |
int long int
%li
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -27,7 +27,7 @@
                  %d
    { dg-end-multiline-output "" } */
 
-  printf("hello %i", (long)0);  /* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'long int' " } */
+  printf("hello %li", (long)0);  /* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'long int' " } */
 /* { dg-begin-multiline-output "" }
    printf("hello %i", (long)0);
                  ~^   ~~~~~~~
warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int[-Wformat=]
Function test_multiple_arguments
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 42
Column 29
42 printf ("arg0: %i arg1: %s arg 2: %i", /* { dg-warning "29: format '%s'" } */
~^
|
char *
%d
43 100, 101, 102);
~~~
|
int
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -39,7 +39,7 @@
 
 void test_multiple_arguments (void)
 {
-  printf ("arg0: %i  arg1: %s arg 2: %i", /* { dg-warning "29: format '%s'" } */
+  printf ("arg0: %i  arg1: %d arg 2: %i", /* { dg-warning "29: format '%s'" } */
           100, 101, 102);
 /* { dg-begin-multiline-output "" }
    printf ("arg0: %i  arg1: %s arg 2: %i",
warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int[-Wformat=]
Function test_multiple_arguments_2
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 59
Column 29
59 printf ("arg0: %i arg1: %s arg 2: %i", /* { dg-warning "29: format '%s'" } */
~^
|
char *
%d
60 100, i + j, 102);
~~~~~
|
int
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -56,7 +56,7 @@
 
 void test_multiple_arguments_2 (int i, int j)
 {
-  printf ("arg0: %i  arg1: %s arg 2: %i", /* { dg-warning "29: format '%s'" } */
+  printf ("arg0: %i  arg1: %d arg 2: %i", /* { dg-warning "29: format '%s'" } */
           100, i + j, 102);
 /* { dg-begin-multiline-output "" }
    printf ("arg0: %i  arg1: %s arg 2: %i",
warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
Function multiline_format_string
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 75
Column 11
75 printf ("before the fmt specifier" /* { dg-warning "11: format '%d' expects a matching 'int' argument" } */
^~~~~~~~~~~~~~~~~~~~~~~~~~
note: format string is defined here
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 82
Column 12
81 "%"
~~
82 "d" /* { dg-message "12: format string is defined here" } */
~^
|
int
warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘const char *[-Wformat=]
Function test_hex
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 99
Column 21
99 printf("hello \x25\x69", msg); /* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
~~~~^~~~ ~~~
| |
int const char *
\x25s
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -96,7 +96,7 @@
 {
   /* "%" is \x25
      "i" is \x69 */
-  printf("hello \x25\x69", msg);  /* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
+  printf("hello \x25s", msg);  /* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
 
 /* { dg-begin-multiline-output "" }
    printf("hello \x25\x69", msg);
warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘const char *[-Wformat=]
Function test_oct
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 114
Column 21
114 printf("hello \045\151", msg); /* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
~~~~^~~~ ~~~
| |
int const char *
\045s
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -111,7 +111,7 @@
 {
   /* "%" is octal 045
      "i" is octal 151.  */
-  printf("hello \045\151", msg);  /* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
+  printf("hello \045s", msg);  /* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
 
 /* { dg-begin-multiline-output "" }
    printf("hello \045\151", msg);
warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘const char *[-Wformat=]
Function test_multiple
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 129
Column 10
129 printf("prefix" "\x25" "\151" "suffix", /* { dg-warning "format '%i'" } */
^~~~~~~~
130 msg);
~~~
|
const char *
note: format string is defined here
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 129
Column 29
129 printf("prefix" "\x25" "\151" "suffix", /* { dg-warning "format '%i'" } */
~~~~~~~~^~~~
|
int
\x25" "s
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -126,7 +126,7 @@
 {
   /* "%" is \x25 in hex
      "i" is \151 in octal.  */
-  printf("prefix"  "\x25"  "\151"  "suffix",  /* { dg-warning "format '%i'" } */
+  printf("prefix"  "\x25"  "s"  "suffix",  /* { dg-warning "format '%i'" } */
          msg);
 /* { dg-begin-multiline-output "" }
    printf("prefix"  "\x25"  "\151"  "suffix",
warning: pointer targets in passing argument 1 of ‘printf’ differ in signedness [-Wpointer-sign]
Function test_u8
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 151
Column 10
151 printf(u8"hello %i", msg);/* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
^~~~~~~~~~~~
|
unsigned char *
note: expected ‘const char * restrict’ but argument is of type ‘unsigned char *
File ../../src/gcc/testsuite/gcc.dg/format/format.h
Line 110
Column 20
110 extern int printf (const char *restrict, ...);
^~~~~~~~~~~~~~~~~~~~
warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘const char *[-Wformat=]
Function test_u8
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 151
Column 20
151 printf(u8"hello %i", msg);/* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
~^ ~~~
| |
int const char *
%s
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -148,7 +148,7 @@
 
 void test_u8 (const char *msg)
 {
-  printf(u8"hello %i", msg);/* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
+  printf(u8"hello %s", msg);/* { dg-warning "format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
 /* { dg-begin-multiline-output "" }
    printf(u8"hello %i", msg);
                    ~^   ~~~
warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘long int[-Wformat=]
Function test_param
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 163
Column 17
163 printf ("foo %s bar", long_i + long_j); /* { dg-warning "17: format '%s' expects argument of type 'char \\*', but argument 2 has type 'long int'" } */
~^ ~~~~~~~~~~~~~~~
| |
char * long int
%ld
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -160,7 +160,7 @@
 
 void test_param (long long_i, long long_j)
 {
-  printf ("foo %s bar", long_i + long_j); /* { dg-warning "17: format '%s' expects argument of type 'char \\*', but argument 2 has type 'long int'" } */
+  printf ("foo %ld bar", long_i + long_j); /* { dg-warning "17: format '%s' expects argument of type 'char \\*', but argument 2 has type 'long int'" } */
 /* { dg-begin-multiline-output "" }
    printf ("foo %s bar", long_i + long_j);
                 ~^       ~~~~~~~~~~~~~~~
warning: field width specifier ‘*’ expects argument of type ‘int’, but argument 2 has type ‘long int[-Wformat=]
Function test_field_width_specifier
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 175
Column 14
175 printf (" %*.*d ", l, i1, i2); /* { dg-warning "14: field width specifier '\\*' expects argument of type 'int', but argument 2 has type 'long int'" } */
~^~~~ ~
| |
int long int
warning: field width specifier ‘*’ expects argument of type ‘int’, but argument 3 has type ‘long int[-Wformat=]
Function test_field_width_specifier_2
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 188
Column 28
188 __builtin_sprintf (d, " %*ld ", foo, foo); /* { dg-warning "28: field width specifier '\\*' expects argument of type 'int', but argument 3 has type 'long int'" } */
~^~~ ~~~
| |
int long int
warning: field width specifier ‘*’ expects argument of type ‘int’, but argument 3 has type ‘long int[-Wformat=]
Function test_field_width_specifier_2
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 196
Column 28
196 __builtin_sprintf (d, " %*ld ", foo + bar, foo); /* { dg-warning "28: field width specifier '\\*' expects argument of type 'int', but argument 3 has type 'long int'" } */
~^~~ ~~~~~~~~~
| |
int long int
warning: field precision specifier ‘.*’ expects argument of type ‘int’, but argument 3 has type ‘long int[-Wformat=]
Function test_field_precision_specifier
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 207
Column 29
207 __builtin_sprintf (d, " %.*ld ", foo, foo); /* { dg-warning "29: field precision specifier '\\.\\*' expects argument of type 'int', but argument 3 has type 'long int'" } */
~~^~~ ~~~
| |
int long int
warning: field precision specifier ‘.*’ expects argument of type ‘int’, but argument 3 has type ‘long int[-Wformat=]
Function test_field_precision_specifier
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 215
Column 29
215 __builtin_sprintf (d, " %.*ld ", foo + bar, foo); /* { dg-warning "29: field precision specifier '\\.\\*' expects argument of type 'int', but argument 3 has type 'long int'" } */
~~^~~ ~~~~~~~~~
| |
int long int
warning: spurious trailing ‘%’ in format [-Wformat=]
Function test_spurious_percent
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 226
Column 23
226 printf("hello world %"); /* { dg-warning "23: spurious trailing" } */
^
warning: empty left precision in gnu_strfmon format [-Wformat=]
Function test_empty_precision
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 236
Column 20
236 strfmon (s, m, "%#.5n", d); /* { dg-warning "20: empty left precision in gnu_strfmon format" } */
^
warning: empty precision in gnu_strfmon format [-Wformat=]
Function test_empty_precision
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 242
Column 22
242 strfmon (s, m, "%#5.n", d); /* { dg-warning "22: empty precision in gnu_strfmon format" } */
^
warning: repeated '+' flag in format [-Wformat=]
Function test_repeated
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 251
Column 14
251 printf ("%++d", i); /* { dg-warning "14: repeated '\\+' flag in format" } */
^
warning: conversion lacks type at end of format [-Wformat=]
Function test_conversion_lacks_type
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 260
Column 14
260 printf (" %h"); /* { dg-warning "14:conversion lacks type at end of format" } */
^
warning: embedded ‘\0’ in format [-Wformat-contains-nul]
Function test_embedded_nul
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 269
Column 13
269 printf (" \0 "); /* { dg-warning "13:embedded" "warning for embedded NUL" } */
^~
warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘const char *[-Wformat=]
Function test_macro
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 279
Column 10
279 printf("hello " INT_FMT " world", msg); /* { dg-warning "10: format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
^~~~~~~~ ~~~
|
const char *
note: format string is defined here
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 278
Column 19
278 #define INT_FMT "%i" /* { dg-message "19: format string is defined here" } */
~^
|
int
%s
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -275,7 +275,7 @@
 
 void test_macro (const char *msg)
 {
-#define INT_FMT "%i" /* { dg-message "19: format string is defined here" } */
+#define INT_FMT "%s" /* { dg-message "19: format string is defined here" } */
   printf("hello " INT_FMT " world", msg);  /* { dg-warning "10: format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
 /* { dg-begin-multiline-output "" }
    printf("hello " INT_FMT " world", msg);
warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘const char *[-Wformat=]
Function test_macro_2
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 299
Column 10
299 printf("hello %" PRIu32 " world", msg); /* { dg-warning "10: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'const char \\*' " } */
^~~~~~~~~ ~~~
|
const char *
note: format string is defined here
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 298
Column 17
298 #define PRIu32 "u" /* { dg-message "17: format string is defined here" } */
^
|
unsigned int
warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘const char *[-Wformat=]
Function test_macro_3
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 317
Column 20
317 #define FMT_STRING "hello %i world" /* { dg-line test_macro_3_macro_line } */
^~~~~~~~~~~~~~~~
note: format string is defined here
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 317
Column 28
317 #define FMT_STRING "hello %i world" /* { dg-line test_macro_3_macro_line } */
~^
|
int
%s
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -314,7 +314,7 @@
 
 void test_macro_3 (const char *msg)
 {
-#define FMT_STRING "hello %i world" /* { dg-line test_macro_3_macro_line } */
+#define FMT_STRING "hello %s world" /* { dg-line test_macro_3_macro_line } */
   /* { dg-warning "20: format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*'" "" { target *-*-*} .-1 } */
   printf(FMT_STRING, msg);  /* { dg-message "10: in expansion of macro 'FMT_STRING" } */
 /* { dg-begin-multiline-output "" }
warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘const char *[-Wformat=]
Function test_macro_4
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 341
Column 20
341 #define FMT_STRING "hello %i world" /* { dg-warning "20: format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
^~~~~~~~~~~~~~~~
note: format string is defined here
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 341
Column 28
341 #define FMT_STRING "hello %i world" /* { dg-warning "20: format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
~^
|
int
%s
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -338,7 +338,7 @@
 
 void test_macro_4 (const char *msg)
 {
-#define FMT_STRING "hello %i world" /* { dg-warning "20: format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
+#define FMT_STRING "hello %s world" /* { dg-warning "20: format '%i' expects argument of type 'int', but argument 2 has type 'const char \\*' " } */
   printf(FMT_STRING "\n", msg);  /* { dg-message "10: in expansion of macro 'FMT_STRING" } */
 /* { dg-begin-multiline-output "" }
  #define FMT_STRING "hello %i world"
warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘double[-Wformat=]
Function test_non_contiguous_strings
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 363
Column 20
363 __builtin_printf(" %" "d ", 0.5); /* { dg-warning "20: format .%d. expects argument of type .int., but argument 2 has type .double." } */
^~~~ ~~~
|
double
note: format string is defined here
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 363
Column 26
363 __builtin_printf(" %" "d ", 0.5); /* { dg-warning "20: format .%d. expects argument of type .int., but argument 2 has type .double." } */
~~~~^
|
int
%" "f
--- ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
+++ ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
@@ -360,7 +360,7 @@
 
 void test_non_contiguous_strings (void)
 {
-  __builtin_printf(" %" "d ", 0.5); /* { dg-warning "20: format .%d. expects argument of type .int., but argument 2 has type .double." } */
+  __builtin_printf(" %" "f ", 0.5); /* { dg-warning "20: format .%d. expects argument of type .int., but argument 2 has type .double." } */
                                     /* { dg-message "26: format string is defined here" "" { target *-*-* } .-1 } */
   /* { dg-begin-multiline-output "" }
    __builtin_printf(" %" "d ", 0.5);
warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘double[-Wformat=]
Function test_const_arrays
File ../../src/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c
Line 385
Column 20
385 __builtin_printf(a, 0.5); /* { dg-warning "20: format .%d. expects argument of type .int., but argument 2 has type .double." } */
^ ~~~
|
double