Re: glib-extra.h G_DEFINE_DATA_TYPE issue



On Mon, 22 May 2006, Stefan Westerfeld wrote:

  Hi!

Since some time, I get lots of warnings when compiling beast from CVS
HEAD, which look like this:

Making all in sfi
make[2]: Entering directory `/home/stefan/src/beast/sfi'
if /bin/sh ../libtool --tag=CC --mode=compile /usr/lib/gcc-snapshot/bin/gcc -DHAVE_CONFIG_H -DG_LOG_DOMAIN=\"SFI\" -DG_DISABLE_CONST_RETURNS -I. -I. -I.. -I.. -I.. -pthread -I/usr/local/gnome/include/glib-2.0 -I/usr/local/gnome/lib64/glib-2.0/include     -D_BIRNET_SOURCE_EXTENSIONS -g -DG_ENABLE_DEBUG -ggdb3 -fno-cond-mismatch -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-cast-qual -Wno-pointer-sign -Wpointer-arith -Wredundant-decls -Wmissing-noreturn -pipe -O2 -ftracer -finline-functions -fno-keep-static-consts -MT sfistore.lo -MD -MP -MF ".deps/sfistore.Tpo" -c -o sfistore.lo sfistore.c; \
       then mv -f ".deps/sfistore.Tpo" ".deps/sfistore.Plo"; else rm -f ".deps/sfistore.Tpo"; exit 1; fi
/usr/lib/gcc-snapshot/bin/gcc -DHAVE_CONFIG_H -DG_LOG_DOMAIN=\"SFI\" -DG_DISABLE_CONST_RETURNS -I. -I. -I.. -I.. -I.. -pthread -I/usr/local/gnome/include/glib-2.0 -I/usr/local/gnome/lib64/glib-2.0/include -D_BIRNET_SOURCE_EXTENSIONS -g -DG_ENABLE_DEBUG -ggdb3 -fno-cond-mismatch -Wall -Wmissing-prototypes -Wmissing-declarations -Wno-cast-qual -Wno-pointer-sign -Wpointer-arith -Wredundant-decls -Wmissing-noreturn -pipe -O2 -ftracer -finline-functions -fno-keep-static-consts -MT sfistore.lo -MD -MP -MF .deps/sfistore.Tpo -c sfistore.c  -fPIC -DPIC -o .libs/sfistore.o
In file included from ../sfi/sfitypes.h:22,
                from ../sfi/sfivalues.h:22,
                from sfistore.h:22,
                from sfistore.c:19:
../sfi/glib-extra.h:273:1: warning: "G_IMPLEMENT_INTERFACE" redefined
In file included from /usr/local/gnome/include/glib-2.0/gobject/gboxed.h:26,
                from /usr/local/gnome/include/glib-2.0/glib-object.h:25,
                from ../sfi/glib-extra.h:23,
                from ../sfi/sfitypes.h:22,
                from ../sfi/sfivalues.h:22,
                from sfistore.h:22,
                from sfistore.c:19:


hrm, can you please paste the *complete* error message?

When analyzing the problem, I've found that glib-extra.h ships with the
G_DEFINE_DATA_TYPE macro, which meanwhile has been backfolded into glib
(for instance 2.10.2 ships it) as G_DEFINE_TYPE.

no, G_DEFINE_DATA_TYPE() is a refinement of G_DEFINE_TYPE() and hasn't been
backfolded. and glib-extra.h defines it since glib defines G_DEFINE_TYPE().

So compiling beast with
newer glib versions produces lots of warnings, because
G_IMPLEMENT_INTERFACE will be defined by both, gtype.h and glib-extra.h.

that used to always be the case as well. i'm not seeing warnings about
duplicate definitions though. can you please provide your exact
compiler version?

Now, there is code to disable definition of all these macros in
glib-extra.h, which reads:

#ifndef G_DEFINE_DATA_TYPE      // GTKFIX: add this to glib
...
#define G_IMPLEMENT_INTERFACE...
...
#endif

However, this doesn't have any effect, since G_DEFINE_DATA_TYPE is not
defined by newer gtype.h versions (only G_DEFINE_TYPE).

So I was wondering whether it would help if I provided a patch which
renames all uses of G_DEFINE_DATA_TYPE (and related macros) in beast to
G_DEFINE_TYPE, so that the new version from gtype.h can be used when
available?

no, that wouldn't even work since the two macros do different things.

  Cu... Stefan

---
ciaoTJ



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