This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How To Disable A Specific Warning?


Jan Engelhardt wrote:
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.

You raise an interesting point, but I'm afraid I oversimplified the statement of the problem so as to focus on the question of how to disable the warning.


The definition of the struct tagFOO actually ends with } FOO, *LPFOO; and the .pro file has

void FCN (LPFOO b);

so there's no struct tagFOO. Adopting your interesting suggestion involves changing a lot of files, so I'd rather try to answer my original question.

Is there a way to disable the warning?

--
_______________________________________________________________
Bob Smith - bsmith@sudleyplace.com - http://www.sudleyplace.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]