diff options
author | das <das@FreeBSD.org> | 2011-10-10 15:43:09 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2011-10-10 15:43:09 +0000 |
commit | a38603b0b57960e07b576fdc7c8ed64d919770d0 (patch) | |
tree | a50d2b89f2f16772503039f06c8507b9292a1daa /lib/msun/powerpc | |
parent | 768c3db25c16c726fe7df21f139f54cd6342dfbf (diff) | |
download | FreeBSD-src-a38603b0b57960e07b576fdc7c8ed64d919770d0.zip FreeBSD-src-a38603b0b57960e07b576fdc7c8ed64d919770d0.tar.gz |
Provide external definitions of all of the standardized functions in
fenv.h that are currently inlined.
The definitions are provided in fenv.c via 'extern inline'
declaractions. This assumes the compiler handles 'extern inline' as
specified in C99, which has been true under FreeBSD since 8.0.
The goal is to eventually remove the 'static' keyword from the inline
definitions in fenv.h, so that non-inlined references all wind up
pointing to the same external definition like they're supposed to.
I am deferring the second step to provide a window where
newly-compiled apps will still link against old math libraries.
(This isn't supported, but there's no need to cause undue breakage.)
Reviewed by: stefanf, bde
Diffstat (limited to 'lib/msun/powerpc')
-rw-r--r-- | lib/msun/powerpc/Symbol.map | 8 | ||||
-rw-r--r-- | lib/msun/powerpc/fenv.c | 17 | ||||
-rw-r--r-- | lib/msun/powerpc/fenv.h | 34 |
3 files changed, 45 insertions, 14 deletions
diff --git a/lib/msun/powerpc/Symbol.map b/lib/msun/powerpc/Symbol.map index 3121177..971112e 100644 --- a/lib/msun/powerpc/Symbol.map +++ b/lib/msun/powerpc/Symbol.map @@ -3,3 +3,11 @@ */ FBSD_1.0 { }; + +FBSD_1.3 { + fesetexceptflag; + feraiseexcept; + fegetenv; + feholdexcept; + feupdateenv; +}; diff --git a/lib/msun/powerpc/fenv.c b/lib/msun/powerpc/fenv.c index 04bbeaf..9191a48 100644 --- a/lib/msun/powerpc/fenv.c +++ b/lib/msun/powerpc/fenv.c @@ -26,6 +26,23 @@ * $FreeBSD$ */ +#define __fenv_static #include <fenv.h> +#ifdef __GNUC_GNU_INLINE__ +#error "This file must be compiled with C99 'inline' semantics" +#endif + const fenv_t __fe_dfl_env = 0x00000000; + +extern inline int feclearexcept(int __excepts); +extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); +extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts); +extern inline int feraiseexcept(int __excepts); +extern inline int fetestexcept(int __excepts); +extern inline int fegetround(void); +extern inline int fesetround(int __round); +extern inline int fegetenv(fenv_t *__envp); +extern inline int feholdexcept(fenv_t *__envp); +extern inline int fesetenv(const fenv_t *__envp); +extern inline int feupdateenv(const fenv_t *__envp); diff --git a/lib/msun/powerpc/fenv.h b/lib/msun/powerpc/fenv.h index c29f8a0..b96fdee 100644 --- a/lib/msun/powerpc/fenv.h +++ b/lib/msun/powerpc/fenv.h @@ -31,6 +31,10 @@ #include <sys/_types.h> +#ifndef __fenv_static +#define __fenv_static static +#endif + typedef __uint32_t fenv_t; typedef __uint32_t fexcept_t; @@ -98,7 +102,7 @@ union __fpscr { } __bits; }; -static __inline int +__fenv_static inline int feclearexcept(int __excepts) { union __fpscr __r; @@ -111,7 +115,7 @@ feclearexcept(int __excepts) return (0); } -static __inline int +__fenv_static inline int fegetexceptflag(fexcept_t *__flagp, int __excepts) { union __fpscr __r; @@ -121,7 +125,7 @@ fegetexceptflag(fexcept_t *__flagp, int __excepts) return (0); } -static __inline int +__fenv_static inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts) { union __fpscr __r; @@ -135,7 +139,7 @@ fesetexceptflag(const fexcept_t *__flagp, int __excepts) return (0); } -static __inline int +__fenv_static inline int feraiseexcept(int __excepts) { union __fpscr __r; @@ -148,7 +152,7 @@ feraiseexcept(int __excepts) return (0); } -static __inline int +__fenv_static inline int fetestexcept(int __excepts) { union __fpscr __r; @@ -157,7 +161,7 @@ fetestexcept(int __excepts) return (__r.__bits.__reg & __excepts); } -static __inline int +__fenv_static inline int fegetround(void) { union __fpscr __r; @@ -166,7 +170,7 @@ fegetround(void) return (__r.__bits.__reg & _ROUND_MASK); } -static __inline int +__fenv_static inline int fesetround(int __round) { union __fpscr __r; @@ -180,7 +184,7 @@ fesetround(int __round) return (0); } -static __inline int +__fenv_static inline int fegetenv(fenv_t *__envp) { union __fpscr __r; @@ -190,7 +194,7 @@ fegetenv(fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int feholdexcept(fenv_t *__envp) { union __fpscr __r; @@ -202,7 +206,7 @@ feholdexcept(fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int fesetenv(const fenv_t *__envp) { union __fpscr __r; @@ -212,7 +216,7 @@ fesetenv(const fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int feupdateenv(const fenv_t *__envp) { union __fpscr __r; @@ -226,7 +230,9 @@ feupdateenv(const fenv_t *__envp) #if __BSD_VISIBLE -static __inline int +/* We currently provide no external definitions of the functions below. */ + +static inline int feenableexcept(int __mask) { union __fpscr __r; @@ -239,7 +245,7 @@ feenableexcept(int __mask) return ((__oldmask & _ENABLE_MASK) << _FPUSW_SHIFT); } -static __inline int +static inline int fedisableexcept(int __mask) { union __fpscr __r; @@ -252,7 +258,7 @@ fedisableexcept(int __mask) return ((__oldmask & _ENABLE_MASK) << _FPUSW_SHIFT); } -static __inline int +static inline int fegetexcept(void) { union __fpscr __r; |