Commit 1604422c by Richard Kenner

(finish_struct): If transparent_union attribute specified, validate it

once we finish laying the union out.

From-SVN: r10293
parent 1bcf5b08
...@@ -5678,6 +5678,16 @@ finish_struct (t, fieldlist, attributes) ...@@ -5678,6 +5678,16 @@ finish_struct (t, fieldlist, attributes)
TREE_TYPE (x) = integer_type_node; 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 /* If this structure or union completes the type of any previous
variable declaration, lay it out and output its rtl. */ variable declaration, lay it out and output its rtl. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment