Re: GCC/clang warning incompatibility with unused private member variables

2021-06-13 Thread Jason Merrill via Gcc
On Fri, Jun 11, 2021 at 4:03 PM Jason Merrill wrote: > On 6/11/21 3:37 PM, Markus Faehling wrote: > > Hello, > > > > I'm currently facing a problem where I cannot get both gcc and clang > > warning-free simultaneously in my project. My code looks somewhat like > > this: > > > > class Test { > >

Re: GCC/clang warning incompatibility with unused private member variables

2021-06-11 Thread Jonathan Wakely via Gcc
Here's another #pragma solution to your problem: class Test { # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wpragmas" // so GCC ignores next line # pragma GCC diagnostic ignored "-Wunused-private-field" int a_; # pragma GCC diagnostic pop void b() {}; }; First tell GCC

Re: GCC/clang warning incompatibility with unused private member variables

2021-06-11 Thread Jakub Jelinek via Gcc
On Fri, Jun 11, 2021 at 04:03:34PM -0400, Jason Merrill via Gcc wrote: > You can use #pragma to disable a warning for a particular section of code: > > #pragma GCC diagnostic push > #pragma GCC diagnostic ignored "-Wattributes" > class Test { > [[maybe_unused]] int a_; > void b() {}; > }

Re: GCC/clang warning incompatibility with unused private member variables

2021-06-11 Thread Jason Merrill via Gcc
On 6/11/21 3:37 PM, Markus Faehling wrote: Hello, I'm currently facing a problem where I cannot get both gcc and clang warning-free simultaneously in my project. My code looks somewhat like this: class Test {     int a_;     void b() {}; }; This code gives me the(usually very useful) "-Wu

Re: GCC/clang warning incompatibility with unused private member variables

2021-06-11 Thread Gabriel Ravier via Gcc
On 6/11/21 9:37 PM, Markus Faehling wrote: Hello, I'm currently facing a problem where I cannot get both gcc and clang warning-free simultaneously in my project. My code looks somewhat like this: class Test {     int a_;     void b() {}; }; This code gives me the(usually very useful) "-Wunu

GCC/clang warning incompatibility with unused private member variables

2021-06-11 Thread Markus Faehling
Hello, I'm currently facing a problem where I cannot get both gcc and clang warning-free simultaneously in my project. My code looks somewhat like this: class Test {     int a_;     void b() {}; }; This code gives me the(usually very useful) "-Wunused-private-field" warning on clang. But bec