Mail Archives: djgpp/1996/11/22/16:57:31
Hi everybody:
> A.Appleyard wrote:-
>> (1) It has many functions all of type void name(val N,val T1,val T2){...}.
>> (val is an 8-byte class type which I declared). These functions MUST be all
>> the same type, as their addresses are used as values. But some of these
>> functions don't use some of their parameters. As a result the fault output
>> is stuffed out with hundreds of `warning: unused parameter' warning lines.
>> How to stop these warning and still use -Wall for its other useful properties?
> kvhk AT ivs4 DOT barco DOT com (Koen Van Herck) replied:-
>> Or use __attribute__ ((unused)) for the unused variables.
>> e.g.
>> int foo(int a, int b __attribute__ ((unused)));
>> This will complain if a is unused, but not is b is unused.
>I just compiled this test program with v2 with -Wall:-
>#define nu __attribute__ ((unused))
>class point{public: double x,y;};
>int miaow(point w nu,double z nu){}
>main(){}
>with each of these in turn as its 3rd line:-
>int miaow(point w nu,double z nu){}
>int miaow(point w,double z nu){}
>int miaow(point w nu,double z){}
>int miaow(double z nu){}
>and every time I got this error:-
>t$$$.cc:3: parse error before `__attribute__'
I don't know who started with the "Use __attribute__ ((unused))", I tried that
some month ago and filed. Seems that this thing works only in the gcc.inf ;-).
If you want to put out all of these unused warnings and still using -Wall do
the following:
int foofun(int a, int)
{
...
}
the first paramenter is int a, the second is just an int as you don't give any
name to it gcc asumes that is imposible to be unused ;-).
In adittion BC++ 3.1 supports that.
Hope this help, SET
********************************************************************************
Salvador Eduardo Tropea (SET) - salvador AT inti DOT edu DOT ar
Work: INTI (National Institute of Industrial Technology) Sector: ICE
(Electronic Control & Instrumentation)
Post (Home): Curapaligue 2124 - Caseros (1678)- Buenos Aires - Argentina
- Raw text -