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

2015-10-24 Thread Mark Wielaard
On Sat, 2015-10-24 at 15:47 +0200, Gerald Pfeifer wrote: > On Wed, 7 Oct 2015, Bernd Schmidt wrote: > > I think not using -Wall -Werror is the right fix. > > Of course there is a fair chance (and I'll likely end up proposing > this for Wine) is that people will use -Wnounused-variable instead. >

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

2015-10-24 Thread Gerald Pfeifer
On Wed, 7 Oct 2015, Bernd Schmidt wrote: > I think not using -Wall -Werror is the right fix. Of course there is a fair chance (and I'll likely end up proposing this for Wine) is that people will use -Wnounused-variable instead. Which will disable _all_ such warnings, not only those coming from

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

2015-10-23 Thread Gerald Pfeifer
On Thu, 17 Sep 2015, Mark Wielaard wrote: >>> 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 fro

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

2015-10-07 Thread Bernd Schmidt
On 10/07/2015 12:44 AM, Steve Ellcey wrote: So, is there any consensus on this issue? If I understood Jakub correctly he agreed with my reasoning. So for the moment we'll leave things as they are and revisit the issue if and when other cases pop up. I cannot build top-of-tree glibc with t

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

2015-10-06 Thread Steve Ellcey
On Thu, 2015-09-24 at 21:24 -0400, Trevor Saunders wrote: > On Thu, Sep 24, 2015 at 06:55:11PM +0200, Bernd Schmidt wrote: > > On 09/24/2015 06:11 PM, Steve Ellcey wrote: > > >At least one of the warnings in glibc is not justified (in my opinion). > > >The header file timezone/private.h defines tim

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

2015-09-24 Thread Trevor Saunders
On Thu, Sep 24, 2015 at 06:55:11PM +0200, Bernd Schmidt wrote: > On 09/24/2015 06:11 PM, Steve Ellcey wrote: > >At least one of the warnings in glibc is not justified (in my opinion). > >The header file timezone/private.h defines time_t_min and time_t_max. > >These are not used in any of the timezo

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

2015-09-24 Thread Bernd Schmidt
On 09/24/2015 06:11 PM, Steve Ellcey wrote: At least one of the warnings in glibc is not justified (in my opinion). The header file timezone/private.h defines time_t_min and time_t_max. These are not used in any of the timezone files built by glibc but if you look at the complete tz package they

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

2015-09-24 Thread Steve Ellcey
On Thu, 2015-09-24 at 13:56 +0200, Bernd Schmidt wrote: > I think at this point we have reports of just two packages generating > extra warnings, with the warnings at least justifiable in both cases. So > my vote would be to leave things as-is for now and see if more reports > come in. It is af

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

2015-09-24 Thread Mark Wielaard
On Wed, 2015-09-23 at 12:25 -0600, Jeff Law wrote: > On 09/18/2015 08:29 PM, Martin Sebor wrote: > >> I guess it is not the 'const' I think should be handled special but the > >> 'static'. Having unused static variables (const or not) declared in a > >> header file but unused seems reasonable sinc

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

2015-09-24 Thread Bernd Schmidt
On 09/24/2015 01:53 PM, Mark Wielaard wrote: Even if there are such constructs in header files and they aren't actually bugs or people are unwilling to fix the issue with something that is more idiomatic C then there are various ways to suppress the warning. Either just don't use -Wunused-variabl

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

2015-09-23 Thread Jeff Law
On 09/18/2015 08:29 PM, Martin Sebor wrote: I guess it is not the 'const' I think should be handled special but the 'static'. Having unused static variables (const or not) declared in a header file but unused seems reasonable since the header file may be included in multiple .c files each of whi

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

2015-09-21 Thread Steve Ellcey
On Fri, 2015-09-18 at 20:29 -0600, Martin Sebor wrote: > On 09/15/2015 11:20 AM, Steve Ellcey wrote: > > I guess it is not the 'const' I think should be handled special but the > > 'static'. Having unused static variables (const or not) declared in a > > header file but unused seems reasonable s

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

2015-09-18 Thread Martin Sebor
On 09/15/2015 11:20 AM, Steve Ellcey wrote: On Tue, 2015-09-15 at 19:10 +0200, Jakub Jelinek wrote: On Tue, Sep 15, 2015 at 10:02:15AM -0700, Steve Ellcey wrote: I am not sure I like this change. It broke the GLIBC build for me on MIPS. Basically GLIBC has a header file with initialized stati

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

2015-09-17 Thread Mark Wielaard
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 testcas

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

2015-09-17 Thread Bernd Schmidt
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 overri

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

2015-09-17 Thread Gerald Pfeifer
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

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

2015-09-15 Thread Joseph Myers
timezone/private.h comes verbatim from the tzcode project and should not be modified locally in glibc. -- Joseph S. Myers jos...@codesourcery.com

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

2015-09-15 Thread Mark Wielaard
On Tue, 2015-09-15 at 20:33 +0200, Mark Wielaard wrote: > I build glibc and found 9 unused variables. They all look like they are > really not used in the code, so they can all just be removed. Someone of > course should double check they aren't unused by accident before > committing upstream. For

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

2015-09-15 Thread Mark Wielaard
On Tue, 2015-09-15 at 10:20 -0700, Steve Ellcey wrote: > On Tue, 2015-09-15 at 19:10 +0200, Jakub Jelinek wrote: > > On Tue, Sep 15, 2015 at 10:02:15AM -0700, Steve Ellcey wrote: > > > I am not sure I like this change. It broke the GLIBC build for me on > > > MIPS. Basically GLIBC has a header fi

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

2015-09-15 Thread Steve Ellcey
On Tue, 2015-09-15 at 19:10 +0200, Jakub Jelinek wrote: > On Tue, Sep 15, 2015 at 10:02:15AM -0700, Steve Ellcey wrote: > > I am not sure I like this change. It broke the GLIBC build for me on > > MIPS. Basically GLIBC has a header file with initialized static > > constant globals (sysdeps/ieee75

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

2015-09-15 Thread Joseph Myers
On Tue, 15 Sep 2015, Steve Ellcey wrote: > I am not sure I like this change. It broke the GLIBC build for me on > MIPS. Basically GLIBC has a header file with initialized static > constant globals (sysdeps/ieee754/dbl-64/atnat2.h contains tqpi1 and > qpi1) and that header file is included in mul

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

2015-09-15 Thread Jakub Jelinek
On Tue, Sep 15, 2015 at 10:02:15AM -0700, Steve Ellcey wrote: > I am not sure I like this change. It broke the GLIBC build for me on > MIPS. Basically GLIBC has a header file with initialized static > constant globals (sysdeps/ieee754/dbl-64/atnat2.h contains tqpi1 and > qpi1) and that header fil

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

2015-09-15 Thread Steve Ellcey
On Mon, 2015-09-14 at 09:50 +0200, Bernd Schmidt wrote: > On 09/13/2015 08:24 PM, Mark Wielaard wrote: > > commit 97505bd0e4ac15d86c2a302cfebc5f1a4fc2c2e8 > > Author: Mark Wielaard > > Date: Fri Sep 11 23:54:15 2015 +0200 > > > > PR28901 -Wunused-variable ignores unused const initialised var

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

2015-09-14 Thread Bernd Schmidt
On 09/13/2015 08:24 PM, Mark Wielaard wrote: commit 97505bd0e4ac15d86c2a302cfebc5f1a4fc2c2e8 Author: Mark Wielaard Date: Fri Sep 11 23:54:15 2015 +0200 PR28901 -Wunused-variable ignores unused const initialised variables in C This is ok. Bernd

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

2015-09-13 Thread Mark Wielaard
On Sun, Sep 13, 2015 at 02:50:53PM +0200, Manuel López-Ibáñez wrote: > On 13/09/15 13:40, 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 defau

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

2015-09-13 Thread Manuel López-Ibáñez
On 13/09/15 13:40, Mark Wielaard wrote: On Sun, Sep 13, 2015 at 12:00:51AM +0200, Mark Wielaard wrote: I'll rewrite my patch a little, add some C++ testcases, and update the documentation. Then we can discuss again. Slightly adjusted patch attached. Now it is explicit that the warning is enabl

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

2015-09-13 Thread Mark Wielaard
Mark Wielaard Date: Fri, 11 Sep 2015 23:54:15 +0200 Subject: [PATCH] PR28901 -Wunused-variable ignores unused const initialised variables in C 12 years ago it was decided that -Wunused-variable shouldn't warn about static const variables because some code used const static char rcsid[] strin

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

2015-09-12 Thread Mark Wielaard
On Sat, Sep 12, 2015 at 12:29:05AM +0200, Bernd Schmidt wrote: > On 09/12/2015 12:12 AM, Mark Wielaard wrote: > >12 years ago it was decided that -Wunused-variable shouldn't warn about > >static const variables because some code used const static char rcsid[] > >strings which were never used but wa

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

2015-09-11 Thread Bernd Schmidt
On 09/12/2015 12:12 AM, Mark Wielaard wrote: 12 years ago it was decided that -Wunused-variable shouldn't warn about static const variables because some code used const static char rcsid[] strings which were never used but wanted in the code anyway. But as the bug points out this hides some real

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

2015-09-11 Thread Mark Wielaard
12 years ago it was decided that -Wunused-variable shouldn't warn about static const variables because some code used const static char rcsid[] strings which were never used but wanted in the code anyway. But as the bug points out this hides some real bugs. These days the usage of rcsids is not ver