i386: Fail if configured with --enable-cet
[glibc.git] / misc / tst-error1.c
blob75d4edf476d312172dfbc80b1782b9e70cb86d8d
1 #include <error.h>
2 #include <mcheck.h>
3 #include <stdio.h>
4 #include <string.h>
5 #include <wchar.h>
6 #include <libc-diag.h>
8 #include <support/xstdio.h>
10 static int
11 do_test (int argc, char *argv[])
13 mtrace ();
14 xfreopen (argc == 1 ? "/dev/stdout" : argv[1], "a", stderr);
15 /* Orient the stream. */
16 fwprintf (stderr, L"hello world\n");
17 char buf[20000];
18 static const char str[] = "hello world! ";
19 for (int i = 0; i < 1000; ++i)
20 memcpy (&buf[i * (sizeof (str) - 1)], str, sizeof (str));
21 error (0, 0, str);
23 /* We're testing a large format string here and need to generate it
24 to avoid this source file being ridiculous. So disable the warning
25 about a generated format string. */
26 DIAG_PUSH_NEEDS_COMMENT;
27 DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wformat-security");
29 error (0, 0, buf);
30 error (0, 0, buf);
32 DIAG_POP_NEEDS_COMMENT;
34 error (0, 0, str);
35 return 0;
38 #define TEST_FUNCTION do_test (argc, argv)
39 #include "../test-skeleton.c"