public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Anthony Foiani <tkil@scrye.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: -Wold-style-casts and system headers
Date: Tue, 18 Jun 2013 16:57:00 -0000	[thread overview]
Message-ID: <gehbz5pcu.fsf@dworkin.scrye.com> (raw)
In-Reply-To: <CAH6eHdT2KenM9yq5zE_7WdoHmtbpSX08VpefK84dCi_staD7Aw@mail.gmail.com> (Jonathan Wakely's message of "Tue\, 18 Jun 2013 17\:42\:15 +0100")


Jonathan --

Thanks for the quick reply.

Jonathan Wakely <jwakely.gcc@gmail.com> writes:

> On 18 June 2013 17:14, Anthony Foiani wrote:
>> I'm aware that I can disable that warning for the single file, or even
>> for a single region in the file using pragmas, but I would like to
>> understand why g++ isn't applying the "system header" rule to that
>> macro.
>
> It's because the expansion of the macro is in your code, not in a
> system header.

If that's the expected behavior, then the manual probably needs
rephrasing:

  "Macros defined in a system header are immune to a few warnings
  wherever they are expanded."

I certainly expected "wherever" to include user code, and it seems
that's an important place for it to apply.  An even shorter example:

  #include <sys/select.h>

  int main()
  {
      fd_set fds;
      FD_CLR( 0, &fds );
      return 0;
  }

Generates:

  $ g++ -Wold-style-cast -o g++-cast-warning g++-cast-warning.cpp
  g++-cast-warning.cpp: In function ‘int main()’:
  g++-cast-warning.cpp:47:5: warning: use of old-style cast [-Wold-style-cast]
  g++-cast-warning.cpp:47:5: warning: use of old-style cast [-Wold-style-cast]
  g++-cast-warning.cpp:47:5: warning: use of old-style cast [-Wold-style-cast]

> There are some open bug reports on similar subjects
> e.g. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=7263#c8

From a quick read, it seems that the infrastructure to fix this
problem is in 4.8, but this particular problem isn't fixed?

Should I file another PR?

Thanks again,
Anthony Foiani

  reply	other threads:[~2013-06-18 16:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18 16:14 Anthony Foiani
2013-06-18 16:42 ` Jonathan Wakely
2013-06-18 16:57   ` Anthony Foiani [this message]
2013-06-18 17:02     ` Anthony Foiani

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=gehbz5pcu.fsf@dworkin.scrye.com \
    --to=tkil@scrye.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    /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).