annotate gcc/testsuite/gcc.dg/pack-test-3.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 /* Copyright (C) 2003 Free Software Foundation, Inc.
kono
parents:
diff changeset
4 Contributed by Nathan Sidwell 15 Jul 2003 <nathan@codesourcery.com> */
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 /* you should not be able to pack a typedef to a struct, only the
kono
parents:
diff changeset
7 underlying struct can be packed. */
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 /* ok */
kono
parents:
diff changeset
10 struct u1
kono
parents:
diff changeset
11 {
kono
parents:
diff changeset
12 char field1;
kono
parents:
diff changeset
13 short field2;
kono
parents:
diff changeset
14 int field3;
kono
parents:
diff changeset
15 };
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 /* ok */
kono
parents:
diff changeset
18 typedef struct p1 {
kono
parents:
diff changeset
19 char field1;
kono
parents:
diff changeset
20 short field2;
kono
parents:
diff changeset
21 int field3;
kono
parents:
diff changeset
22 } __attribute__ ((packed)) p1_t1;
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 /* ok */
kono
parents:
diff changeset
25 typedef struct __attribute__ ((packed)) p2 {
kono
parents:
diff changeset
26 char field1;
kono
parents:
diff changeset
27 short field2;
kono
parents:
diff changeset
28 int field3;
kono
parents:
diff changeset
29 } p2_t1;
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 int ary1[sizeof (struct p1) == sizeof (p1_t1) ? 1 : -1];
kono
parents:
diff changeset
32 int ary2[sizeof (struct p2) == sizeof (p2_t1) ? 1 : -1];
kono
parents:
diff changeset
33 int ary3[sizeof (struct p1) == sizeof (struct p2) ? 1 : -1];
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 /* not ok */
kono
parents:
diff changeset
36 typedef struct u1 __attribute__ ((packed)) u1_t1; /* { dg-warning "attribute ignored" }*/
kono
parents:
diff changeset
37 typedef struct u1 u1_t2 __attribute__ ((packed)); /* { dg-warning "attribute ignored" }*/
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 typedef struct p3 {
kono
parents:
diff changeset
40 char field1;
kono
parents:
diff changeset
41 short field2;
kono
parents:
diff changeset
42 int field3;
kono
parents:
diff changeset
43 } p3_t1 __attribute__ ((packed)); /* { dg-warning "attribute ignored" }*/
kono
parents:
diff changeset
44