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: Joseph Myers <joseph at codesourcery dot com>
- To: Steve Ellcey <sellcey at imgtec dot com>
- Cc: Bernd Schmidt <bschmidt at redhat dot com>, Mark Wielaard <mjw at redhat dot com>, Manuel López-Ibáñez <lopezibanez at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 15 Sep 2015 17:10:46 +0000
- Subject: Re: [PATCH] PR28901 -Wunused-variable ignores unused const initialised variables
- Authentication-results: sourceware.org; auth=none
- References: <55F67C3F dot 40503 at redhat dot com> <1442336535 dot 16610 dot 41 dot camel at ubuntu-sellcey>
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 multiple .c files like
> sysdeps/ieee754/dbl-64/e_atan2.c that use some, but not all, of those
> static constant variables. But between the various .c files all of the
> globals are used somewhere, just not in every individual .c file. This
> seems like a perfectly reasonable use of static globals and header files
> that should not be identified as a warning.
And glibc also uses -fmerge-all-constants, so this C++-style use of static
variables should be just as efficient as using #define in all cases
(though since the addresses of the variables aren't taken, it should be
just as efficient even without -fmerge-all-constants).
--
Joseph S. Myers
joseph@codesourcery.com