[glibc] gnulib: Fix tst-gcc.c build with clang-23

Adhemerval Zanella via Glibc-cvs <[email protected]>
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b4d9c2d67c0c192e5c31a1ea239f213ffa501e50

commit b4d9c2d67c0c192e5c31a1ea239f213ffa501e50
Author: Adhemerval Zanella <[email protected]>
Date:   Tue Aug 11 14:26:58 2026 -0300

    gnulib: Fix tst-gcc.c build with clang-23
    
    clang-23 changed its uninitialized-use analysis to consider the operand
    used.

Diff:
---
 gnulib/tst-gcc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gnulib/tst-gcc.c b/gnulib/tst-gcc.c
index aad8a4f12c..c1378972d8 100644
--- a/gnulib/tst-gcc.c
+++ b/gnulib/tst-gcc.c
@@ -17,6 +17,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <stdio.h>
+#include <libc-diag.h>
 
 #define __no_type_class		-1
 #define __void_type_class	 0
@@ -61,12 +62,17 @@ do_test (void)
   struct { int a; } __record_type;
   union { int a; int b; } __union_type;
 
+  /* clang warns that the variables are uninitializedd, but the builtin
+     only inspects the type of its operand and never evaluates it.  */
+  DIAG_PUSH_NEEDS_COMMENT_CLANG;
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (23, "-Wuninitialized");
   result |= TEST (integer);
   result |= TEST (pointer);
   result |= TEST (real);
   result |= TEST (complex);
   result |= TEST (record);
   result |= TEST (union);
+  DIAG_POP_NEEDS_COMMENT_CLANG;
 
   return result;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.