| 1 |
/* bf-ms-attrib.c */ |
| 2 |
/* Adapted from Donn Terry <[email protected]> testcase |
| 3 |
posted to GCC-patches |
| 4 |
http://gcc.gnu.org/ml/gcc-patches/2000-08/msg00577.html */ |
| 5 |
|
| 6 |
/* { dg-do run { target *-*-mingw* *-*-cygwin* } } */ |
| 7 |
|
| 8 |
/* We don't want the default "pedantic-errors" in this case, since we're |
| 9 |
testing nonstandard stuff to begin with. */ |
| 10 |
/* { dg-options "-ansi" } */ |
| 11 |
|
| 12 |
extern void abort(void); |
| 13 |
|
| 14 |
struct one_gcc { |
| 15 |
int d; |
| 16 |
unsigned char a; |
| 17 |
unsigned short b:7; |
| 18 |
char c; |
| 19 |
} __attribute__((__gcc_struct__)) ; |
| 20 |
|
| 21 |
|
| 22 |
struct one_ms { |
| 23 |
int d; |
| 24 |
unsigned char a; |
| 25 |
unsigned short b:7; |
| 26 |
char c; |
| 27 |
} __attribute__((__ms_struct__)); |
| 28 |
|
| 29 |
|
| 30 |
main() |
| 31 |
{ |
| 32 |
/* As long as the sizes are as expected, we know attributes are working. |
| 33 |
bf-ms-layout.c makes sure the right thing happens when the attribute |
| 34 |
is on. */ |
| 35 |
if (sizeof(struct one_ms) != 12) |
| 36 |
abort(); |
| 37 |
if (sizeof(struct one_gcc) != 8) |
| 38 |
abort(); |
| 39 |
return 0; |
| 40 |
} |