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 #13 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-05-25 14:17:41 UTC ---
I guess the C/C++ FEs could for non-trivial string literals put into a hash
table mapping from locus_t (of ADDR_EXPR around STRING_CST) to the first cpp
token for that string, then the diagnostic code could go from there.
Trivial string literal above would be a string literal that doesn't have any
prefixes (L/u/u8/U and variants with R), isn't contatenated from several parts
and didn't need to be translated.  So, printf ("%.*d"); (the common case)
wouldn't have to be recorded, while printf (R"<<<(%)>>>" "." R"(*)" "d"); would
need that.  For "trivial" string literals you'd just shift the locus by the
offset, for non-trivial look up the tokens and process them again, looking at
where the corresponding byte would appear to come from.


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