This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How To Disable A Specific Warning?
- From: Jan Engelhardt <jengelh at medozas dot de>
- To: Bob Smith <bsmith at sudleyplace dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sun, 28 Dec 2008 20:23:54 +0100 (CET)
- Subject: Re: How To Disable A Specific Warning?
- References: <gj8gub$emh$1@ger.gmane.org>
On Sunday 2008-12-28 19:35, Bob Smith wrote:
> ------------foo.c:-------------------
> typedef struct tagFOO
> {
> int a;
> } FOO;
>
> void FCN (FOO* b)
> {
> }
> ------------foo.pro:-----------------
(should preferably be named foo.h)
> void FCN (struct tagFOO *b);
> ------------fop.c:-------------------
> #include "foo.pro"
> -------------------------------------
> In file included from fop.c:1:
> foo.pro:1: warning: "struct tagFOO" declared inside parameter list
> foo.pro:1: warning: its scope is only this definition or declaration, which is
> probably not what you want
>
> I'm trying to keep the dependency tree down to a minimum, so having to declare
> tagFOO within <fop.c> is counter to that goal.
Well define it in foo.pro:
struct tagFOO;
Keeping the dependency tree to a minimum is a good idea, but typedefs
will happily interfere with that; http://lkml.org/lkml/2006/11/21/34,
I suggest to just remove them entirely.