http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952

--- Comment #4 from Steven Bosscher <steven at gcc dot gnu.org> 2012-05-21 
23:21:04 UTC ---
Created attachment 27466
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27466
Pass around the location of the format string

First, admittedly rather lame, attempt at some improvement. With this patch,
the warning now points to the format string, at least:

$ cat pr525952.c 
extern int printf (__const char *__restrict __format, ...);
void f(void) {
    printf(
   "%."
"*d");
}
$ ./cc1 -quiet -Wformat pr525952.c 
pr525952.c: In function ‘f’:
pr525952.c:4:4: warning: field precision specifier ‘.*’ expects a matching
‘int’ argument [-Wformat]
    "%."
    ^
pr525952.c:4:4: warning: format ‘%d’ expects a matching ‘int’ argument
[-Wformat]

Handling broken-up format lines is rather more difficult.  Not sure how to
tackle that.

Reply via email to