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

Jakub Jelinek jakub@redhat.com
Tue Sep 15 17:10:00 GMT 2015


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 file is included in multiple .c files like

Multiple?  All I can see is e_atan2.c including that header file, nothing
else.

> 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.

I disagree.  While const vars are special in C++, it is really like
any other variable in C, so the warning is IMHO appropriate.

	Jakub



More information about the Gcc-patches mailing list