1 /* Copyright (C) 2000 Free Software Foundation.
3 Ensure all expected transformations of builtin printf occur and
4 that we honor side effects in the arguments.
6 Written by Kaveh R. Ghazi, 12/4/2000. */
8 extern int printf (const char *, ...);
9 extern int printf_unlocked (const char *, ...);
10 extern void abort(void);
15 const char *const s1
= "hello world";
16 const char *const s2
[] = { s1
, 0 }, *const*s3
;
18 printf ("%s\n", "hello");
21 printf ("%s\n", *s3
++);
22 if (s3
!= s2
+1 || *s3
!= 0)
28 printf ("%c", **s3
++);
29 if (s3
!= s2
+1 || *s3
!= 0)
36 printf ("hello world\n");
37 printf ("%s", "hello world\n");
39 /* Test at least one instance of the __builtin_ style. We do this
40 to ensure that it works and that the prototype is correct. */
41 __builtin_printf ("%s\n", "hello");
42 /* These builtin stubs are called by __builtin_printf, ensure their
43 prototypes are set correctly too. */
44 __builtin_putchar ('\n');
45 __builtin_puts ("hello");
46 /* Check the unlocked style, these evaluate to nothing to avoid
47 problems on systems without the unlocked functions. */
49 __builtin_printf_unlocked ("");
50 printf_unlocked ("%s", "");
51 __builtin_printf_unlocked ("%s", "");