]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/torture/c2x-stdarg-split-1a.c
Merge remote-tracking branch 'origin/master' into devel/c++-contracts
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / torture / c2x-stdarg-split-1a.c
CommitLineData
4fe34cdc
JM
1/* Test C2x 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=c2x -pedantic-errors" } */
6/* { dg-additional-sources "c2x-stdarg-split-1b.c" } */
7
8extern void abort (void);
9extern void exit (int);
10
11double f (...);
12void g (...);
13void h1 (register int x, ...);
14void h2 (int x(), ...);
15void h3 (int x[10], ...);
16void h4 (char x, ...);
17void h5 (float x, ...);
18void h6 (volatile long x, ...);
19struct s { char c[1000]; };
20void h7 (volatile struct s x, ...);
21
22int
23main ()
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}