Debian Codegraph @

gcc/testsuite/gcc.dg/torture/c23-stdarg-split-1a.c

raw
1 /* Test C23 variadic functions with no named parameters, or last named
2 parameter with a declaration not allowed in C17. Execution tests split
3 between source files. */
4 /* { dg-do run } */
5 /* { dg-options "-std=c23 -pedantic-errors" } */
6 /* { dg-additional-sources "c23-stdarg-split-1b.c" } */
7
8 extern void abort (void);
9 extern void exit (int);
10
11 double f (...);
12 void g (...);
13 void h1 (register int x, ...);
14 void h2 (int x(), ...);
15 void h3 (int x[10], ...);
16 void h4 (char x, ...);
17 void h5 (float x, ...);
18 void h6 (volatile long x, ...);
19 struct s { char c[1000]; };
20 void h7 (volatile struct s x, ...);
21
22 int
23 main ()
24 {
25 if (f (1, 2.0, 3, 4.0) != 10.0)
26 abort ();
27 g (0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);
28 g (0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f);
29 h1 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
30 h2 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
31 h3 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
32 h4 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
33 h5 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
34 h6 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
35 h7 ((struct s) {}, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
36 exit (0);
37 }
38
39 /* { dg-warning "'va_start' macro used with additional arguments other than identifier of the last named argument" "" { target *-*-* } 0 } */