public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dodji at seketeli dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/52952] Wformat location info is bad (wrong column number)
Date: Thu, 24 May 2012 18:44:00 -0000	[thread overview]
Message-ID: <bug-52952-4-cmhVBz8r5C@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-52952-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #9 from dodji at seketeli dot org <dodji at seketeli dot org> 2012-05-24 18:38:40 UTC ---
"manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> a écrit:

> 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?

With the current infrastructure, I fear we cannot re-process the format
string *after* the initial pre-processing phase is done, to create new
locations that we'd a in the line maps.

However, briefly looking at the source code, we might be able to pull
this whole shebang off, in a way.

I am thinking that in gcc/c-family/c-format.c:check_format_info_main, we
can arrange for the instance of format_kind_info (that is the result of
parsing the format string) to carry the virtual location  of the
beginning of the format string *and* the offset of the relevant
character we might want to warn about.

Then, later the routines that trigger the warning by analyzing the instance of
format_kind_info could be passed the relevant location for the beginning
of the of the format string as well as the byte offset of the relevant
character I talked about above.  At warning type, it could re-construct
the exact column where of that relevant character, with its byte offset
and the virtual location of the beginning of the format string.

Does that make sense?


  parent reply	other threads:[~2012-05-24 18:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-12 21:22 [Bug c/52952] New: " manu at gcc dot gnu.org
2012-04-12 21:23 ` [Bug c/52952] " manu at gcc dot gnu.org
2012-05-17 23:35 ` steven at gcc dot gnu.org
2012-05-18  1:15 ` steven at gcc dot gnu.org
2012-05-21 23:44 ` steven at gcc dot gnu.org
2012-05-21 23:46 ` steven at gcc dot gnu.org
2012-05-22  9:59 ` jakub at gcc dot gnu.org
2012-05-22 10:20 ` manu at gcc dot gnu.org
2012-05-22 12:33 ` manu at gcc dot gnu.org
2012-05-22 12:33 ` manu at gcc dot gnu.org
2012-05-24 18:44 ` dodji at seketeli dot org [this message]
2012-05-24 19:13 ` manu at gcc dot gnu.org
2012-05-24 20:39 ` dodji at seketeli dot org
2012-05-25 14:18 ` manu at gcc dot gnu.org
2012-05-25 14:50 ` jakub at gcc dot gnu.org
2012-06-04 11:19 ` manu at gcc dot gnu.org
2013-03-30 12:32 ` manu at gcc dot gnu.org
2013-03-30 13:26 ` manu at gcc dot gnu.org
2013-03-30 15:02 ` manu at gcc dot gnu.org
2013-04-01 14:18 ` manu at gcc dot gnu.org
2013-04-05 22:02 ` manu at gcc dot gnu.org
2014-08-05 18:44 ` manu at gcc dot gnu.org
2014-08-19  2:06 ` manu at gcc dot gnu.org
2014-10-04 23:36 ` manu at gcc dot gnu.org
2014-10-05 13:11 ` manu at gcc dot gnu.org
2014-11-08 16:20 ` manu at gcc dot gnu.org
2015-03-27 15:17 ` manu at gcc dot gnu.org
2015-09-08 15:07 ` manu at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-52952-4-cmhVBz8r5C@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).