From: H.J. Lu Date: Thu, 19 Dec 2024 20:51:03 +0000 (+0800) Subject: Suppress Clang -Wgnu-folding-constant warnings X-Git-Tag: glibc-2.41~232 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=daf47b66dfc100cde1ce90654c962d23750c5f97;p=thirdparty%2Fglibc.git 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 Reviewed-by: Sam James --- diff --git a/libio/tst-freopen.c b/libio/tst-freopen.c index 23ceb9694f..bb81eb58e7 100644 --- a/libio/tst-freopen.c +++ b/libio/tst-freopen.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -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 1c24993caf..85543e8b33 100644 --- a/libio/tst-mmap-setvbuf.c +++ b/libio/tst-mmap-setvbuf.c @@ -20,13 +20,17 @@ #include #include #include +#include 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;