On Mac OS X Leopard #define G_INLINE_FUNC as static inline
Submitted by Ludovic Rousseau
Link to original bug (#492152)
Description
Please describe the problem: On Mac OS X (Leopard) G_INLINE_FUNC is defined as extern inline. This is the cause of symbol duplication with an error message like: ld: duplicate symbol _g_bit_nth_lsf in jpilot-sync.o and category.o
g_bit_nth_lsf is defined as: #if defined (G_CAN_INLINE) || defined (G_UTILS_C) G_INLINE_FUNC gint g_bit_nth_lsf (gulong mask, gint nth_bit) { [...]
G_INLINE_FUNC is defined as: #ifdef G_IMPLEMENT_INLINES
define G_INLINE_FUNC
undef G_CAN_INLINE
#elif defined (GNUC)
define G_INLINE_FUNC extern inline
#elif defined (G_CAN_INLINE)
define G_INLINE_FUNC static inline
#else /* can't inline */
define G_INLINE_FUNC
#endif /* !G_INLINE_FUNC */
Even if Mac OS X uses GCC as the compiler the linker is not GNU ld. $ ld -v @(#)PROGRAM:ld PROJECT:ld64-77
Steps to reproduce:
Actual results:
Expected results:
Does this happen every time?
Other information: I propose the patch: Index: glib/glib/gutils.h
--- glib/glib/gutils.h (revision 5798) +++ glib/glib/gutils.h (working copy) @@ -96,10 +96,10 @@ G_BEGIN_DECLS #ifdef G_IMPLEMENT_INLINES
define G_INLINE_FUNC
undef G_CAN_INLINE
-#elif defined (GNUC) -# define G_INLINE_FUNC extern inline #elif defined (G_CAN_INLINE)
define G_INLINE_FUNC static inline
+#elif defined (GNUC) +# define G_INLINE_FUNC extern inline #else /* can't inline */
define G_INLINE_FUNC
#endif /* !G_INLINE_FUNC */
Maybe adding a #ifdef APPLE would be a better idea.