From 0f55c533b6a420ceba46cfe8178880d50b639535 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sat, 13 Dec 2008 01:53:28 +0000 Subject: *: document __USE_EXTERN_INLINES better; fix uclibc build if it is forcibly enabled --- include/features.h | 14 +++++++++++--- libc/sysdeps/linux/common/cmsg_nxthdr.c | 2 ++ libm/float_wrappers.c | 3 +++ libm/ldouble_wrappers.c | 3 +++ libm/s_ceil.c | 3 +++ libm/s_fabs.c | 3 +++ libm/s_finite.c | 3 +++ libm/s_floor.c | 3 +++ libm/s_llrint.c | 4 +++- libm/s_lrint.c | 4 +++- libm/s_signbit.c | 4 +++- libm/s_signbitf.c | 4 +++- 12 files changed, 43 insertions(+), 7 deletions(-) diff --git a/include/features.h b/include/features.h index defdd04c6..1d92a8213 100644 --- a/include/features.h +++ b/include/features.h @@ -365,9 +365,17 @@ #endif /* !ASSEMBLER */ -/* Decide whether we can define 'extern inline' functions in headers. */ -#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \ - && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__ \ +/* Decide whether we can, and are willing to define extern inline + * functions in headers, even if this results in a slightly bigger + * code for user programs built against uclibc. + * Enabled only in -O2 compiles, not -Os. + * uclibc itself is usually built without __USE_EXTERN_INLINES, + * remove "&& !defined __OPTIMIZE_SIZE__" part to do otherwise. + */ +#if __GNUC_PREREQ (2, 7) \ + && defined __OPTIMIZE__ \ + && !defined __OPTIMIZE_SIZE__ \ + && !defined __NO_INLINE__ \ && (defined __extern_inline || defined __GNUC_GNU_INLINE__) # define __USE_EXTERN_INLINES 1 #endif diff --git a/libc/sysdeps/linux/common/cmsg_nxthdr.c b/libc/sysdeps/linux/common/cmsg_nxthdr.c index 7dbf7bec5..5230fc6be 100644 --- a/libc/sysdeps/linux/common/cmsg_nxthdr.c +++ b/libc/sysdeps/linux/common/cmsg_nxthdr.c @@ -19,6 +19,8 @@ #define __FORCE_GLIBC #include +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include /* libc_hidden_proto(__cmsg_nxthdr) */ diff --git a/libm/float_wrappers.c b/libm/float_wrappers.c index 58d3926a7..26041d088 100644 --- a/libm/float_wrappers.c +++ b/libm/float_wrappers.c @@ -10,6 +10,9 @@ * GNU Lesser General Public License version 2.1 or later. */ +#include +/* Prevent math.h from defining colliding inlines */ +#undef __USE_EXTERN_INLINES #include #include diff --git a/libm/ldouble_wrappers.c b/libm/ldouble_wrappers.c index d82436da4..62732bae9 100644 --- a/libm/ldouble_wrappers.c +++ b/libm/ldouble_wrappers.c @@ -10,6 +10,9 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ +#include +/* Prevent math.h from defining colliding inlines */ +#undef __USE_EXTERN_INLINES #include "math.h" /* Implement the following, as defined by SuSv3 */ diff --git a/libm/s_ceil.c b/libm/s_ceil.c index 76be3ea43..c488510b1 100644 --- a/libm/s_ceil.c +++ b/libm/s_ceil.c @@ -23,6 +23,9 @@ static char rcsid[] = "$NetBSD: s_ceil.c,v 1.8 1995/05/10 20:46:53 jtc Exp $"; * Inexact flag raised if x not equal to ceil(x). */ +#include +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include "math.h" #include "math_private.h" diff --git a/libm/s_fabs.c b/libm/s_fabs.c index deb91382d..942a9b802 100644 --- a/libm/s_fabs.c +++ b/libm/s_fabs.c @@ -18,6 +18,9 @@ static char rcsid[] = "$NetBSD: s_fabs.c,v 1.7 1995/05/10 20:47:13 jtc Exp $"; * fabs(x) returns the absolute value of x. */ +#include +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include "math.h" #include "math_private.h" diff --git a/libm/s_finite.c b/libm/s_finite.c index 758da9a40..2235d0a42 100644 --- a/libm/s_finite.c +++ b/libm/s_finite.c @@ -15,6 +15,9 @@ * no branching! */ +#include +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include "math.h" #include "math_private.h" diff --git a/libm/s_floor.c b/libm/s_floor.c index 1eccfcd8c..c9bc2a0d0 100644 --- a/libm/s_floor.c +++ b/libm/s_floor.c @@ -23,6 +23,9 @@ static char rcsid[] = "$NetBSD: s_floor.c,v 1.8 1995/05/10 20:47:20 jtc Exp $"; * Inexact flag raised if x not equal to floor(x). */ +#include +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include "math.h" #include "math_private.h" diff --git a/libm/s_llrint.c b/libm/s_llrint.c index 96e1495c7..b5f75c2e2 100644 --- a/libm/s_llrint.c +++ b/libm/s_llrint.c @@ -19,8 +19,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include - #include "math_private.h" static const double two52[2] = diff --git a/libm/s_lrint.c b/libm/s_lrint.c index a0db12d76..3cdc8a253 100644 --- a/libm/s_lrint.c +++ b/libm/s_lrint.c @@ -19,8 +19,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include - #include "math_private.h" static const double two52[2] = diff --git a/libm/s_signbit.c b/libm/s_signbit.c index c9f6527af..ee1b7c62e 100644 --- a/libm/s_signbit.c +++ b/libm/s_signbit.c @@ -18,8 +18,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include - #include "math_private.h" int diff --git a/libm/s_signbitf.c b/libm/s_signbitf.c index ef83d6b7f..3a5cf0c2a 100644 --- a/libm/s_signbitf.c +++ b/libm/s_signbitf.c @@ -18,8 +18,10 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include - #include "math_private.h" libm_hidden_proto(__signbitf) -- cgit v1.2.3