This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

[PATCH] Remove defined but unused global static variables


Here is a patch to fix most of the warnings about 'defined but unused'
global const static variables that the latest GCC gives.  The one that
I did not address is timezone/private.h (time_t_min and time_t_max are
unused) because Joseph said they should be fixed upstream in the tzcode
project.  I have not contacted the tzcode project at all as I have never
done any work there, if anyone has existing contacts there and wants to
do this, that would be great.

I tested this on MIPS and I did some grepping to try and verify that
the variables I am removing are not used in any code not compiled
by MIPS but it would be good if other platforms could test this patch
to verify that no builds break.

Many of these changes were included in an email to gcc-patches by Mark
Wielaard (that is why I added his name to this submission) and I made
sure to include all of those plus some others that I found when building
on MIPS.  Also, instead of removing rcsid from base64.c the way Mark did, I
changed the ifdef to match the other files in that directory.

OK to checkin?


2015-09-18  Steve Ellcey  <sellcey@imgtec.com>
	    Mark Wielaard <mjw@redhat.com>

 	* math/atest-exp2.c (mp_exp_m1): Remove.
 	* resolv/base64.c (rcsid): Change ifdef check.
 	* string/tst-endian.c (do_test): Make i volatile.
 	* sysdeps/ieee754/dbl-64/atnat2.h (qpi1, tqpi1): Remove.
 	* sysdeps/ieee754/dbl-64/uexp.h (one): Remove.
 	* sysdeps/ieee754/dbl-64/upow.h (sqrt_2): Remove.
 	* sysdeps/ieee754/flt-32/e_log10f.c (zero): Remove.
	* sysdeps/ieee754/flt-32/s_cosf.c (one): Remove.
	* sysdeps/ieee754/ldbl-128/e_lgammal_r.c (zero): Remove.
	* sysdeps/ieee754/ldbl-128/s_erfl.c (half): Remove.
	* sysdeps/ieee754/ldbl-128/s_log1pl.c (maxlog): Remove.


diff --git a/math/atest-exp2.c b/math/atest-exp2.c
index 307c741..ffa73b1 100644
--- a/math/atest-exp2.c
+++ b/math/atest-exp2.c
@@ -53,11 +53,6 @@ static const mp1 mp_exp1 = {
            a784d904, 5190cfef, 324e7738, 926cfbe5, f4bf8d8d, 8c31d763)
 };
 
-static const mp1 mp_exp_m1 = {
-  CONSTSZ (0, 5e2d58d8, b3bcdf1a, badec782, 9054f90d, da9805aa, b56c7733,
-           3024b9d0, a507daed, b16400bf, 472b4215, b8245b66, 9d90d27a)
-};
-
 static const mp1 mp_log2 = {
   CONSTSZ (0, b17217f7, d1cf79ab, c9e3b398, 03f2f6af, 40f34326, 7298b62d,
            8a0d175b, 8baafa2b, e7b87620, 6debac98, 559552fb, 4afa1b10)
diff --git a/resolv/base64.c b/resolv/base64.c
index ea584ed..c2f992a 100644
--- a/resolv/base64.c
+++ b/resolv/base64.c
@@ -40,9 +40,9 @@
  * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
  */
 
-#if !defined(LINT) && !defined(CODECENTER)
+#if defined(LIBC_SCCS) && !defined(lint)
 static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
-#endif /* not lint */
+#endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #include <sys/param.h>
diff --git a/string/tst-endian.c b/string/tst-endian.c
index 8684bb2..9d64a87 100644
--- a/string/tst-endian.c
+++ b/string/tst-endian.c
@@ -9,7 +9,7 @@ do_test (void)
 {
   int result = 0;
 
-  for (uint64_t i = 0; i < (~UINT64_C (0)) >> 2; i = (i << 1) + 3)
+  for (volatile uint64_t i = 0; i < (~UINT64_C (0)) >> 2; i = (i << 1) + 3)
     {
       if (i < UINT64_C (65536))
 	{
diff --git a/sysdeps/ieee754/dbl-64/atnat2.h b/sysdeps/ieee754/dbl-64/atnat2.h
index e0d65af..82943f9 100644
--- a/sysdeps/ieee754/dbl-64/atnat2.h
+++ b/sysdeps/ieee754/dbl-64/atnat2.h
@@ -65,10 +65,8 @@
 /**/ hpi1           = {{0x3c91a626, 0x33145c07} }, /*  pi/2-hpi     */
 /**/ mhpi           = {{0xbff921fb, 0x54442d18} }, /* -pi/2         */
 /**/ qpi            = {{0x3fe921fb, 0x54442d18} }, /*  pi/4         */
-/**/ qpi1           = {{0x3c81a626, 0x33145c07} }, /*  pi/4-qpi     */
 /**/ mqpi           = {{0xbfe921fb, 0x54442d18} }, /* -pi/4         */
 /**/ tqpi           = {{0x4002d97c, 0x7f3321d2} }, /*  3pi/4        */
-/**/ tqpi1          = {{0x3c9a7939, 0x4c9e8a0a} }, /*  3pi/4-tqpi   */
 /**/ mtqpi          = {{0xc002d97c, 0x7f3321d2} }, /* -3pi/4        */
 /**/ u1             = {{0x3c314c2a, 0x00000000} }, /*  9.377e-19    */
 /**/ u2             = {{0x3bf955e4, 0x00000000} }, /*  8.584e-20    */
@@ -129,10 +127,8 @@
 /**/ hpi1           = {{0x33145c07, 0x3c91a626} }, /*  pi/2-hpi     */
 /**/ mhpi           = {{0x54442d18, 0xbff921fb} }, /* -pi/2         */
 /**/ qpi            = {{0x54442d18, 0x3fe921fb} }, /*  pi/4         */
-/**/ qpi1           = {{0x33145c07, 0x3c81a626} }, /*  pi/4-qpi     */
 /**/ mqpi           = {{0x54442d18, 0xbfe921fb} }, /* -pi/4         */
 /**/ tqpi           = {{0x7f3321d2, 0x4002d97c} }, /*  3pi/4        */
-/**/ tqpi1          = {{0x4c9e8a0a, 0x3c9a7939} }, /*  3pi/4-tqpi   */
 /**/ mtqpi          = {{0x7f3321d2, 0xc002d97c} }, /* -3pi/4        */
 /**/ u1             = {{0x00000000, 0x3c314c2a} }, /*  9.377e-19    */
 /**/ u2             = {{0x00000000, 0x3bf955e4} }, /*  8.584e-20    */
diff --git a/sysdeps/ieee754/dbl-64/uexp.h b/sysdeps/ieee754/dbl-64/uexp.h
index 6817eaf..42b21f2 100644
--- a/sysdeps/ieee754/dbl-64/uexp.h
+++ b/sysdeps/ieee754/dbl-64/uexp.h
@@ -29,7 +29,7 @@
 
 #include "mydefs.h"
 
-const static double one = 1.0, zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
+const static double zero = 0.0, hhuge = 1.0e300, tiny = 1.0e-300,
 err_0 = 1.000014, err_1 = 0.000016;
 const static int4 bigint = 0x40862002,
              badint = 0x40876000,smallint = 0x3C8fffff;
diff --git a/sysdeps/ieee754/dbl-64/upow.h b/sysdeps/ieee754/dbl-64/upow.h
index c8569a9..b4911e5 100644
--- a/sysdeps/ieee754/dbl-64/upow.h
+++ b/sysdeps/ieee754/dbl-64/upow.h
@@ -34,7 +34,6 @@
 /**/ nZERO	    = {{0x80000000, 0}},	  /* -0.0          */
 /**/ INF            = {{0x7ff00000, 0x00000000}}, /* INF           */
 /**/ nINF           = {{0xfff00000, 0x00000000}}, /* -INF          */
-/**/ sqrt_2         = {{0x3ff6a09e, 0x667f3bcc}}, /* sqrt(2)       */
 /**/ ln2a           = {{0x3fe62e42, 0xfefa3800}}, /* ln(2) 43 bits */
 /**/ ln2b           = {{0x3d2ef357, 0x93c76730}}, /* ln(2)-ln2a    */
 /**/ bigu           = {{0x4297ffff, 0xfffffd2c}}, /* 1.5*2**42 -724*2**-10  */
@@ -48,7 +47,6 @@
 /**/ nZERO	    = {{0, 0x80000000}},	  /* -0.0          */
 /**/ INF            = {{0x00000000, 0x7ff00000}}, /* INF           */
 /**/ nINF           = {{0x00000000, 0xfff00000}}, /* -INF           */
-/**/ sqrt_2         = {{0x667f3bcc, 0x3ff6a09e}}, /* sqrt(2)       */
 /**/ ln2a           = {{0xfefa3800, 0x3fe62e42}}, /* ln(2) 43 bits */
 /**/ ln2b           = {{0x93c76730, 0x3d2ef357}}, /* ln(2)-ln2a    */
 /**/ bigu           = {{0xfffffd2c, 0x4297ffff}}, /* 1.5*2**42 -724*2**-10  */
diff --git a/sysdeps/ieee754/flt-32/e_log10f.c b/sysdeps/ieee754/flt-32/e_log10f.c
index 96f0e81..1daeef7 100644
--- a/sysdeps/ieee754/flt-32/e_log10f.c
+++ b/sysdeps/ieee754/flt-32/e_log10f.c
@@ -22,8 +22,6 @@ ivln10     =  4.3429449201e-01, /* 0x3ede5bd9 */
 log10_2hi  =  3.0102920532e-01, /* 0x3e9a2080 */
 log10_2lo  =  7.9034151668e-07; /* 0x355427db */
 
-static const float zero   =  0.0;
-
 float
 __ieee754_log10f(float x)
 {
diff --git a/sysdeps/ieee754/flt-32/s_cosf.c b/sysdeps/ieee754/flt-32/s_cosf.c
index 864ab27..0affd40 100644
--- a/sysdeps/ieee754/flt-32/s_cosf.c
+++ b/sysdeps/ieee754/flt-32/s_cosf.c
@@ -21,8 +21,6 @@ static char rcsid[] = "$NetBSD: s_cosf.c,v 1.4 1995/05/10 20:47:03 jtc Exp $";
 #include <math.h>
 #include <math_private.h>
 
-static const float one=1.0;
-
 #ifndef COSF
 # define COSF_FUNC __cosf
 #else
diff --git a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
index 500aacc..ab5a96e 100644
--- a/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-128/e_lgammal_r.c
@@ -82,7 +82,6 @@ DIAG_IGNORE_NEEDS_COMMENT (4.6, "-Woverflow");
 static const long double MAXLGM = 1.0485738685148938358098967157129705071571E4928L;
 DIAG_POP_NEEDS_COMMENT;
 static const long double one = 1.0L;
-static const long double zero = 0.0L;
 static const long double huge = LDBL_MAX;
 
 /* log gamma(x) = ( x - 0.5 ) * log(x) - x + LS2PI + 1/x P(1/x^2)
diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
index fa4609f..08c80a3 100644
--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
+++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
@@ -140,7 +140,6 @@ deval (long double x, const long double *p, int n)
 
 static const long double
 tiny = 1e-4931L,
-  half = 0.5L,
   one = 1.0L,
   two = 2.0L,
   /* 2/sqrt(pi) - 1 */
diff --git a/sysdeps/ieee754/ldbl-128/s_log1pl.c b/sysdeps/ieee754/ldbl-128/s_log1pl.c
index ff759bc..9609550 100644
--- a/sysdeps/ieee754/ldbl-128/s_log1pl.c
+++ b/sysdeps/ieee754/ldbl-128/s_log1pl.c
@@ -117,7 +117,6 @@ static const long double C2 = 1.428606820309417232121458176568075500134E-6L;
 
 static const long double sqrth = 0.7071067811865475244008443621048490392848L;
 /* ln (2^16384 * (1 - 2^-113)) */
-static const long double maxlog = 1.1356523406294143949491931077970764891253E4L;
 static const long double zero = 0.0L;
 
 long double


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