#include <stdarg.h>
|
#include <stdarg.h>
|
#include "compat-common.h"
|
#include "compat-common.h"
|
#include "mixed-struct-defs.h"
|
#include "mixed-struct-defs.h"
|
#include "mixed-struct-check.h"
|
#include "mixed-struct-check.h"
|
|
|
#ifdef SKIP_VA
|
#ifdef SKIP_VA
|
const int test_va = 0;
|
const int test_va = 0;
|
#else
|
#else
|
const int test_va = 1;
|
const int test_va = 1;
|
#endif
|
#endif
|
|
|
#ifndef SKIP_VLA_IN_STRUCT
|
#ifndef SKIP_VLA_IN_STRUCT
|
#define T(NAME, FIELDS, TYPE, FIELDINIT, FIELDTEST) \
|
#define T(NAME, FIELDS, TYPE, FIELDINIT, FIELDTEST) \
|
void \
|
void \
|
testva##NAME (int n, ...) \
|
testva##NAME (int n, ...) \
|
{ \
|
{ \
|
va_list ap; \
|
va_list ap; \
|
if (test_va) \
|
if (test_va) \
|
{ \
|
{ \
|
struct S { FIELDS TYPE a[n]; } s; \
|
struct S { FIELDS TYPE a[n]; } s; \
|
int fail = 0, i, j; \
|
int fail = 0, i, j; \
|
\
|
\
|
va_start (ap, n); \
|
va_start (ap, n); \
|
for (j = 0; j < 2; ++j) \
|
for (j = 0; j < 2; ++j) \
|
{ \
|
{ \
|
s = va_arg (ap, struct S); \
|
s = va_arg (ap, struct S); \
|
for (i = 0; i < n; ++i) \
|
for (i = 0; i < n; ++i) \
|
if (s.a[i] != 12 + n - i) \
|
if (s.a[i] != 12 + n - i) \
|
++fail; \
|
++fail; \
|
if (fail) \
|
if (fail) \
|
{ DEBUG_FAIL; } \
|
{ DEBUG_FAIL; } \
|
if (!j && va_arg (ap, int) != n) \
|
if (!j && va_arg (ap, int) != n) \
|
{ DEBUG_FAIL; } \
|
{ DEBUG_FAIL; } \
|
FIELDTEST; \
|
FIELDTEST; \
|
} \
|
} \
|
va_end (ap); \
|
va_end (ap); \
|
} \
|
} \
|
}
|
}
|
|
|
#include "struct-by-value-22_x.c"
|
#include "struct-by-value-22_x.c"
|
#endif
|
#endif
|
|
|