public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2022-04-04 12:52 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-04-04 12:52 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=36c3237a05a982ee42add57970857ff1addbd996

commit 36c3237a05a982ee42add57970857ff1addbd996
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 nptl/tst-thread-setspecific.c         |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 sunrpc/clnt_udp.c                     |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 27 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 2c7ea61c48..5f2ebd3a76 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -374,7 +374,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index 271c5b8810..e1dbe99eb3 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index cdccdd3976..ff45064479 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index e1f68bddfb..cc99b71283 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 31e763130e..0effc51d7c 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/nptl/tst-thread-setspecific.c b/nptl/tst-thread-setspecific.c
index bdfa583efc..5ceaa53556 100644
--- a/nptl/tst-thread-setspecific.c
+++ b/nptl/tst-thread-setspecific.c
@@ -25,7 +25,7 @@
    See BZ #27714.  */
 
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 DIAG_IGNORE_NEEDS_COMMENT (6, "-Wuninitialized");
 
 static int
diff --git a/resolv/res_send.c b/resolv/res_send.c
index d6c85fd7a2..34841da833 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -575,7 +575,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -847,7 +847,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 2ad34050f3..5247a067b1 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1535,7 +1535,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = wcdigits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 12d0d543b1..8b9b9c6ae2 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index c6f0e77057..f4d6e1f814 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index 2f80cca0ab..8ff222e298 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index 208ad445a0..906c665426 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index 22c0d0cc63..8848e3076b 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index 4c4eb7cae9..1d2c9cd090 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 07196ee787..9dcaf8e36c 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 3f750be219..8517d53900 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 97f4e68782..4c0a8e9321 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index dde16148c4..7b5b3bb08a 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index 5617cec0b7..1e9cb3ea42 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index 3ca60a8df7..6021af8595 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2023-08-30 12:34 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2023-08-30 12:34 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6c96319781c9d6815197167e5afcfac661788f97

commit 6c96319781c9d6815197167e5afcfac661788f97
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 nptl/tst-thread-setspecific.c         |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 stdlib/setenv.c                       |  2 +-
 string/wordcopy.c                     |  6 +++---
 sunrpc/clnt_udp.c                     |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 29 files changed, 42 insertions(+), 34 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index ce56d28520..d8cc6ac8ff 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -376,7 +376,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index dada76a51d..f8fbda15a5 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index a5cf108bac..41e350b9aa 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 5732d81bf1..72cf3ee0f7 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 16cc4befb8..04e7f2ef99 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/nptl/tst-thread-setspecific.c b/nptl/tst-thread-setspecific.c
index c0e93381af..0b19cef06f 100644
--- a/nptl/tst-thread-setspecific.c
+++ b/nptl/tst-thread-setspecific.c
@@ -25,7 +25,7 @@
    See BZ #27714.  */
 
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 DIAG_IGNORE_NEEDS_COMMENT (6, "-Wuninitialized");
 
 static int
diff --git a/resolv/res_send.c b/resolv/res_send.c
index d098eba470..4053151a32 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -580,7 +580,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -852,7 +852,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 9b1197d751..eee9835a97 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1560,7 +1560,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = digits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/stdlib/setenv.c b/stdlib/setenv.c
index 02e418522d..720776d8c0 100644
--- a/stdlib/setenv.c
+++ b/stdlib/setenv.c
@@ -25,7 +25,7 @@
    at least through GCC 4.9.2.  Pacify GCC for the entire file, as
    there seems to be no way to pacify GCC selectively, only for the
    place where it's needed.  */
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 #endif
 
 #include <errno.h>
diff --git a/string/wordcopy.c b/string/wordcopy.c
index a8a40c9f01..fe8220c476 100644
--- a/string/wordcopy.c
+++ b/string/wordcopy.c
@@ -29,7 +29,7 @@
    Since the usage is within the MERGE macro we disable the
    warning in the definition, but only in this file.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 #include <memcopy.h>
 DIAG_POP_NEEDS_COMMENT;
 
@@ -112,7 +112,7 @@ WORDCOPY_FWD_ALIGNED (long int dstp, long int srcp, size_t len)
 	 case. The switch case always sets 'a1' and all previous loop
 	 iterations will also have set 'a1' before the use.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
       ((op_t *) dstp)[0] = a1;
       DIAG_POP_NEEDS_COMMENT;
     do7:
@@ -313,7 +313,7 @@ WORDCOPY_BWD_ALIGNED (long int dstp, long int srcp, size_t len)
       a0 = ((op_t *) srcp)[7];
       /* Check the comment on WORDCOPY_FWD_ALIGNED.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
       ((op_t *) dstp)[7] = a1;
       DIAG_POP_NEEDS_COMMENT;
     do7:
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 72c68b6682..c298c8ca03 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index 148c21bb8d..d4fd7f5272 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index e9f8685405..9e97d4a212 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index ab097393bc..e824007913 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index c5c503bc4d..7d8b00c799 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index df8cb67ccb..fa2e94f47e 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 83a6ab8435..2c1196d209 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 8cae5a0b81..f00e78950b 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 0eddf80618..6de9a3128c 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index 91b29333da..2fb3dd5ade 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index f1c58b6bed..52c2f25e47 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index b5a8a06a53..3b8b31e736 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2023-02-09 19:46 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2023-02-09 19:46 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3e48ed5489b234b85e1e33a336b5058aaa82d527

commit 3e48ed5489b234b85e1e33a336b5058aaa82d527
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 nptl/tst-thread-setspecific.c         |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 stdlib/setenv.c                       |  2 +-
 string/wordcopy.c                     |  6 +++---
 sunrpc/clnt_udp.c                     |  2 +-
 sunrpc/netname.c                      |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 30 files changed, 43 insertions(+), 35 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 56e8e6147e..50557427c0 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -374,7 +374,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index dada76a51d..f8fbda15a5 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index a5cf108bac..41e350b9aa 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index af27fd2c52..ecdfe5c46d 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 16cc4befb8..04e7f2ef99 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/nptl/tst-thread-setspecific.c b/nptl/tst-thread-setspecific.c
index c0e93381af..0b19cef06f 100644
--- a/nptl/tst-thread-setspecific.c
+++ b/nptl/tst-thread-setspecific.c
@@ -25,7 +25,7 @@
    See BZ #27714.  */
 
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 DIAG_IGNORE_NEEDS_COMMENT (6, "-Wuninitialized");
 
 static int
diff --git a/resolv/res_send.c b/resolv/res_send.c
index d098eba470..4053151a32 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -580,7 +580,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -852,7 +852,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 4fec12345c..975ea5cb6e 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1535,7 +1535,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = wcdigits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/stdlib/setenv.c b/stdlib/setenv.c
index dda7a4a9c2..ced868007a 100644
--- a/stdlib/setenv.c
+++ b/stdlib/setenv.c
@@ -25,7 +25,7 @@
    at least through GCC 4.9.2.  Pacify GCC for the entire file, as
    there seems to be no way to pacify GCC selectively, only for the
    place where it's needed.  */
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 #endif
 
 #include <errno.h>
diff --git a/string/wordcopy.c b/string/wordcopy.c
index a8a40c9f01..fe8220c476 100644
--- a/string/wordcopy.c
+++ b/string/wordcopy.c
@@ -29,7 +29,7 @@
    Since the usage is within the MERGE macro we disable the
    warning in the definition, but only in this file.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 #include <memcopy.h>
 DIAG_POP_NEEDS_COMMENT;
 
@@ -112,7 +112,7 @@ WORDCOPY_FWD_ALIGNED (long int dstp, long int srcp, size_t len)
 	 case. The switch case always sets 'a1' and all previous loop
 	 iterations will also have set 'a1' before the use.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
       ((op_t *) dstp)[0] = a1;
       DIAG_POP_NEEDS_COMMENT;
     do7:
@@ -313,7 +313,7 @@ WORDCOPY_BWD_ALIGNED (long int dstp, long int srcp, size_t len)
       a0 = ((op_t *) srcp)[7];
       /* Check the comment on WORDCOPY_FWD_ALIGNED.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
       ((op_t *) dstp)[7] = a1;
       DIAG_POP_NEEDS_COMMENT;
     do7:
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sunrpc/netname.c b/sunrpc/netname.c
index dd2cb1b441..7d3749164a 100644
--- a/sunrpc/netname.c
+++ b/sunrpc/netname.c
@@ -53,7 +53,7 @@ user2netname (char netname[MAXNETNAMELEN + 1], const uid_t uid,
      dfltdom, however the above test does check if an overflow would
      happen.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (8, "-Wformat-overflow");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wformat-overflow");
   sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
   DIAG_POP_NEEDS_COMMENT;
   i = strlen (netname);
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 5ef289e8e8..f612174577 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index c6f0e77057..f4d6e1f814 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index e9f8685405..9e97d4a212 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index ab097393bc..e824007913 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index c5c503bc4d..7d8b00c799 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index df8cb67ccb..fa2e94f47e 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 83a6ab8435..2c1196d209 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 8cae5a0b81..f00e78950b 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 0eddf80618..6de9a3128c 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index 91b29333da..2fb3dd5ade 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index f1c58b6bed..52c2f25e47 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index b5a8a06a53..3b8b31e736 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2022-10-28 17:38 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-10-28 17:38 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9ce4c0384faab27f8a7f24a15c6a6b2a8ca0ebb5

commit 9ce4c0384faab27f8a7f24a15c6a6b2a8ca0ebb5
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 nptl/tst-thread-setspecific.c         |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 stdlib/setenv.c                       |  2 +-
 sunrpc/clnt_udp.c                     |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 28 files changed, 39 insertions(+), 31 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 2c7ea61c48..5f2ebd3a76 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -374,7 +374,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index 271c5b8810..e1dbe99eb3 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index cdccdd3976..ff45064479 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 3368532adf..b05157f40b 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 31e763130e..0effc51d7c 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/nptl/tst-thread-setspecific.c b/nptl/tst-thread-setspecific.c
index bdfa583efc..5ceaa53556 100644
--- a/nptl/tst-thread-setspecific.c
+++ b/nptl/tst-thread-setspecific.c
@@ -25,7 +25,7 @@
    See BZ #27714.  */
 
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 DIAG_IGNORE_NEEDS_COMMENT (6, "-Wuninitialized");
 
 static int
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 6a08e729a4..9200e496bc 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -580,7 +580,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -852,7 +852,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 2ad34050f3..5247a067b1 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1535,7 +1535,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = wcdigits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/stdlib/setenv.c b/stdlib/setenv.c
index 2add8bfb41..041f272e9c 100644
--- a/stdlib/setenv.c
+++ b/stdlib/setenv.c
@@ -25,7 +25,7 @@
    at least through GCC 4.9.2.  Pacify GCC for the entire file, as
    there seems to be no way to pacify GCC selectively, only for the
    place where it's needed.  */
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 #endif
 
 #include <errno.h>
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 5ef289e8e8..f612174577 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index c6f0e77057..f4d6e1f814 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index 2f80cca0ab..8ff222e298 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index 208ad445a0..906c665426 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index 22c0d0cc63..8848e3076b 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index 4c4eb7cae9..1d2c9cd090 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 07196ee787..9dcaf8e36c 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 3f750be219..8517d53900 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 97f4e68782..4c0a8e9321 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index dde16148c4..7b5b3bb08a 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index 5617cec0b7..1e9cb3ea42 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index 3ca60a8df7..6021af8595 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2022-10-04 12:56 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-10-04 12:56 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4f4e3d317147c53a43785080c716a7f97c9a630f

commit 4f4e3d317147c53a43785080c716a7f97c9a630f
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 nptl/tst-thread-setspecific.c         |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 stdlib/setenv.c                       |  2 +-
 sunrpc/clnt_udp.c                     |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 28 files changed, 39 insertions(+), 31 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 2c7ea61c48..5f2ebd3a76 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -374,7 +374,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index 271c5b8810..e1dbe99eb3 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index cdccdd3976..ff45064479 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index 3368532adf..b05157f40b 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 31e763130e..0effc51d7c 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/nptl/tst-thread-setspecific.c b/nptl/tst-thread-setspecific.c
index bdfa583efc..5ceaa53556 100644
--- a/nptl/tst-thread-setspecific.c
+++ b/nptl/tst-thread-setspecific.c
@@ -25,7 +25,7 @@
    See BZ #27714.  */
 
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 DIAG_IGNORE_NEEDS_COMMENT (6, "-Wuninitialized");
 
 static int
diff --git a/resolv/res_send.c b/resolv/res_send.c
index 6a08e729a4..9200e496bc 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -580,7 +580,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -852,7 +852,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 2ad34050f3..5247a067b1 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1535,7 +1535,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = wcdigits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/stdlib/setenv.c b/stdlib/setenv.c
index 2add8bfb41..041f272e9c 100644
--- a/stdlib/setenv.c
+++ b/stdlib/setenv.c
@@ -25,7 +25,7 @@
    at least through GCC 4.9.2.  Pacify GCC for the entire file, as
    there seems to be no way to pacify GCC selectively, only for the
    place where it's needed.  */
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 #endif
 
 #include <errno.h>
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 5ef289e8e8..f612174577 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index c6f0e77057..f4d6e1f814 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index 2f80cca0ab..8ff222e298 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index 208ad445a0..906c665426 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index 22c0d0cc63..8848e3076b 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index 4c4eb7cae9..1d2c9cd090 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 07196ee787..9dcaf8e36c 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 3f750be219..8517d53900 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 97f4e68782..4c0a8e9321 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index dde16148c4..7b5b3bb08a 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index 5617cec0b7..1e9cb3ea42 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index 3ca60a8df7..6021af8595 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2022-06-09 21:18 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 21:18 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=965c7cd1ce9154ed590cbe01189b8818022fa041

commit 965c7cd1ce9154ed590cbe01189b8818022fa041
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 nptl/tst-thread-setspecific.c         |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 sunrpc/clnt_udp.c                     |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 27 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 2c7ea61c48..5f2ebd3a76 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -374,7 +374,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index 271c5b8810..e1dbe99eb3 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index cdccdd3976..ff45064479 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index e1f68bddfb..cc99b71283 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 31e763130e..0effc51d7c 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/nptl/tst-thread-setspecific.c b/nptl/tst-thread-setspecific.c
index bdfa583efc..5ceaa53556 100644
--- a/nptl/tst-thread-setspecific.c
+++ b/nptl/tst-thread-setspecific.c
@@ -25,7 +25,7 @@
    See BZ #27714.  */
 
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 DIAG_IGNORE_NEEDS_COMMENT (6, "-Wuninitialized");
 
 static int
diff --git a/resolv/res_send.c b/resolv/res_send.c
index d6c85fd7a2..34841da833 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -575,7 +575,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -847,7 +847,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 2ad34050f3..5247a067b1 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1535,7 +1535,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = wcdigits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 12d0d543b1..8b9b9c6ae2 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index c6f0e77057..f4d6e1f814 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index 2f80cca0ab..8ff222e298 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index 208ad445a0..906c665426 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index 22c0d0cc63..8848e3076b 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index 4c4eb7cae9..1d2c9cd090 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 07196ee787..9dcaf8e36c 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 3f750be219..8517d53900 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 97f4e68782..4c0a8e9321 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index dde16148c4..7b5b3bb08a 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index 5617cec0b7..1e9cb3ea42 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index 3ca60a8df7..6021af8595 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2022-06-09 13:14 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 13:14 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=965c7cd1ce9154ed590cbe01189b8818022fa041

commit 965c7cd1ce9154ed590cbe01189b8818022fa041
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 nptl/tst-thread-setspecific.c         |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 sunrpc/clnt_udp.c                     |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 27 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 2c7ea61c48..5f2ebd3a76 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -374,7 +374,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index 271c5b8810..e1dbe99eb3 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index cdccdd3976..ff45064479 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index e1f68bddfb..cc99b71283 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 31e763130e..0effc51d7c 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/nptl/tst-thread-setspecific.c b/nptl/tst-thread-setspecific.c
index bdfa583efc..5ceaa53556 100644
--- a/nptl/tst-thread-setspecific.c
+++ b/nptl/tst-thread-setspecific.c
@@ -25,7 +25,7 @@
    See BZ #27714.  */
 
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 DIAG_IGNORE_NEEDS_COMMENT (6, "-Wuninitialized");
 
 static int
diff --git a/resolv/res_send.c b/resolv/res_send.c
index d6c85fd7a2..34841da833 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -575,7 +575,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -847,7 +847,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 2ad34050f3..5247a067b1 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1535,7 +1535,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = wcdigits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 12d0d543b1..8b9b9c6ae2 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index c6f0e77057..f4d6e1f814 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index 2f80cca0ab..8ff222e298 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index 208ad445a0..906c665426 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index 22c0d0cc63..8848e3076b 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index 4c4eb7cae9..1d2c9cd090 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 07196ee787..9dcaf8e36c 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 3f750be219..8517d53900 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 97f4e68782..4c0a8e9321 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index dde16148c4..7b5b3bb08a 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index 5617cec0b7..1e9cb3ea42 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index 3ca60a8df7..6021af8595 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2022-06-03 14:04 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-06-03 14:04 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d3209c3ece8e9fdc0b0778af5f5f80c8577c05e2

commit d3209c3ece8e9fdc0b0778af5f5f80c8577c05e2
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 nptl/tst-thread-setspecific.c         |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 sunrpc/clnt_udp.c                     |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 27 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 2c7ea61c48..5f2ebd3a76 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -374,7 +374,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index 271c5b8810..e1dbe99eb3 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index cdccdd3976..ff45064479 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index e1f68bddfb..cc99b71283 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 31e763130e..0effc51d7c 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/nptl/tst-thread-setspecific.c b/nptl/tst-thread-setspecific.c
index bdfa583efc..5ceaa53556 100644
--- a/nptl/tst-thread-setspecific.c
+++ b/nptl/tst-thread-setspecific.c
@@ -25,7 +25,7 @@
    See BZ #27714.  */
 
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 DIAG_IGNORE_NEEDS_COMMENT (6, "-Wuninitialized");
 
 static int
diff --git a/resolv/res_send.c b/resolv/res_send.c
index d6c85fd7a2..34841da833 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -575,7 +575,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -847,7 +847,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 2ad34050f3..5247a067b1 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1535,7 +1535,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = wcdigits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 12d0d543b1..8b9b9c6ae2 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index c6f0e77057..f4d6e1f814 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index 2f80cca0ab..8ff222e298 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index 208ad445a0..906c665426 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index 22c0d0cc63..8848e3076b 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index 4c4eb7cae9..1d2c9cd090 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 07196ee787..9dcaf8e36c 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 3f750be219..8517d53900 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 97f4e68782..4c0a8e9321 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index dde16148c4..7b5b3bb08a 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index 5617cec0b7..1e9cb3ea42 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index 3ca60a8df7..6021af8595 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2022-05-13 14:17 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-05-13 14:17 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=592258003b9912a2ed7567519bbd1d3a8d58619a

commit 592258003b9912a2ed7567519bbd1d3a8d58619a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 nptl/tst-thread-setspecific.c         |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 sunrpc/clnt_udp.c                     |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 27 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 2c7ea61c48..5f2ebd3a76 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -374,7 +374,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index 271c5b8810..e1dbe99eb3 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index cdccdd3976..ff45064479 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index e1f68bddfb..cc99b71283 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 31e763130e..0effc51d7c 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/nptl/tst-thread-setspecific.c b/nptl/tst-thread-setspecific.c
index bdfa583efc..5ceaa53556 100644
--- a/nptl/tst-thread-setspecific.c
+++ b/nptl/tst-thread-setspecific.c
@@ -25,7 +25,7 @@
    See BZ #27714.  */
 
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 DIAG_IGNORE_NEEDS_COMMENT (6, "-Wuninitialized");
 
 static int
diff --git a/resolv/res_send.c b/resolv/res_send.c
index d6c85fd7a2..34841da833 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -575,7 +575,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -847,7 +847,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 2ad34050f3..5247a067b1 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1535,7 +1535,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = wcdigits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 12d0d543b1..8b9b9c6ae2 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index c6f0e77057..f4d6e1f814 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index 2f80cca0ab..8ff222e298 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index 208ad445a0..906c665426 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index 22c0d0cc63..8848e3076b 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index 4c4eb7cae9..1d2c9cd090 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 07196ee787..9dcaf8e36c 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 3f750be219..8517d53900 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 97f4e68782..4c0a8e9321 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index dde16148c4..7b5b3bb08a 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index 5617cec0b7..1e9cb3ea42 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index 3ca60a8df7..6021af8595 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2022-05-12 19:31 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-05-12 19:31 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=af1f0dca75cf378b8d182d8932cae8c4fbff5d88

commit af1f0dca75cf378b8d182d8932cae8c4fbff5d88
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 nptl/tst-thread-setspecific.c         |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 sunrpc/clnt_udp.c                     |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 27 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 2c7ea61c48..5f2ebd3a76 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -374,7 +374,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index 271c5b8810..e1dbe99eb3 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index cdccdd3976..ff45064479 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index e1f68bddfb..cc99b71283 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 31e763130e..0effc51d7c 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/nptl/tst-thread-setspecific.c b/nptl/tst-thread-setspecific.c
index bdfa583efc..5ceaa53556 100644
--- a/nptl/tst-thread-setspecific.c
+++ b/nptl/tst-thread-setspecific.c
@@ -25,7 +25,7 @@
    See BZ #27714.  */
 
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 DIAG_IGNORE_NEEDS_COMMENT (6, "-Wuninitialized");
 
 static int
diff --git a/resolv/res_send.c b/resolv/res_send.c
index d6c85fd7a2..34841da833 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -575,7 +575,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -847,7 +847,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 2ad34050f3..5247a067b1 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1535,7 +1535,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = wcdigits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 12d0d543b1..8b9b9c6ae2 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index c6f0e77057..f4d6e1f814 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index 2f80cca0ab..8ff222e298 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index 208ad445a0..906c665426 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index 22c0d0cc63..8848e3076b 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index 4c4eb7cae9..1d2c9cd090 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 07196ee787..9dcaf8e36c 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 3f750be219..8517d53900 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 97f4e68782..4c0a8e9321 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index dde16148c4..7b5b3bb08a 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index 5617cec0b7..1e9cb3ea42 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index 3ca60a8df7..6021af8595 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2022-05-10 18:22 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-05-10 18:22 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c1f72ba4974965dc0f0701011559bb567409b2c9

commit c1f72ba4974965dc0f0701011559bb567409b2c9
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 nptl/tst-thread-setspecific.c         |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 sunrpc/clnt_udp.c                     |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 27 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 2c7ea61c48..5f2ebd3a76 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -374,7 +374,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index 271c5b8810..e1dbe99eb3 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index cdccdd3976..ff45064479 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index e1f68bddfb..cc99b71283 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 31e763130e..0effc51d7c 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/nptl/tst-thread-setspecific.c b/nptl/tst-thread-setspecific.c
index bdfa583efc..5ceaa53556 100644
--- a/nptl/tst-thread-setspecific.c
+++ b/nptl/tst-thread-setspecific.c
@@ -25,7 +25,7 @@
    See BZ #27714.  */
 
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 DIAG_IGNORE_NEEDS_COMMENT (6, "-Wuninitialized");
 
 static int
diff --git a/resolv/res_send.c b/resolv/res_send.c
index d6c85fd7a2..34841da833 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -575,7 +575,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -847,7 +847,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 2ad34050f3..5247a067b1 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1535,7 +1535,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = wcdigits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 12d0d543b1..8b9b9c6ae2 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index c6f0e77057..f4d6e1f814 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index 2f80cca0ab..8ff222e298 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index 208ad445a0..906c665426 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index 22c0d0cc63..8848e3076b 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index 4c4eb7cae9..1d2c9cd090 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 07196ee787..9dcaf8e36c 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 3f750be219..8517d53900 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 97f4e68782..4c0a8e9321 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index dde16148c4..7b5b3bb08a 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index 5617cec0b7..1e9cb3ea42 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index 3ca60a8df7..6021af8595 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2022-04-29 14:02 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-04-29 14:02 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ff0d91d1e5d8f21ab9b14f60f9fa3b4c02631a8c

commit ff0d91d1e5d8f21ab9b14f60f9fa3b4c02631a8c
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 nptl/tst-thread-setspecific.c         |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 sunrpc/clnt_udp.c                     |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 27 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 2c7ea61c48..5f2ebd3a76 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -374,7 +374,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index 271c5b8810..e1dbe99eb3 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index cdccdd3976..ff45064479 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index e1f68bddfb..cc99b71283 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 31e763130e..0effc51d7c 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/nptl/tst-thread-setspecific.c b/nptl/tst-thread-setspecific.c
index bdfa583efc..5ceaa53556 100644
--- a/nptl/tst-thread-setspecific.c
+++ b/nptl/tst-thread-setspecific.c
@@ -25,7 +25,7 @@
    See BZ #27714.  */
 
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 DIAG_IGNORE_NEEDS_COMMENT (6, "-Wuninitialized");
 
 static int
diff --git a/resolv/res_send.c b/resolv/res_send.c
index d6c85fd7a2..34841da833 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -575,7 +575,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -847,7 +847,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 2ad34050f3..5247a067b1 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1535,7 +1535,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = wcdigits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 12d0d543b1..8b9b9c6ae2 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index c6f0e77057..f4d6e1f814 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index 2f80cca0ab..8ff222e298 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index 208ad445a0..906c665426 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index 22c0d0cc63..8848e3076b 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index 4c4eb7cae9..1d2c9cd090 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 07196ee787..9dcaf8e36c 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 3f750be219..8517d53900 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 97f4e68782..4c0a8e9321 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index dde16148c4..7b5b3bb08a 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index 5617cec0b7..1e9cb3ea42 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index 3ca60a8df7..6021af8595 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2022-03-31 19:04 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-03-31 19:04 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f9a126c3b605c22973444a3c142023d50812ad6c

commit f9a126c3b605c22973444a3c142023d50812ad6c
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 nptl/tst-thread-setspecific.c         |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 sunrpc/clnt_udp.c                     |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 27 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 2c7ea61c48..5f2ebd3a76 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -374,7 +374,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index 271c5b8810..e1dbe99eb3 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index cdccdd3976..ff45064479 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index e1f68bddfb..cc99b71283 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 31e763130e..0effc51d7c 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/nptl/tst-thread-setspecific.c b/nptl/tst-thread-setspecific.c
index bdfa583efc..5ceaa53556 100644
--- a/nptl/tst-thread-setspecific.c
+++ b/nptl/tst-thread-setspecific.c
@@ -25,7 +25,7 @@
    See BZ #27714.  */
 
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
 DIAG_IGNORE_NEEDS_COMMENT (6, "-Wuninitialized");
 
 static int
diff --git a/resolv/res_send.c b/resolv/res_send.c
index d6c85fd7a2..34841da833 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -575,7 +575,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -847,7 +847,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 2ad34050f3..5247a067b1 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1535,7 +1535,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = wcdigits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 12d0d543b1..8b9b9c6ae2 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index c6f0e77057..f4d6e1f814 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index 2f80cca0ab..8ff222e298 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index 208ad445a0..906c665426 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index 22c0d0cc63..8848e3076b 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index 4c4eb7cae9..1d2c9cd090 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 07196ee787..9dcaf8e36c 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 3f750be219..8517d53900 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 97f4e68782..4c0a8e9321 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index dde16148c4..7b5b3bb08a 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index 5617cec0b7..1e9cb3ea42 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index 3ca60a8df7..6021af8595 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC
@ 2022-03-29 20:27 Adhemerval Zanella
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-03-29 20:27 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4e9f7d759b0e0c6cce8d30c57d944c1994d1fbf8

commit 4e9f7d759b0e0c6cce8d30c57d944c1994d1fbf8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Mar 9 15:51:50 2022 -0300

    Add DIAG_IGNORE_NEEDS_COMMENT_GCC
    
    To handle compilers that does not support GCC only options, such as
    -Wmaybe-uninitialized.

Diff:
---
 hurd/hurdsig.c                        |  2 +-
 include/libc-diag.h                   |  8 ++++++++
 inet/net-internal.h                   |  2 +-
 malloc/malloc-check.c                 |  2 +-
 nis/nis_table.c                       |  2 +-
 resolv/res_send.c                     | 10 +++++-----
 stdio-common/vfscanf-internal.c       |  2 +-
 stdlib/bug-getcontext.c               |  2 +-
 sunrpc/clnt_udp.c                     |  2 +-
 sysdeps/ieee754/dbl-64/e_lgamma_r.c   |  2 +-
 sysdeps/ieee754/dbl-64/k_rem_pio2.c   |  2 +-
 sysdeps/ieee754/flt-32/e_lgammaf_r.c  |  2 +-
 sysdeps/ieee754/ldbl-128/k_tanl.c     |  2 +-
 sysdeps/ieee754/ldbl-128ibm/k_tanl.c  |  2 +-
 sysdeps/ieee754/ldbl-96/e_lgammal_r.c |  2 +-
 sysdeps/ieee754/ldbl-96/k_tanl.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ddivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dfmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_dsqrtl.c    |  2 +-
 sysdeps/ieee754/soft-fp/s_fdiv.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fdivl.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_ffma.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_ffmal.c     |  2 +-
 sysdeps/ieee754/soft-fp/s_fma.c       |  2 +-
 sysdeps/ieee754/soft-fp/s_fmaf.c      |  2 +-
 sysdeps/ieee754/soft-fp/s_fmal.c      |  2 +-
 26 files changed, 37 insertions(+), 29 deletions(-)

diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 2c7ea61c48..5f2ebd3a76 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -374,7 +374,7 @@ interrupted_reply_port_location (thread_t thread,
   /* GCC 6 and before seem to be confused by the setjmp call inside
      _hurdsig_catch_memory_fault and think that we may be returning a second
      time to here with portloc uninitialized (but we never do). */
-  DIAG_IGNORE_NEEDS_COMMENT (6, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (6, "-Wmaybe-uninitialized");
   /* Fault now if this pointer is bogus.  */
   *(volatile mach_port_t *) portloc = *portloc;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/include/libc-diag.h b/include/libc-diag.h
index 271c5b8810..e1dbe99eb3 100644
--- a/include/libc-diag.h
+++ b/include/libc-diag.h
@@ -71,4 +71,12 @@
 # define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
 #endif
 
+/* Some warnings are not support for all compilers.  */
+#ifndef __clang__
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING) \
+    DIAG_IGNORE_NEEDS_COMMENT (VERSION, WARNING)
+#else
+# define DIAG_IGNORE_NEEDS_COMMENT_GCC(VERSION, WARNING)
+#endif
+
 #endif /* libc-diag.h */
diff --git a/inet/net-internal.h b/inet/net-internal.h
index cdccdd3976..ff45064479 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -106,7 +106,7 @@ __deadline_is_infinite (struct deadline deadline)
  *    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691
  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 
 /* Return true if the current time is at the deadline or past it.  */
 static inline bool
diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c
index e1f68bddfb..cc99b71283 100644
--- a/malloc/malloc-check.c
+++ b/malloc/malloc-check.c
@@ -319,7 +319,7 @@ realloc_check (void *oldmem, size_t bytes)
 #if __GNUC_PREREQ (7, 0)
   /* GCC 7 warns about magic_p may be used uninitialized.  But we never
      reach here if magic_p is uninitialized.  */
-  DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #endif
   /* mem2chunk_check changed the magic byte in the old chunk.
      If newmem is NULL, then the old chunk will still be used though,
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 31e763130e..0effc51d7c 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -180,7 +180,7 @@ __follow_path (char **tablepath, char **tableptr, struct ib_request *ibreq,
   /* Since tableptr is only set here, and it's set when tablepath is NULL,
      which it is initially defined as, we know it will always be set here.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
   if (*tableptr == NULL)
     return NIS_NOTFOUND;
diff --git a/resolv/res_send.c b/resolv/res_send.c
index d6c85fd7a2..34841da833 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -266,7 +266,7 @@ __res_context_send (struct resolv_context *ctx,
 	   Here the variable n is set to the return value of send_vc.
 	   See below.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 	int n;
 	DIAG_POP_NEEDS_COMMENT;
 
@@ -364,7 +364,7 @@ __res_context_send (struct resolv_context *ctx,
 				return (-1);
 			/* See comment at the declaration of n.  */
 			DIAG_PUSH_NEEDS_COMMENT;
-			DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+			DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
 				goto next_ns;
 			DIAG_POP_NEEDS_COMMENT;
@@ -388,7 +388,7 @@ __res_context_send (struct resolv_context *ctx,
 
 		/* See comment at the declaration of n.  Note: resplen = n;  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
 		/* Mask the AD bit in both responses unless it is
 		   marked trusted.  */
 		if (resplen > HFIXEDSZ)
@@ -575,7 +575,7 @@ send_vc(res_state statp,
 	   a false-positive.
 	 */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 	int resplen;
 	DIAG_POP_NEEDS_COMMENT;
 	struct iovec iov[4];
@@ -847,7 +847,7 @@ reopen (res_state statp, int *terrno, int ns)
 		   the function return -1 before control flow reaches
 		   the call to connect with slen.  */
 		DIAG_PUSH_NEEDS_COMMENT;
-		DIAG_IGNORE_Os_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+		DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
 		if (__connect (EXT (statp).nssocks[ns], nsap, slen) < 0) {
 		DIAG_POP_NEEDS_COMMENT;
 			__res_iclose(statp, false);
diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
index 2ad34050f3..5247a067b1 100644
--- a/stdio-common/vfscanf-internal.c
+++ b/stdio-common/vfscanf-internal.c
@@ -1535,7 +1535,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
 			 above, but the test for "map != NULL" is done
 			 inside the loop here and outside the loop there.  */
 		      DIAG_PUSH_NEEDS_COMMENT;
-		      DIAG_IGNORE_NEEDS_COMMENT (4.7, "-Wmaybe-uninitialized");
+		      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.7, "-Wmaybe-uninitialized");
 
 		      if (__glibc_unlikely (map != NULL))
 			wcdigits[n] = wcdigits_extended[n];
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index 55c681c480..9e5e6c7e1c 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -56,7 +56,7 @@ do_test (void)
      in local variables being clobbered on the second return from
      getcontext), in fact an uninitialized use is not possible.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
   int mask = fegetexcept ();
   if (mask != except_mask)
     {
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index ee79b09b40..4353e5da18 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -299,7 +299,7 @@ clntudp_call (/* client handle */
      inet/net-internal.h because in some other configurations GCC
      gives the warning in an inline function.  */
   DIAG_PUSH_NEEDS_COMMENT;
-  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (10, "-Wmaybe-uninitialized");
   struct deadline total_deadline; /* Determined once by overall timeout.  */
   DIAG_POP_NEEDS_COMMENT;
   struct deadline response_deadline; /* Determined anew for each query.  */
diff --git a/sysdeps/ieee754/dbl-64/e_lgamma_r.c b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
index 12d0d543b1..8b9b9c6ae2 100644
--- a/sysdeps/ieee754/dbl-64/e_lgamma_r.c
+++ b/sysdeps/ieee754/dbl-64/e_lgamma_r.c
@@ -304,7 +304,7 @@ __ieee754_lgamma_r(double x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/dbl-64/k_rem_pio2.c b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
index 6e2ef5d07b..78d1ea09ad 100644
--- a/sysdeps/ieee754/dbl-64/k_rem_pio2.c
+++ b/sysdeps/ieee754/dbl-64/k_rem_pio2.c
@@ -337,7 +337,7 @@ recompute:
 	 to full precision (this function is not called for zero
 	 arguments).  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (9, "-Wmaybe-uninitialized");
       fv = math_narrow_eval (fq[0] - fv);
       DIAG_POP_NEEDS_COMMENT;
       for (i = 1; i <= jz; i++)
diff --git a/sysdeps/ieee754/flt-32/e_lgammaf_r.c b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
index a1a3a60454..77dc54eaeb 100644
--- a/sysdeps/ieee754/flt-32/e_lgammaf_r.c
+++ b/sysdeps/ieee754/flt-32/e_lgammaf_r.c
@@ -239,7 +239,7 @@ __ieee754_lgammaf_r(float x, int *signgamp)
 	   although in the cases where it is used it has always been
 	   set.  */
 	DIAG_PUSH_NEEDS_COMMENT;
-	DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+	DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 	if(hx<0) r = nadj - r;
 	DIAG_POP_NEEDS_COMMENT;
 	return r;
diff --git a/sysdeps/ieee754/ldbl-128/k_tanl.c b/sysdeps/ieee754/ldbl-128/k_tanl.c
index 8e93626a89..af10fbc64b 100644
--- a/sysdeps/ieee754/ldbl-128/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (_Float128 x, _Float128 y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
index cd95e46089..7a42a18e55 100644
--- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c
@@ -143,7 +143,7 @@ __kernel_tanl (long double x, long double y, int iy)
 	 uninitialized although in the cases where it is used it has
 	 always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (5, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
index c6f0e77057..f4d6e1f814 100644
--- a/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
+++ b/sysdeps/ieee754/ldbl-96/e_lgammal_r.c
@@ -431,7 +431,7 @@ __ieee754_lgammal_r (long double x, int *signgamp)
      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;
-  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+  DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
   if (se & 0x8000)
     r = nadj - r;
   DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/ldbl-96/k_tanl.c b/sysdeps/ieee754/ldbl-96/k_tanl.c
index 43a5aa4423..462795574f 100644
--- a/sysdeps/ieee754/ldbl-96/k_tanl.c
+++ b/sysdeps/ieee754/ldbl-96/k_tanl.c
@@ -140,7 +140,7 @@ __kernel_tanl (long double x, long double y, int iy)
         uninitialized although in the cases where it is used it has
         always been set.  */
       DIAG_PUSH_NEEDS_COMMENT;
-      DIAG_IGNORE_NEEDS_COMMENT (4.8, "-Wmaybe-uninitialized");
+      DIAG_IGNORE_NEEDS_COMMENT_GCC (4.8, "-Wmaybe-uninitialized");
       if (sign < 0)
 	w = -w;
       DIAG_POP_NEEDS_COMMENT;
diff --git a/sysdeps/ieee754/soft-fp/s_ddivl.c b/sysdeps/ieee754/soft-fp/s_ddivl.c
index 2f80cca0ab..8ff222e298 100644
--- a/sysdeps/ieee754/soft-fp/s_ddivl.c
+++ b/sysdeps/ieee754/soft-fp/s_ddivl.c
@@ -37,7 +37,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dfmal.c b/sysdeps/ieee754/soft-fp/s_dfmal.c
index 208ad445a0..906c665426 100644
--- a/sysdeps/ieee754/soft-fp/s_dfmal.c
+++ b/sysdeps/ieee754/soft-fp/s_dfmal.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_dsqrtl.c b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
index 22c0d0cc63..8848e3076b 100644
--- a/sysdeps/ieee754/soft-fp/s_dsqrtl.c
+++ b/sysdeps/ieee754/soft-fp/s_dsqrtl.c
@@ -35,7 +35,7 @@
    does not see that they are set in all cases where they are used,
    resulting in warnings that they may be used uninitialized.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (7, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (7, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <double.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index 4c4eb7cae9..1d2c9cd090 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -34,7 +34,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fdivl.c b/sysdeps/ieee754/soft-fp/s_fdivl.c
index 07196ee787..9dcaf8e36c 100644
--- a/sysdeps/ieee754/soft-fp/s_fdivl.c
+++ b/sysdeps/ieee754/soft-fp/s_fdivl.c
@@ -33,7 +33,7 @@
    versions of GCC, it may be where R is defined using a macro or it
    may be where the macro is defined.  This happens only with -O1.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
+(8);
 #include <soft-fp.h>
 #include <single.h>
 #include <quad.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffma.c b/sysdeps/ieee754/soft-fp/s_ffma.c
index 3f750be219..8517d53900 100644
--- a/sysdeps/ieee754/soft-fp/s_ffma.c
+++ b/sysdeps/ieee754/soft-fp/s_ffma.c
@@ -35,7 +35,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_ffmal.c b/sysdeps/ieee754/soft-fp/s_ffmal.c
index 97f4e68782..4c0a8e9321 100644
--- a/sysdeps/ieee754/soft-fp/s_ffmal.c
+++ b/sysdeps/ieee754/soft-fp/s_ffmal.c
@@ -33,7 +33,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include <soft-fp.h>
 #include <single.h>
diff --git a/sysdeps/ieee754/soft-fp/s_fma.c b/sysdeps/ieee754/soft-fp/s_fma.c
index dde16148c4..7b5b3bb08a 100644
--- a/sysdeps/ieee754/soft-fp/s_fma.c
+++ b/sysdeps/ieee754/soft-fp/s_fma.c
@@ -42,7 +42,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "double.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmaf.c b/sysdeps/ieee754/soft-fp/s_fmaf.c
index 5617cec0b7..1e9cb3ea42 100644
--- a/sysdeps/ieee754/soft-fp/s_fmaf.c
+++ b/sysdeps/ieee754/soft-fp/s_fmaf.c
@@ -37,7 +37,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "single.h"
diff --git a/sysdeps/ieee754/soft-fp/s_fmal.c b/sysdeps/ieee754/soft-fp/s_fmal.c
index 3ca60a8df7..6021af8595 100644
--- a/sysdeps/ieee754/soft-fp/s_fmal.c
+++ b/sysdeps/ieee754/soft-fp/s_fmal.c
@@ -40,7 +40,7 @@
    it may be where R is defined using a macro or it may be where the
    macro is defined.  */
 DIAG_PUSH_NEEDS_COMMENT;
-DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized");
+DIAG_IGNORE_NEEDS_COMMENT_GCC (4.9, "-Wmaybe-uninitialized");
 
 #include "soft-fp.h"
 #include "quad.h"


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-08-30 12:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 12:52 [glibc/azanella/clang] Add DIAG_IGNORE_NEEDS_COMMENT_GCC Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2023-08-30 12:34 Adhemerval Zanella
2023-02-09 19:46 Adhemerval Zanella
2022-10-28 17:38 Adhemerval Zanella
2022-10-04 12:56 Adhemerval Zanella
2022-06-09 21:18 Adhemerval Zanella
2022-06-09 13:14 Adhemerval Zanella
2022-06-03 14:04 Adhemerval Zanella
2022-05-13 14:17 Adhemerval Zanella
2022-05-12 19:31 Adhemerval Zanella
2022-05-10 18:22 Adhemerval Zanella
2022-04-29 14:02 Adhemerval Zanella
2022-03-31 19:04 Adhemerval Zanella
2022-03-29 20:27 Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).