PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / builtins / lib / printf.c
blob4be7578d124763af0cb5a96324c9c29a7195c9d4
1 #include <stdio.h>
2 #include <stdarg.h>
3 extern void abort (void);
4 extern int inside_main;
6 __attribute__ ((__noinline__))
7 int
8 printf (const char *string, ...)
10 va_list ap;
11 int r;
12 #ifdef __OPTIMIZE__
13 if (inside_main)
14 abort();
15 #endif
16 va_start (ap, string);
17 r = vprintf (string, ap);
18 va_end (ap);
19 return r;
23 /* Locking stdio doesn't matter for the purposes of this test. */
24 __attribute__ ((__noinline__))
25 int
26 printf_unlocked (const char *string, ...)
28 va_list ap;
29 int r;
30 #ifdef __OPTIMIZE__
31 if (inside_main)
32 abort();
33 #endif
34 va_start (ap, string);
35 r = vprintf (string, ap);
36 va_end (ap);
37 return r;