Suppress -Wformat-security in tst-error1.c.
[glibc.git] / misc / tst-error1.c
bloba97a22ce9d2e7e0415d1a34eeaabace2f9266351
1 #include <error.h>
2 #include <mcheck.h>
3 #include <stdio.h>
4 #include <string.h>
5 #include <wchar.h>
6 #include <libc-internal.h>
8 static int
9 do_test (int argc, char *argv[])
11 mtrace ();
12 (void) freopen (argc == 1 ? "/dev/stdout" : argv[1], "a", stderr);
13 /* Orient the stream. */
14 fwprintf (stderr, L"hello world\n");
15 char buf[20000];
16 static const char str[] = "hello world! ";
17 for (int i = 0; i < 1000; ++i)
18 memcpy (&buf[i * (sizeof (str) - 1)], str, sizeof (str));
19 error (0, 0, str);
21 /* We're testing a large format string here and need to generate it
22 to avoid this source file being ridiculous. So disable the warning
23 about a generated format string. */
24 DIAG_PUSH_NEEDS_COMMENT;
25 DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat-security");
27 error (0, 0, buf);
28 error (0, 0, buf);
30 DIAG_POP_NEEDS_COMMENT;
32 error (0, 0, str);
33 return 0;
36 #define TEST_FUNCTION do_test (argc, argv)
37 #include "../test-skeleton.c"