This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/52952] Wformat location info is bad (wrong column number)
- From: "steven at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 21 May 2012 23:21:04 +0000
- Subject: [Bug c/52952] Wformat location info is bad (wrong column number)
- Auto-submitted: auto-generated
- References: <bug-52952-4@http.gcc.gnu.org/bugzilla/>
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.