Re: -Wold-style-casts and system headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan --

Thanks for the quick reply.

Jonathan Wakely <jwakely.gcc@xxxxxxxxx> 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





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux