]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Suppress Clang -Wgnu-folding-constant warnings
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 19 Dec 2024 20:51:03 +0000 (04:51 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sun, 22 Dec 2024 09:45:56 +0000 (17:45 +0800)
Suppress Clang -Wgnu-folding-constant warnings, like

tst-freopen.c:44:13: error: variable length array folded to constant array as an extension [-Werror,-Wgnu-folding-constant]
   44 |   char temp[strlen (test) + 1];
      |             ^~~~~~~~~~~~~~~~~

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
libio/tst-freopen.c
libio/tst-mmap-setvbuf.c

index 23ceb9694fc4238417aba613f84e0c9ece3a5a92..bb81eb58e78cd876d072d7a563176f04062e4b56 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <libc-diag.h>
 
 #include <support/check.h>
 #include <support/temp_file.h>
@@ -41,7 +42,10 @@ static void
 do_test_basic (void)
 {
   const char * const test = "Let's test freopen.\n";
+  DIAG_PUSH_NEEDS_COMMENT_CLANG;
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (3.4, "-Wgnu-folding-constant");
   char temp[strlen (test) + 1];
+  DIAG_POP_NEEDS_COMMENT_CLANG;
 
   FILE *f = fdopen (fd, "w");
   if (f == NULL)
index 1c24993caffc7af95c2866cc91bd03a21b1940ed..85543e8b331a5fdb908d56ae42b2728897a6185b 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <libc-diag.h>
 
 int main (void)
 {
   char name[] = "/tmp/tst-mmap-setvbuf.XXXXXX";
   char buf[4096];
   const char * const test = "Let's see if mmap stdio works with setvbuf.\n";
+  DIAG_PUSH_NEEDS_COMMENT_CLANG;
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (3.4, "-Wgnu-folding-constant");
   char temp[strlen (test) + 1];
+  DIAG_POP_NEEDS_COMMENT_CLANG;
   int fd = mkstemp (name);
   FILE *f;