Debian Codegraph @

gcc/testsuite/gcc.dg/charset/builtin2.c

raw
1 /* Ensure that transformations of *printf are performed correctly
2 regardless of -fexec-charset. See PR 25120. */
3
4 /* { dg-do compile } */
5 /* { dg-require-iconv "IBM1047" } */
6 /* { dg-options "-O2 -fexec-charset=IBM1047" } */
7 /* { dg-final { scan-assembler-not "printf" } } */
8 /* { dg-final { scan-assembler-not "fprintf" } } */
9 /* { dg-final { scan-assembler-not "sprintf" } } */
10
11 #include <stdio.h>
12
13 void foo (char *dst, const char *src)
14 {
15 printf ("\n");
16 printf ("hello world\n");
17 printf ("%s", "\n");
18 printf ("%s", "hello world\n");
19 printf ("%c", '\n');
20 printf ("%s\n", "hello world");
21 printf ("%s\n", src);
22
23 fprintf (stdout, "\n");
24 fprintf (stdout, "hello world\n");
25 fprintf (stdout, "%s", "\n");
26 fprintf (stdout, "%s", "hello world\n");
27 fprintf (stdout, "%c", '\n');
28 fprintf (stdout, "%s", src);
29
30 sprintf (dst, "hello world\n");
31 sprintf (dst, "%s", src);
32 }