This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR28901 -Wunused-variable ignores unused const initialised variables
- From: Mark Wielaard <mjw at redhat dot com>
- To: Bernd Schmidt <bernds_cb1 at t-online dot de>
- Cc: Gerald Pfeifer <gerald at pfeifer dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 17 Sep 2015 18:32:19 +0200
- Subject: Re: [PATCH] PR28901 -Wunused-variable ignores unused const initialised variables
- Authentication-results: sourceware.org; auth=none
- References: <1442009555-13690-1-git-send-email-mjw at redhat dot com> <55F355B1 dot 1070605 at redhat dot com> <20150912220051 dot GA4445 at blokker dot redhat dot com> <20150913114057 dot GB4445 at blokker dot redhat dot com> <alpine dot LSU dot 2 dot 20 dot 1509171356131 dot 3004 at tuna dot site> <55FAE67F dot 6010305 at t-online dot de>
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:
static const WCHAR INSTALLPROPERTY_VERSIONSTRINGW[] =
{'V','e','r','s','i','o','n','S','t','r','i','n','g',0};
Using the more idiomatic and a bit more readable:
#define INSTALLPROPERTY_VERSIONSTRINGW u"VersionString"
gets rid of most of the issues.
Cheers,
Mark