]> sourceware.org Git - glibc.git/commitdiff
Fix ldbl-128 / ldbl-128ibm tanl for -Wuninitialized.
authorJoseph Myers <joseph@codesourcery.com>
Fri, 22 May 2015 20:13:44 +0000 (20:13 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 22 May 2015 20:13:44 +0000 (20:13 +0000)
The ldbl-128 and ldbl-128ibm implementations of tanl produce
uninitialized variable warnings with -Wuninitialized because of a
variable that is initialized only conditionally, then used under the
same conditions under which it is set.  This patch uses DIAG_* macros
to suppress those warnings.

Tested for powerpc and mips64.

* sysdeps/ieee754/ldbl-128/k_tanl.c: Include <libc-internal.h>.
(__kernel_tanl): Ignore uninitialized warnings around use of SIGN.
* sysdeps/ieee754/ldbl-128ibm/k_tanl.c: Include <libc-internal.h>.
(__kernel_tanl): Ignore uninitialized warnings around use of SIGN.

ChangeLog
sysdeps/ieee754/ldbl-128/k_tanl.c
sysdeps/ieee754/ldbl-128ibm/k_tanl.c

index 5b31961d176c7d5a3e366fc6af7594b733d33973..159eb4ab6fba5bce2e590493d386198bcb5008d3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2015-05-22  Joseph Myers  <joseph@codesourcery.com>
 
+       * sysdeps/ieee754/ldbl-128/k_tanl.c: Include <libc-internal.h>.
+       (__kernel_tanl): Ignore uninitialized warnings around use of SIGN.
+       * sysdeps/ieee754/ldbl-128ibm/k_tanl.c: Include <libc-internal.h>.
+       (__kernel_tanl): Ignore uninitialized warnings around use of SIGN.
+
        * sysdeps/ieee754/ldbl-128/s_erfl.c (__erfcl): Make case 9 in
        switch statement into default case.
        * sysdeps/ieee754/ldbl-128ibm/s_erfl.c (__erfcl): Likewise.
index 140ce959a6a1bc8ea0a973ebf72ebde2cc576ef3..dfba2d9a76e5e453d82bc5dd43835d481f8b78a4 100644 (file)
@@ -56,6 +56,7 @@
  *                    = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y)))
  */
 
+#include <libc-internal.h>
 #include <math.h>
 #include <math_private.h>
 static const long double
@@ -129,8 +130,19 @@ __kernel_tanl (long double x, long double y, int iy)
     {
       v = (long double) iy;
       w = (v - 2.0 * (x - (w * w / (w + v) - r)));
+      /* SIGN is set for arguments that reach this code, but not
+        otherwise, resulting in warnings that it may be used
+        uninitialized although in the cases where it is used it has
+        always been set.  */
+      DIAG_PUSH_NEEDS_COMMENT;
+#if __GNUC_PREREQ (4, 7)
+      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+#else
+      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wuninitialized");
+#endif
       if (sign < 0)
        w = -w;
+      DIAG_POP_NEEDS_COMMENT;
       return w;
     }
   if (iy == 1)
index bcf8b5e7d6b8997dce83b32b62f0a6f723092e9c..7f1caeebdf9e7ca266a9cb68e65c179de79b54b3 100644 (file)
@@ -56,6 +56,7 @@
  *                    = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y)))
  */
 
+#include <libc-internal.h>
 #include <math.h>
 #include <math_private.h>
 static const long double
@@ -129,8 +130,19 @@ __kernel_tanl (long double x, long double y, int iy)
     {
       v = (long double) iy;
       w = (v - 2.0 * (x - (w * w / (w + v) - r)));
+      /* SIGN is set for arguments that reach this code, but not
+        otherwise, resulting in warnings that it may be used
+        uninitialized although in the cases where it is used it has
+        always been set.  */
+      DIAG_PUSH_NEEDS_COMMENT;
+#if __GNUC_PREREQ (4, 7)
+      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+#else
+      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wuninitialized");
+#endif
       if (sign < 0)
        w = -w;
+      DIAG_POP_NEEDS_COMMENT;
       return w;
     }
   if (iy == 1)
This page took 0.162109 seconds and 5 git commands to generate.