Commit 9590fa72 by Richard Kenner

(finish_struct): If pedantic, also warn if struct/union has no named

members.

From-SVN: r12612
parent d3d3fba0
...@@ -5533,9 +5533,17 @@ finish_struct (t, fieldlist, attributes) ...@@ -5533,9 +5533,17 @@ finish_struct (t, fieldlist, attributes)
old_momentary = suspend_momentary (); old_momentary = suspend_momentary ();
if (fieldlist == 0 && pedantic) if (pedantic)
pedwarn ((TREE_CODE (t) == UNION_TYPE ? "union has no members" {
: "structure has no members")); for (x = fieldlist; x; x = TREE_CHAIN (x))
if (DECL_NAME (x) != 0)
break;
if (x == 0)
pedwarn ("%s has no %smembers",
(TREE_CODE (t) == UNION_TYPE ? "union" : "structure"),
(fieldlist ? "named " : ""));
}
/* Install struct as DECL_CONTEXT of each field decl. /* Install struct as DECL_CONTEXT of each field decl.
Also process specified field sizes. Also process specified field sizes.
......
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