News for hackers. Stuff that matters.
Re:Usability improvements in GCC 8 by gumby on Friday March 16, 2018 @01:28AM (#16598834)
We use a bunch of third party packages (e.g. parts of boost) and, because they typically don't compile without warnings or weird compiler options* we try to isolate them in "trampoline" files or surround the header includes with a bunch of #pragma GCC diagnostic ignored "-Wblahblah"

Some of the errors are way past the parse tree and so they can't be controlled by a pragma diagnostic ignored (e.g. -Wduplicated-branches ). So this option is silently ignored. It would be convenient if GCC could say "Warning: -Wduplicated-branches can't be controlled in a #pragma diagnostic" . (or add support for it, but that's hard :-)

* BTW I'm not implying these warnings are due to crappy programming; typically they result from the wide variety of compilers and C++ standards the library manages to support. I only have to support two compilers on one platform, all in C++17.

Re:Usability improvements in GCC 8 by dmalcolm on Friday March 16, 2018 @09:37AM (#16600506)
Indeed, dealing with multiple configurations with lots of dependencies is hard.

I looked in the option metadata for our C/C++ frontends and -Wduplicated-branches isn't flagged as RejectNegative, so -Wno-duplicated-branches ought to work; I think you ought to be able to set that on a pragma. Does that help?

Re:Usability improvements in GCC 8 by gumby on Friday March 16, 2018 @12:19PM (#16601656)
-Wno-duplicated-branches is a perfectly reasonable flag for the command line but unfortunately -Wduplicated-branches has no effect when supplied in a #pragma...ignored. Thus my only choice is to have it apply to the entire translation unit.

I understand why this is true and very hard to fix (thus I wouldn't even mention it except you were asking about UI issues rather than code generation issues). But it would be user friendly if GCC could warn of this rather than silently ignoring the flag when using the #pragma...ignored/#pragma...pop model.

By the way there are many such flags that cannot be used in a #pragma...ignored, I just glanced at our source code and grabbed one example at random.