Article View: gnu.gcc.bug
Article #1990gcc warnings bugs
From: Ben Mejia
Date: Thu, 24 Nov 1988 00:15
Date: Thu, 24 Nov 1988 00:15
61 lines
1905 bytes
1905 bytes
Version: gcc 1.31 compiled for hp9000/320.
/* First bug:
*/
struct foo; /* warning generated on this "vacuous" declaration */
struct bar
{
struct foo* fp;
};
struct foo
{
struct bar* bp;
};
/* end of first bug */
gcc -c generates this warning:
foo.c:1: warning: empty declaration
This vacuous declaration shouldn't generate a warning message.
The dpANS uses an equivalent example, illustrating the vacuous
declaration usage.
/* Second bug:
*/
int binky(struct bongo *p); /* no error generated here */
struct bongo
{
int ears;
};
int binky(struct bongo *p)
{
p->ears = 1;
}
/* end of second bug */
gcc -c generates these errors:
foo.c: In function binky:
foo.c:11: conflicting types for `binky'
foo.c:3: previous declaration of `binky'
I found this entirely misleading. We found this bug in a large
file with many nested includes. It *looked* like struct bongo was
defined before both the function declaration and the function
definition, but due to the nesting, it wasn't. The problem was easily
rectified, but shouldn't the undefined "struct bongo" used in the
function declaration generate at least a warning? I think it
should be an error.
Thanks,
--
bam bam%hplsla@hplabs.hp.com
(206) 335-2203
When confronted with a choice between two evils, I always choose the one
I haven't tried before.
-- Mae West
Technical Details
Message-ID:
<8811240015.AA05203@labbam.HP.COM>Path:
arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!mit-eddie!bloom-beacon!tut.cis.ohio-state.edu!HPLABS.HP.COM!bam%hplslaShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!mit-eddie!bloom-beacon!tut.cis.ohio-state.edu!HPLABS.HP.COM!bam%hplsla From: bam%hplsla@HPLABS.HP.COM (Ben Mejia) Newsgroups: gnu.gcc.bug Subject: gcc warnings bugs Message-ID: <8811240015.AA05203@labbam.HP.COM> Date: 24 Nov 88 00:15:46 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 60