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-layout-1_x1.h | |
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-layout-1_x1.h')
-rw-r--r-- | gcc/testsuite/gcc.dg/compat/struct-layout-1_x1.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1_x1.h b/gcc/testsuite/gcc.dg/compat/struct-layout-1_x1.h new file mode 100644 index 000000000..0c7696fa7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1_x1.h @@ -0,0 +1,68 @@ +#include "struct-layout-1.h" + +struct Info info; +int fails; +int intarray[256]; +int fn0 (void) { return 0; } +int fn1 (void) { return 1; } +int fn2 (void) { return 2; } +int fn3 (void) { return 3; } +int fn4 (void) { return 4; } +int fn5 (void) { return 5; } +int fn6 (void) { return 6; } +int fn7 (void) { return 7; } +int fn8 (void) { return 8; } +int fn9 (void) { return 9; } + +/* This macro is intended for fields where their + addresses/sizes/alignments and value passing should be checked. */ +#define F(n, x, v, w) \ + info.flds[i] = &s##n.x; \ + info.sizes[i] = sizeof (s##n.x); \ + info.aligns[i] = __alignof__ (s##n.x); \ + s##n.x = v; \ + a##n[2].x = w; \ + ++i; +/* This macro is for fields where just their addresses/sizes/alignments + should be checked. */ +#define N(n, x) \ + info.flds[i] = &s##n.x; \ + info.sizes[i] = sizeof (s##n.x); \ + info.aligns[i] = __alignof__ (s##n.x); \ + ++i; +/* This macro is for fields where just value passing should be checked. */ +#define B(n, x, v, w) \ + s##n.x = v; \ + a##n[2].x = w; \ + ++j; +#define TX(n, type, attrs, fields, ops) \ +type S##n { fields } attrs; \ +type S##n s##n; \ +extern type S##n a##n[5]; \ +extern type S##n check##n (type S##n, type S##n *, \ + type S##n); \ +extern void check##n##va (int i, ...); \ +extern void checkx##n (type S##n); \ +void test##n (void) \ +{ \ + int i, j; \ + memset (&s##n, '\0', sizeof (s##n)); \ + memset (a##n, '\0', sizeof (a##n)); \ + memset (&info, '\0', sizeof (info)); \ + info.sp = &s##n; \ + info.a0p = &a##n[0]; \ + info.a3p = &a##n[3]; \ + info.sz = sizeof (s##n); \ + info.als = __alignof__ (s##n); \ + info.ala0 = __alignof__ (a##n[0]); \ + info.ala3 = __alignof__ (a##n[3]); \ + if (((long) &a##n[3]) & (info.als - 1)) \ + FAIL (n, 1); \ + i = 0; j = 0; \ + ops \ + info.nfields = i; \ + info.nbitfields = j; \ + checkx##n (check##n (s##n, &a##n[1], a##n[2])); \ + check##n##va (1, 1.0, s##n, 2LL, a##n[2], a##n[2]); \ + check##n##va (2, s##n, s##n, 2.0L, a##n[2], s##n); \ +} |