More g-wrap bogosities

Rob Browning rlb@defaultvalue.org
Sun, 13 Jan 2002 11:16:55 -0600


Derek Atkins <warlord@MIT.EDU> writes:

> g-wrap also produces code that produces these errors:
>
> gw-kvp.c: In function `gw_init_wrapset_gw_kvp':
> gw-kvp.c:353: warning: unused variable `gw__tmp481_err_misc_msg'
> gw-kvp.c:352: warning: unused variable `gw__tmp482_err_data'
> gw-kvp.c:351: warning: unused variable `gw__tmp480_status_var'
>
> You do realize that a simple "(void)<varname>;" will cause these
> warnings to go away, right?

Believe me, if there were an easy way to get rid of these I would.
I'm actually the one that worked to make sure that gnucash compiled
-Werror clean and then made it the default.

The problem is that there are good reasons why g-wrap is structured
the way it is, but given that structure, I couldn't think of any way
for it to tell in advance whether or not some of these variables are
going to be used by later code that may or may not be generated by the
scm->c and c->scm code generators for the various types being wrapped
as arguments or return values for a given function (wow that was a
mouthful...).

So the best I could do without a lot of extra infrastructure just for
this purpose, is to recommend that people use -Wno-uninitialized
-Wno-unused for the code generated by g-wrap.  That should be the
default...

Later, if we can think of a better solution that's not more
complicated than the problem warrants, then that would be great.

Also note that g-wrap depends quite heavily now on at least the
obvious compiler optimizations.  It will insert a bunch of *obviously*
unused blocks of code now and then and expects the compiler to remove
them.  So -O2 will give *much* better results in the object code.

Finally, I gave up on trying to format the wrapper code -- that just
makes the g-wrap internals too complicated for very little gain, and
"indent -nut -bli0 foo.c" works great, so if you want to look at the
generated code, make sure to use indent first :>

Hope this helps.

-- 
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG=1C58 8B2C FB5E 3F64 EA5C  64AE 78FE E5FE F0CB A0AD