6 volatile int should_optimize
;
9 __attribute__((noinline
))
10 __vfprintf_chk (FILE *f
, int flag
, const char *fmt
, va_list ap
)
17 return vfprintf (f
, fmt
, ap
);
29 #define test(n, ret, opt, fmt, args) \
31 should_optimize = opt; \
32 __vfprintf_chk (stdout, 1, fmt, ap); \
33 if (! should_optimize) \
35 should_optimize = 0; \
36 if (__vfprintf_chk (stdout, 1, fmt, ap2) != ret) \
38 if (! should_optimize) \
41 #include "vfprintf-chk-1.c"
54 #define test(n, ret, opt, fmt, args) \
56 #include "vfprintf-chk-1.c"
62 test (0, 5, 1, "hello", (0));
63 test (1, 6, 1, "hello\n", (1));
64 test (2, 1, 1, "a", (2));
65 test (3, 0, 1, "", (3));
66 test (4, 5, 0, "%s", (4, "hello"));
67 test (5, 6, 0, "%s", (5, "hello\n"));
68 test (6, 1, 0, "%s", (6, "a"));
69 test (7, 0, 0, "%s", (7, ""));
70 test (8, 1, 0, "%c", (8, 'x'));
71 test (9, 7, 0, "%s\n", (9, "hello\n"));
72 test (10, 2, 0, "%d\n", (10, 0));