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

@ -1,3 +1,14 @@
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.
2005-01-03 Matthias Clasen <mclasen@redhat.com>
* glib/gutils.c (g_find_program_in_path): Don't return

View File

@ -1,3 +1,14 @@
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.
2005-01-03 Matthias Clasen <mclasen@redhat.com>
* glib/gutils.c (g_find_program_in_path): Don't return

View File

@ -1,3 +1,14 @@
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.
2005-01-03 Matthias Clasen <mclasen@redhat.com>
* glib/gutils.c (g_find_program_in_path): Don't return

View File

@ -1,3 +1,14 @@
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.
2005-01-03 Matthias Clasen <mclasen@redhat.com>
* glib/gutils.c (g_find_program_in_path): Don't return

View File

@ -1,3 +1,14 @@
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.
2005-01-03 Matthias Clasen <mclasen@redhat.com>
* glib/gutils.c (g_find_program_in_path): Don't return

View File

@ -662,6 +662,34 @@ case x$glib_cv_hasinline in
xyes) AC_DEFINE(G_HAVE_INLINE,1,[Have inline keyword])
esac
# if we can use inline functions in headers
AC_MSG_CHECKING(if inline functions in headers work)
AC_LINK_IFELSE([
#if defined (G_HAVE_INLINE) && defined (__GNUC__) && defined (__STRICT_ANSI__)
# undef inline
# define inline __inline__
#elif !defined (G_HAVE_INLINE)
# undef inline
# if defined (G_HAVE___INLINE__)
# define inline __inline__
# elif defined (G_HAVE___INLINE)
# define inline __inline
# endif
#endif
int glib_test_func2 (int);
static inline int
glib_test_func1 (void) {
return glib_test_func2 (1);
}
int
main (void) {
int i = 1;
}],[g_can_inline=yes],[g_can_inline=no])
AC_MSG_RESULT($g_can_inline)
# check for flavours of varargs macros
AC_MSG_CHECKING(for ISO C99 varargs macros in C)
AC_TRY_COMPILE([],[
@ -2212,6 +2240,20 @@ $glib_vacopy
$glib_inline
#endif /* !__cplusplus */
#ifdef __cplusplus
#define G_CAN_INLINE 1
_______EOF
if test x$g_can_inline = xyes ; then
cat >>$outfile <<_______EOF
#else /* !__cplusplus */
#define G_CAN_INLINE 1
_______EOF
fi
cat >>$outfile <<_______EOF
#endif
_______EOF
if test x$g_have_iso_c_varargs = xyes ; then
@ -2591,6 +2633,7 @@ g_have_gnuc_varargs=$g_have_gnuc_varargs
g_have_iso_c_varargs=$g_have_iso_c_varargs
g_have_iso_cxx_varargs=$g_have_iso_cxx_varargs
g_can_inline=$g_can_inline
g_have_gnuc_visibility=$g_have_gnuc_visibility
case xyes in

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