mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-06 20:58:33 +01:00
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>
This commit is contained in:
parent
601b3d5db2
commit
daf47b66df
2 changed files with 8 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <libc-diag.h>
|
||||||
|
|
||||||
#include <support/check.h>
|
#include <support/check.h>
|
||||||
#include <support/temp_file.h>
|
#include <support/temp_file.h>
|
||||||
|
@ -41,7 +42,10 @@ static void
|
||||||
do_test_basic (void)
|
do_test_basic (void)
|
||||||
{
|
{
|
||||||
const char * const test = "Let's test freopen.\n";
|
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];
|
char temp[strlen (test) + 1];
|
||||||
|
DIAG_POP_NEEDS_COMMENT_CLANG;
|
||||||
|
|
||||||
FILE *f = fdopen (fd, "w");
|
FILE *f = fdopen (fd, "w");
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
|
|
|
@ -20,13 +20,17 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <libc-diag.h>
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
char name[] = "/tmp/tst-mmap-setvbuf.XXXXXX";
|
char name[] = "/tmp/tst-mmap-setvbuf.XXXXXX";
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
const char * const test = "Let's see if mmap stdio works with setvbuf.\n";
|
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];
|
char temp[strlen (test) + 1];
|
||||||
|
DIAG_POP_NEEDS_COMMENT_CLANG;
|
||||||
int fd = mkstemp (name);
|
int fd = mkstemp (name);
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue