diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1995-08-29 19:15:47 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1995-08-29 19:15:47 -0400 |
commit | 1604422ce4cfec62a1870a758cd781bb84b8e7f6 (patch) | |
tree | 2640e2e2a60a5e11f849e8bf283123b42e741536 | |
parent | 1bcf5b08b03cebe9de80330e00d0f6473fdf18ee (diff) | |
download | gcc-1604422ce4cfec62a1870a758cd781bb84b8e7f6.zip gcc-1604422ce4cfec62a1870a758cd781bb84b8e7f6.tar.gz gcc-1604422ce4cfec62a1870a758cd781bb84b8e7f6.tar.bz2 |
(finish_struct): If transparent_union attribute specified, validate it
once we finish laying the union out.
From-SVN: r10293
-rw-r--r-- | gcc/c-decl.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index c90e11b..def045f 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5678,6 +5678,16 @@ finish_struct (t, fieldlist, attributes) TREE_TYPE (x) = integer_type_node; } + /* If this was supposed to be a transparent union, but we can't + make it one, warn and turn off the flag. */ + if (TREE_CODE (t) == UNION_TYPE + && TYPE_TRANSPARENT_UNION (t) + && TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t))) + { + TYPE_TRANSPARENT_UNION (t) = 0; + warning ("cannot make `%s' a transparent union"); + } + /* If this structure or union completes the type of any previous variable declaration, lay it out and output its rtl. */ |