diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/compat/struct-by-value-22_x.c | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/compat/struct-by-value-22_x.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/compat/struct-by-value-22_x.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-22_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-22_x.c new file mode 100644 index 000000000..6f1cdc860 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-22_x.c @@ -0,0 +1,83 @@ +#ifndef SKIP_VLA_IN_STRUCT + +#ifndef T +#include "compat-common.h" +#include "mixed-struct-defs.h" +#include "mixed-struct-init.h" + +#define T(NAME, FIELDS, TYPE, FIELDINIT, FIELDTEST) \ +extern void testva##NAME (int n, ...); \ + \ +void \ +testit##NAME (int n) \ +{ \ + struct S { FIELDS TYPE a[n]; } s; \ + int i; \ + FIELDINIT; \ + for (i = 0; i < n; ++i) \ + s.a[i] = 12 + n - i; \ + testva##NAME (n, s, n, s); \ +} + +#include "struct-by-value-22_x.c" + +#undef T + +void +struct_by_value_22_x () +{ + int n; +DEBUG_INIT + +#define T(NAME, FIELDS, TYPE, FIELDINIT, FIELDTEST) testit##NAME (n); + + for (n = 0; n < 16; ++n) + { +#include "struct-by-value-22_x.c" + DEBUG_NL; + } + for (; n < 110; n += 13) + { +#include "struct-by-value-22_x.c" + DEBUG_NL; + } + +DEBUG_FINI + +if (fails != 0) + abort (); +} + +#else + +#define S(NAME, FIELDS, FIELDINIT, FIELDTEST) \ + T(c##NAME, FIELDS, char, FIELDINIT, FIELDTEST) \ + T(s##NAME, FIELDS, short, FIELDINIT, FIELDTEST) \ + T(u##NAME, FIELDS, unsigned, FIELDINIT, FIELDTEST) \ + T(d##NAME, FIELDS, double, FIELDINIT, FIELDTEST) +S(E, , do {} while (0), DEBUG_DOT) +S(n, int n;, s.n = n, if (s.n != n) DEBUG_CHECK) +#define U(TYPE) \ +S(TYPE, TYPE s;, init##TYPE (&s.s, n), check##TYPE (s.s, n)) +U(Scd) +U(Scdc) +U(Sd) +U(Sdi) +U(Scsds) +U(Scsdsc) +U(Scsdis) +U(Scsdisc) +U(Ssds) +U(Ssdsc) +U(Scssdss) +U(Scssdssc) +U(Sfi) +U(Sfii) +U(Sfifi) +U(Sfiifii) +#undef S +#undef U + +#endif + +#endif |