diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1993-04-23 19:27:20 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1993-04-23 19:27:20 -0400 |
commit | 773edaeff24e371cc331b6a22a77c23b20210460 (patch) | |
tree | 93f7d9b296caeac625f75045b0878201a0874cda /gcc/c-decl.c | |
parent | 6a5ed5bf13cc6d8267b9fc273291556142834a2b (diff) | |
download | gcc-773edaeff24e371cc331b6a22a77c23b20210460.zip gcc-773edaeff24e371cc331b6a22a77c23b20210460.tar.gz gcc-773edaeff24e371cc331b6a22a77c23b20210460.tar.bz2 |
(shadow_tag_warned): Let warned have three values, so that a mere warning doesn't prevent a pedwarn.
(shadow_tag_warned): Let warned have three values, so that a mere
warning doesn't prevent a pedwarn. Don't skip the error call at the
end on accounted of warned.
From-SVN: r4203
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 783ca55..f62e306 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3097,6 +3097,8 @@ void shadow_tag_warned (declspecs, warned) tree declspecs; int warned; + /* 1 => we have done a pedwarn. 2 => we have done a warning, but + no pedwarn. */ { int found_tag = 0; register tree link; @@ -3119,7 +3121,8 @@ shadow_tag_warned (declspecs, warned) if (name == 0) { - if (!warned && code != ENUMERAL_TYPE) /* Empty unnamed enum OK */ + if (warned != 1 && code != ENUMERAL_TYPE) + /* Empty unnamed enum OK */ { pedwarn ("unnamed struct/union that defines no instances"); warned = 1; @@ -3139,15 +3142,18 @@ shadow_tag_warned (declspecs, warned) else { if (!warned) - pedwarn ("useless keyword or type name in empty declaration"); - warned = 1; + { + warning ("useless keyword or type name in empty declaration"); + warned = 2; + } } } - if (!warned) + if (found_tag > 1) + error ("two types specified in one empty declaration"); + + if (warned != 1) { - if (found_tag > 1) - error ("two types specified in one empty declaration"); if (found_tag == 0) pedwarn ("empty declaration"); } |