1 #include <stdarg.h>
2 #include "compat-common.h"
3 #include "mixed-struct-defs.h"
4 #include "mixed-struct-check.h"
5 
6 #ifdef SKIP_VA
7 const int test_va = 0;
8 #else
9 const int test_va = 1;
10 #endif
11 
12 #ifndef SKIP_VLA_IN_STRUCT
13 #define T(NAME, FIELDS, TYPE, FIELDINIT, FIELDTEST)			\
14 void									\
15 testva##NAME (int n, ...)						\
16 {									\
17   va_list ap;								\
18   if (test_va)								\
19     {									\
20       struct S { FIELDS TYPE a[n]; } s;					\
21       int fail = 0, i, j;						\
22 									\
23       va_start (ap, n);							\
24       for (j = 0; j < 2; ++j)						\
25         {								\
26 	  s = va_arg (ap, struct S);					\
27 	  for (i = 0; i < n; ++i)					\
28 	    if (s.a[i] != 12 + n - i)					\
29 	      ++fail;							\
30 	  if (fail)							\
31 	    { DEBUG_FAIL; }						\
32 	  if (!j && va_arg (ap, int) != n)				\
33 	    { DEBUG_FAIL; }						\
34 	  FIELDTEST;							\
35 	}								\
36       va_end (ap);							\
37     }									\
38 }
39 
40 #include "struct-by-value-22_x.c"
41 #endif
42