This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]