1 /* Test C23 variadic functions with no named parameters, or last named
2 parameter with a declaration not allowed in C17. Execution tests. */
4 /* { dg-options "-std=c23 -pedantic-errors" } */
8 extern void abort (void);
9 extern void exit (int);
16 double ret
= va_arg (ap
, int);
17 ret
+= va_arg (ap
, double);
18 ret
+= va_arg (ap
, int);
19 ret
+= va_arg (ap
, double);
28 va_start (ap
, random
! ignored
, ignored
** text
);
29 for (int i
= 0; i
< 10; i
++)
30 if (va_arg (ap
, double) != i
)
36 h1 (register int x
, ...)
40 for (int i
= 0; i
< 10; i
++)
42 if (va_arg (ap
, double) != i
)
45 if (va_arg (ap
, int) != i
)
56 for (int i
= 0; i
< 10; i
++)
58 if (va_arg (ap
, double) != i
)
61 if (va_arg (ap
, int) != i
)
72 for (int i
= 0; i
< 10; i
++)
74 if (va_arg (ap
, double) != i
)
77 if (va_arg (ap
, int) != i
)
88 for (int i
= 0; i
< 10; i
++)
90 if (va_arg (ap
, double) != i
)
93 if (va_arg (ap
, int) != i
)
104 for (int i
= 0; i
< 10; i
++)
106 if (va_arg (ap
, double) != i
)
109 if (va_arg (ap
, int) != i
)
116 h6 (volatile long x
, ...)
120 for (int i
= 0; i
< 10; i
++)
122 if (va_arg (ap
, double) != i
)
125 if (va_arg (ap
, int) != i
)
131 struct s
{ char c
[1000]; };
134 h7 (volatile struct s x
, ...)
138 for (int i
= 0; i
< 10; i
++)
140 if (va_arg (ap
, double) != i
)
143 if (va_arg (ap
, int) != i
)
152 if (f (1, 2.0, 3, 4.0) != 10.0)
154 g (0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);
155 g (0.0f
, 1.0f
, 2.0f
, 3.0f
, 4.0f
, 5.0f
, 6.0f
, 7.0f
, 8.0f
, 9.0f
);
156 h1 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
157 h2 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
158 h3 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
159 h4 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
160 h5 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
161 h6 (0, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);
162 h7 ((struct s
) {}, 0.0, 1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9);