aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-12-20 04:51:03 +0800
committerH.J. Lu <hjl.tools@gmail.com>2024-12-22 17:45:56 +0800
commitdaf47b66dfc100cde1ce90654c962d23750c5f97 (patch)
treee7e649161ae429c4837d7108ed9db17e51208628
parent601b3d5db27ff0c7c7406b9af971b1bc7a1e3e49 (diff)
downloadglibc-daf47b66dfc100cde1ce90654c962d23750c5f97.zip
glibc-daf47b66dfc100cde1ce90654c962d23750c5f97.tar.gz
glibc-daf47b66dfc100cde1ce90654c962d23750c5f97.tar.bz2
Suppress Clang -Wgnu-folding-constant warnings
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>
-rw-r--r--libio/tst-freopen.c4
-rw-r--r--libio/tst-mmap-setvbuf.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/libio/tst-freopen.c b/libio/tst-freopen.c
index 23ceb96..bb81eb5 100644
--- a/libio/tst-freopen.c
+++ b/libio/tst-freopen.c
@@ -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)
diff --git a/libio/tst-mmap-setvbuf.c b/libio/tst-mmap-setvbuf.c
index 1c24993..85543e8 100644
--- a/libio/tst-mmap-setvbuf.c
+++ b/libio/tst-mmap-setvbuf.c
@@ -20,13 +20,17 @@
#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;