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++/55252] Caret diagnostic doesn't show useful location when macro clashes with name in system header
Date: Mon, 19 Nov 2012 16:34:00 -0000	[thread overview]
Message-ID: <bug-55252-4-rvVOtFbp9p@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-55252-4@http.gcc.gnu.org/bugzilla/>


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

--- Comment #7 from dodji at seketeli dot org <dodji at seketeli dot org> 2012-11-19 16:34:11 UTC ---
"manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> a écrit:

> On the other hand, let's consider:
> pr55252.c:
>
> #define bar 256
> #include "pr55252.h"
>
> pr55252.h:
>
> #pragma GCC system_header
> signed char foo = bar;
>
>
>
> In this case, I would expect the warning to be suppressed (as it is with
>
> -ftrack-macro-expansion=0). However, since the warning is actually
> given in the C file, it is emitted. I am getting more and more
> convinced that expanding to spelling point might not be the best (I
> think Paolo Bonzini raised this issue at the time...).

I am thinking that a way to really handle this correctly is to have the
concept of the location of the "current expression", which the current
token belongs to.

In this case, we are emitting the warning on the token 'bar' (which is
spelled in the C file), while the relevant expression (the variable
declaration) is in a header file.

The diagnostics machinery should be able to say "is the current
expression in a header file?", and act appropriately.

Would that make sense in the grand scheme of things?


  parent reply	other threads:[~2012-11-19 16:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-09 18:07 [Bug c++/55252] New: " redi at gcc dot gnu.org
2012-11-09 18:08 ` [Bug c++/55252] " redi at gcc dot gnu.org
2012-11-09 21:02 ` manu at gcc dot gnu.org
2012-11-10 22:58 ` manu at gcc dot gnu.org
2012-11-10 23:10 ` manu at gcc dot gnu.org
2012-11-10 23:20 ` redi at gcc dot gnu.org
2012-11-19 16:17 ` dodji at seketeli dot org
2012-11-19 16:34 ` dodji at seketeli dot org [this message]
2012-11-19 16:50 ` manu at gcc dot gnu.org
2012-11-19 17:06 ` dodji at seketeli dot org
2012-11-19 17:18 ` dodji at seketeli dot org
2013-11-01 15:30 ` manu at gcc dot gnu.org
2013-11-01 21:33 ` manu at gcc dot gnu.org
2014-05-13 15:53 ` tromey at gcc dot gnu.org
2014-07-15 16:29 ` tromey at gcc dot gnu.org
2014-07-15 16:32 ` tromey at gcc dot gnu.org
2015-02-01 20:29 ` manu at gcc dot gnu.org
2015-02-03 10:35 ` dodji 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-55252-4-rvVOtFbp9p@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).