Re: glib-genmarshal



On Mon, Feb 02, 2004 at 10:45:20AM -0500, Ross McFarland wrote:
> Paul Pogonyshev said:
> > Hi.
> >
> > I'm writing an application that uses GTK+ as GUI.  I've come to a
> > problem though.  My program is compiled with many GCC's `-W...'
> > options turned on (i.e. i want to get warnings about suspicious
> > code places).  However, in marshallers i generate with
> > `glib-genmarshal' I get warnings about `invocation_hint' parameter
> > which is never used.  This is very annoying and i had to add some
> > nasty hack into that directories' `Makefile.am'.
> >
> > Will you maybe accept this simple (untested) patch so that at least
> > future versions of `glib-genmarshal' produce cleaner code?
> >
> 
> i've found, and been annoyed by the same thing before.
> 
> perl uses the following in cases where parameters/varaibles are going to be
> unused. it's code that under most circumstances gets compiled out, but
> prevents the warnings.
> 
> /* gcc -Wall:
>  * for silencing unused variables that are actually used most of the time,
>  * but we cannot quite get rid of, such `ax' in PPCODE+noargs xsubs
>  */
> #define PERL_UNUSED_VAR(var) if (0) var = var
> 
> we use it quite extensively with gtk2-perl in similar situations where we have
> parameters/variables forced upon us which we do not need.
> 
> i would suggest that the above, or something like it be placed in glib
> somewhere as GLIB_UNUSED_VAR (provided there isn't already something like it)
> and then glib-genmarshal (and other situations like it) could make use of the
> macro to quite warnings as necessary. obviously it's not a big deal either
> way, but i would
> 
> the (other) main use i would see for it would be in callbacks where not all of
> the paramters are of interest to the developer.

There's a bug filed on this:

http://bugzilla.gnome.org/show_bug.cgi?id=52026

On could also simply pass -Wno-unused-parameter to gcc.

-Yosh



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]