Fix the inlining magic. (#157536, Jens Hatlak, and #149907, Morten

2005-01-04  Matthias Clasen  <mclasen@redhat.com>

	Fix the inlining magic.  (#157536, Jens Hatlak, and
	#149907, Morten Welinder)

	* configure.in: Define G_CAN_INLINE in glibconfig.h

	* glib/gutils.h: Streamline the inlining magic a bit,
	don't use extern when implementing the non-inlined
	version.
This commit is contained in:
Matthias Clasen
2005-01-04 05:31:44 +00:00
committed by Matthias Clasen
parent f0630a9106
commit 44fea2aa61
7 changed files with 110 additions and 23 deletions

View File

@@ -71,21 +71,14 @@ G_BEGIN_DECLS
/* inlining hassle. for compilers that don't allow the `inline' keyword,
* mostly because of strict ANSI C compliance or dumbness, we try to fall
* back to either `__inline__' or `__inline'.
* we define G_CAN_INLINE, if the compiler seems to be actually
* *capable* to do function inlining, in which case inline function bodys
* do make sense. we also define G_INLINE_FUNC to properly export the
* function prototypes if no inlining can be performed.
* G_CAN_INLINE is defined in glibconfig.h if the compiler seems to be
* actually *capable* to do function inlining, in which case inline
* function bodies do make sense. we also define G_INLINE_FUNC to properly
* export the function prototypes if no inlining can be performed.
* inline function bodies have to be special cased with G_CAN_INLINE and a
* .c file specific macro to allow one compiled instance with extern linkage
* of the functions by defining G_IMPLEMENT_INLINES and the .c file macro.
*/
#ifdef G_IMPLEMENT_INLINES
# define G_INLINE_FUNC extern
# undef G_CAN_INLINE
#endif
#ifndef G_INLINE_FUNC
# define G_CAN_INLINE 1
#endif
#if defined (G_HAVE_INLINE) && defined (__GNUC__) && defined (__STRICT_ANSI__)
# undef inline
# define inline __inline__
@@ -97,20 +90,16 @@ G_BEGIN_DECLS
# define inline __inline
# else /* !inline && !__inline__ && !__inline */
# define inline /* don't inline, then */
# ifndef G_INLINE_FUNC
# undef G_CAN_INLINE
# endif
# endif
#endif
#ifndef G_INLINE_FUNC
# if defined (__GNUC__) && defined (__OPTIMIZE__)
# define G_INLINE_FUNC extern inline
# elif defined (G_CAN_INLINE) && !defined (__GNUC__)
# define G_INLINE_FUNC static inline
# else /* can't inline */
# define G_INLINE_FUNC extern
# undef G_CAN_INLINE
# endif
#ifdef G_IMPLEMENT_INLINES
# define G_INLINE_FUNC
#elif defined (__GNUC__) && defined (__OPTIMIZE__)
# define G_INLINE_FUNC extern inline
#elif defined (G_CAN_INLINE) && !defined (__GNUC__)
# define G_INLINE_FUNC static inline
#else /* can't inline */
# define G_INLINE_FUNC
#endif /* !G_INLINE_FUNC */
/* Retrive static string info