This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/52952] Wformat location info is bad (wrong column number)


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]