Re: glib-extra.h G_DEFINE_DATA_TYPE issue



   Hi!

On Mon, May 22, 2006 at 11:07:49AM +0200, Tim Janik wrote:
> On Mon, 22 May 2006, Stefan Westerfeld wrote:
> >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?

Sorry:

[BB] stefan lotrien:~/src/beast/sfi$ rm sfistore.lo
[BB] stefan lotrien:~/src/beast/sfi$ make sfistore.lo
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:
/usr/local/gnome/include/glib-2.0/gobject/gtype.h:350:1: warning: this is the location of the previous definition
[BB] stefan lotrien:~/src/beast/sfi$ 

> >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?

[BB] stefan lotrien:~/src/beast$ /usr/lib/gcc-snapshot/bin/gcc --version
gcc (GCC) 4.2.0 20060508 (experimental)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[BB] stefan lotrien:~/src/beast/sfi$ pkg-config --modversion gobject-2.0
2.11.2
[BB] stefan lotrien:~/src/beast/sfi$ 

Since both, the compiler and gobject-2.0 are bleeding edge, I tried
downgrading both, and here are the results:

                 gcc-4.1        gcc-4.2-snapshot
---------------------------------------------------
glib-2.10.2      no warnings    no warnings 
glib-2.11.2      warnings       warnings

So its basically glib-2.11.2 and glib-extra.h which don't work together
without warnings.

> >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.

Well, what could be done is using #ifndef G_IMPLEMENT_INTERFACE around
G_IMPLEMENT_INTERFACE then, but as far as I understood you, you'll
probably want to understand why it happens at all.

   Cu... Stefan
-- 
Stefan Westerfeld, Hamburg/Germany, http://space.twc.de/~stefan



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