[PATCH] PR28901 -Wunused-variable ignores unused const initialised variables

Mark Wielaard mjw@redhat.com
Thu Sep 17 16:32:00 GMT 2015

On Thu, 2015-09-17 at 18:12 +0200, Bernd Schmidt wrote:
> On 09/17/2015 02:01 PM, Gerald Pfeifer wrote:
> > On Sun, 13 Sep 2015, Mark Wielaard wrote:
> >> Slightly adjusted patch attached. Now it is explicit that the warning is
> >> enabled by -Wunused-variable for C, but not C++. There are testcases for
> >> both C and C++ to check the defaults. And the hardcoded override is
> >> removed for C++, so the user could enable it if they want.
> >
> > I believe making -Wunused-const-variable part of -Wall is not
> > a good idea.
> >
> > For example, I have a nightly build of Wine with a nightly build
> > of GCC.  And my notifaction mail went from twently lines of warning
> > to 6500 -- all coming from header files.
> What does it warn about, do the warnings look valid?

I was just taking a look. They come from constructs like:


Using the more idiomatic and a bit more readable:


gets rid of most of the issues.



More information about the Gcc-patches mailing list