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: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 22 May 2012 11:04:41 +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 #8 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> 2012-05-22 11:04:41 UTC ---
(In reply to comment #3)
> What does clang report for this:
>
> #include <stdio.h>
> void f() {
> printf(
> "%."
> "*d");
> }
>
> ?
An even more interesting example is this:
#define FORMAT ".*d"
#include <stdio.h>
void f() {
printf(
"%"
FORMAT);
}
for which Clang prints:
/tmp/webcompile/_17428_0.c:6:1: warning: '.*' specified field precision is
missing a matching 'int' argument
FORMAT);
^
/tmp/webcompile/_17428_0.c:1:18: note: expanded from:
#define FORMAT ".*d"
^
1 warning generated.
So either one keeps track of all source locations of all "interesting"
characters within strings, which sounds infeasible. Or one needs to
re-preprocess the format string, creating new locations on-the-fly. Dodji, is
this possible?