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

Re: gxine (Re: Mass rebuild status with gcc-4.3.0-0.4 of rawhide-20071220)



On Thu, Jan 03, 2008 at 07:53:40PM +0100, Martin Sourada wrote:
> my package is listed there and look into sources showed only 'static
> inline' functions but none of these seems to be listed in the build log.
> Instead lots of (to me) confusing messages about multiple defs in glib
> header files like this (end of the really long list):
> 
> wizards.o: In function `g_bit_storage':
> /usr/include/glib-2.0/glib/gutils.h:345: multiple definition of
> `g_bit_storage'
> console_output.o:/usr/include/glib-2.0/glib/gutils.h:345: first defined
> here

The problem is on the glib2 side.
Guess glib/gutils.h needs a change like:
 #ifdef G_IMPLEMENT_INLINES
 #  define G_INLINE_FUNC
 #  undef  G_CAN_INLINE
 #elif defined (__GNUC__) 
 # if defined (__GNUC_STDC_INLINE__)
 #  define G_INLINE_FUNC extern inline __attribute__((__gnu_inline__))
 # else
 #  define G_INLINE_FUNC extern inline
 # endif
 #elif defined (G_CAN_INLINE) 
 #  define G_INLINE_FUNC static inline
 #else /* can't inline */
 #  define G_INLINE_FUNC
 #endif /* !G_INLINE_FUNC */

extern inline int foo (void) { return 1; }

in ISO C99 semantics means this inline function should be also emitted
out of line and exported from current CU, while in GNU inline semantics
it means if this inline can be inlined, inline it, if not, use the exported
function definition (typically from some other CU, shared library, ...).
static inline behaves the same in both semantics.  The multiple definitions
linker errors are there because extern inline in ISO C99 means the function
is exported, so each CU which includes glib/gutils.h defines g_bit_nth_lsf,
etc.

See http://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline
or ISO C99 6.7.4.

	Jakub


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