From 1604422ce4cfec62a1870a758cd781bb84b8e7f6 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Tue, 29 Aug 1995 19:15:47 -0400 Subject: [PATCH] (finish_struct): If transparent_union attribute specified, validate it once we finish laying the union out. From-SVN: r10293 --- gcc/c-decl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index c90e11bdb96..def045fda64 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. */ -- 2.30.2