aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-08-11 17:46:05 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1996-08-11 17:46:05 -0400
commit9590fa7214ed0d2d974ea5bbd8cc8f692efda51f (patch)
tree1bfb6419015c288bbf19b39a0739d4816691e68a /gcc
parentd3d3fba0ea7b416b56cb88b9ec9570aa80fcea87 (diff)
downloadgcc-9590fa7214ed0d2d974ea5bbd8cc8f692efda51f.zip
gcc-9590fa7214ed0d2d974ea5bbd8cc8f692efda51f.tar.gz
gcc-9590fa7214ed0d2d974ea5bbd8cc8f692efda51f.tar.bz2
(finish_struct): If pedantic, also warn if struct/union has no named
members. From-SVN: r12612
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-decl.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 2ed017f..cb59a08 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -5533,9 +5533,17 @@ finish_struct (t, fieldlist, attributes)
old_momentary = suspend_momentary ();
- if (fieldlist == 0 && pedantic)
- pedwarn ((TREE_CODE (t) == UNION_TYPE ? "union has no members"
- : "structure has no members"));
+ if (pedantic)
+ {
+ 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.
Also process specified field sizes.