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 | |
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')
-rw-r--r-- | lib/msun/Symbol.map | 10 | ||||
-rw-r--r-- | lib/msun/amd64/Symbol.map | 2 | ||||
-rw-r--r-- | lib/msun/amd64/fenv.c | 15 | ||||
-rw-r--r-- | lib/msun/amd64/fenv.h | 19 | ||||
-rw-r--r-- | lib/msun/arm/Symbol.map | 8 | ||||
-rw-r--r-- | lib/msun/arm/fenv.c | 17 | ||||
-rw-r--r-- | lib/msun/arm/fenv.h | 34 | ||||
-rw-r--r-- | lib/msun/i387/Symbol.map | 2 | ||||
-rw-r--r-- | lib/msun/i387/fenv.c | 20 | ||||
-rw-r--r-- | lib/msun/i387/fenv.h | 19 | ||||
-rw-r--r-- | lib/msun/ia64/Symbol.map | 7 | ||||
-rw-r--r-- | lib/msun/ia64/fenv.c | 17 | ||||
-rw-r--r-- | lib/msun/ia64/fenv.h | 32 | ||||
-rw-r--r-- | lib/msun/mips/Symbol.map | 8 | ||||
-rw-r--r-- | lib/msun/mips/fenv.c | 17 | ||||
-rw-r--r-- | lib/msun/mips/fenv.h | 34 | ||||
-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 | ||||
-rw-r--r-- | lib/msun/sparc64/Symbol.map | 8 | ||||
-rw-r--r-- | lib/msun/sparc64/fenv.c | 17 | ||||
-rw-r--r-- | lib/msun/sparc64/fenv.h | 34 |
22 files changed, 288 insertions, 91 deletions
diff --git a/lib/msun/Symbol.map b/lib/msun/Symbol.map index bb53ac3..cd823ae 100644 --- a/lib/msun/Symbol.map +++ b/lib/msun/Symbol.map @@ -228,3 +228,13 @@ FBSD_1.2 { log2; log2f; }; + +/* First added in 10.0-CURRENT */ +FBSD_1.3 { + feclearexcept; + fegetexceptflag; + fetestexcept; + fegetround; + fesetround; + fesetenv; +}; diff --git a/lib/msun/amd64/Symbol.map b/lib/msun/amd64/Symbol.map index f4c13a4..3da32ff 100644 --- a/lib/msun/amd64/Symbol.map +++ b/lib/msun/amd64/Symbol.map @@ -7,8 +7,6 @@ FBSD_1.0 { fegetenv; feholdexcept; feupdateenv; - __feenableexcept; - __fedisableexcept; feenableexcept; fedisableexcept; }; diff --git a/lib/msun/amd64/fenv.c b/lib/msun/amd64/fenv.c index e126070..c543bd5 100644 --- a/lib/msun/amd64/fenv.c +++ b/lib/msun/amd64/fenv.c @@ -29,8 +29,14 @@ #include <sys/cdefs.h> #include <sys/types.h> #include <machine/fpu.h> + +#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 = { { 0xffff0000 | __INITIAL_FPUCW__, 0xffff0000, @@ -41,6 +47,9 @@ const fenv_t __fe_dfl_env = { __INITIAL_MXCSR__ }; +extern inline int feclearexcept(int __excepts); +extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); + int fesetexceptflag(const fexcept_t *flagp, int excepts) { @@ -69,6 +78,10 @@ feraiseexcept(int excepts) return (0); } +extern inline int fetestexcept(int __excepts); +extern inline int fegetround(void); +extern inline int fesetround(int __round); + int fegetenv(fenv_t *envp) { @@ -98,6 +111,8 @@ feholdexcept(fenv_t *envp) return (0); } +extern inline int fesetenv(const fenv_t *__envp); + int feupdateenv(const fenv_t *envp) { diff --git a/lib/msun/amd64/fenv.h b/lib/msun/amd64/fenv.h index 875664a..b7c9873 100644 --- a/lib/msun/amd64/fenv.h +++ b/lib/msun/amd64/fenv.h @@ -32,6 +32,10 @@ #include <sys/cdefs.h> #include <sys/_types.h> +#ifndef __fenv_static +#define __fenv_static static +#endif + typedef struct { struct { __uint32_t __control; @@ -89,7 +93,7 @@ extern const fenv_t __fe_dfl_env; #define __ldmxcsr(__csr) __asm __volatile("ldmxcsr %0" : : "m" (__csr)) #define __stmxcsr(__csr) __asm __volatile("stmxcsr %0" : "=m" (*(__csr))) -static __inline int +__fenv_static inline int feclearexcept(int __excepts) { fenv_t __env; @@ -107,7 +111,7 @@ feclearexcept(int __excepts) return (0); } -static __inline int +__fenv_static inline int fegetexceptflag(fexcept_t *__flagp, int __excepts) { __uint32_t __mxcsr; @@ -122,7 +126,7 @@ fegetexceptflag(fexcept_t *__flagp, int __excepts) int fesetexceptflag(const fexcept_t *__flagp, int __excepts); int feraiseexcept(int __excepts); -static __inline int +__fenv_static inline int fetestexcept(int __excepts) { __uint32_t __mxcsr; @@ -133,7 +137,7 @@ fetestexcept(int __excepts) return ((__status | __mxcsr) & __excepts); } -static __inline int +__fenv_static inline int fegetround(void) { __uint16_t __control; @@ -148,7 +152,7 @@ fegetround(void) return (__control & _ROUND_MASK); } -static __inline int +__fenv_static inline int fesetround(int __round) { __uint32_t __mxcsr; @@ -173,7 +177,7 @@ fesetround(int __round) int fegetenv(fenv_t *__envp); int feholdexcept(fenv_t *__envp); -static __inline int +__fenv_static inline int fesetenv(const fenv_t *__envp) { @@ -197,7 +201,8 @@ int feupdateenv(const fenv_t *__envp); int feenableexcept(int __mask); int fedisableexcept(int __mask); -static __inline int +/* We currently provide no external definition of fegetexcept(). */ +static inline int fegetexcept(void) { __uint16_t __control; diff --git a/lib/msun/arm/Symbol.map b/lib/msun/arm/Symbol.map index 3121177..971112e 100644 --- a/lib/msun/arm/Symbol.map +++ b/lib/msun/arm/Symbol.map @@ -3,3 +3,11 @@ */ FBSD_1.0 { }; + +FBSD_1.3 { + fesetexceptflag; + feraiseexcept; + fegetenv; + feholdexcept; + feupdateenv; +}; diff --git a/lib/msun/arm/fenv.c b/lib/msun/arm/fenv.c index a6781e0..f96bb64 100644 --- a/lib/msun/arm/fenv.c +++ b/lib/msun/arm/fenv.c @@ -26,10 +26,27 @@ * $FreeBSD$ */ +#define __fenv_static #include <fenv.h> +#ifdef __GNUC_GNU_INLINE__ +#error "This file must be compiled with C99 'inline' semantics" +#endif + /* * Hopefully the system ID byte is immutable, so it's valid to use * this as a default environment. */ const fenv_t __fe_dfl_env = 0; + +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/arm/fenv.h b/lib/msun/arm/fenv.h index d540ae2..f114998 100644 --- a/lib/msun/arm/fenv.h +++ b/lib/msun/arm/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; @@ -68,7 +72,7 @@ extern const fenv_t __fe_dfl_env; #define __wfs(__fpsr) #endif -static __inline int +__fenv_static inline int feclearexcept(int __excepts) { fexcept_t __fpsr; @@ -79,7 +83,7 @@ feclearexcept(int __excepts) return (0); } -static __inline int +__fenv_static inline int fegetexceptflag(fexcept_t *__flagp, int __excepts) { fexcept_t __fpsr; @@ -89,7 +93,7 @@ fegetexceptflag(fexcept_t *__flagp, int __excepts) return (0); } -static __inline int +__fenv_static inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts) { fexcept_t __fpsr; @@ -101,7 +105,7 @@ fesetexceptflag(const fexcept_t *__flagp, int __excepts) return (0); } -static __inline int +__fenv_static inline int feraiseexcept(int __excepts) { fexcept_t __ex = __excepts; @@ -110,7 +114,7 @@ feraiseexcept(int __excepts) return (0); } -static __inline int +__fenv_static inline int fetestexcept(int __excepts) { fexcept_t __fpsr; @@ -119,7 +123,7 @@ fetestexcept(int __excepts) return (__fpsr & __excepts); } -static __inline int +__fenv_static inline int fegetround(void) { @@ -131,14 +135,14 @@ fegetround(void) return (-1); } -static __inline int +__fenv_static inline int fesetround(int __round) { return (-1); } -static __inline int +__fenv_static inline int fegetenv(fenv_t *__envp) { @@ -146,7 +150,7 @@ fegetenv(fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int feholdexcept(fenv_t *__envp) { fenv_t __env; @@ -158,7 +162,7 @@ feholdexcept(fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int fesetenv(const fenv_t *__envp) { @@ -166,7 +170,7 @@ fesetenv(const fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int feupdateenv(const fenv_t *__envp) { fexcept_t __fpsr; @@ -179,7 +183,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) { fenv_t __old_fpsr, __new_fpsr; @@ -190,7 +196,7 @@ feenableexcept(int __mask) return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT); } -static __inline int +static inline int fedisableexcept(int __mask) { fenv_t __old_fpsr, __new_fpsr; @@ -201,7 +207,7 @@ fedisableexcept(int __mask) return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT); } -static __inline int +static inline int fegetexcept(void) { fenv_t __fpsr; diff --git a/lib/msun/i387/Symbol.map b/lib/msun/i387/Symbol.map index aa81690..35e6e18 100644 --- a/lib/msun/i387/Symbol.map +++ b/lib/msun/i387/Symbol.map @@ -9,8 +9,6 @@ FBSD_1.0 { fegetenv; feholdexcept; feupdateenv; - __feenableexcept; - __fedisableexcept; feenableexcept; fedisableexcept; }; diff --git a/lib/msun/i387/fenv.c b/lib/msun/i387/fenv.c index 5c996b3..326f7f7 100644 --- a/lib/msun/i387/fenv.c +++ b/lib/msun/i387/fenv.c @@ -29,7 +29,13 @@ #include <sys/cdefs.h> #include <sys/types.h> #include <machine/npx.h> -#include "fenv.h" + +#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 = { __INITIAL_NPXCW__, @@ -83,6 +89,9 @@ __test_sse(void) return (0); } +extern inline int feclearexcept(int __excepts); +extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); + int fesetexceptflag(const fexcept_t *flagp, int excepts) { @@ -114,6 +123,10 @@ feraiseexcept(int excepts) return (0); } +extern inline int fetestexcept(int __excepts); +extern inline int fegetround(void); +extern inline int fesetround(int __round); + int fegetenv(fenv_t *envp) { @@ -149,6 +162,8 @@ feholdexcept(fenv_t *envp) return (0); } +extern inline int fesetenv(const fenv_t *__envp); + int feupdateenv(const fenv_t *envp) { @@ -208,6 +223,3 @@ __fedisableexcept(int mask) } return (~omask); } - -__weak_reference(__feenableexcept, feenableexcept); -__weak_reference(__fedisableexcept, fedisableexcept); diff --git a/lib/msun/i387/fenv.h b/lib/msun/i387/fenv.h index cc58a92..329dfe1 100644 --- a/lib/msun/i387/fenv.h +++ b/lib/msun/i387/fenv.h @@ -32,6 +32,10 @@ #include <sys/cdefs.h> #include <sys/_types.h> +#ifndef __fenv_static +#define __fenv_static static +#endif + /* * To preserve binary compatibility with FreeBSD 5.3, we pack the * mxcsr into some reserved fields, rather than changing sizeof(fenv_t). @@ -110,7 +114,7 @@ extern const fenv_t __fe_dfl_env; #define __ldmxcsr(__csr) __asm __volatile("ldmxcsr %0" : : "m" (__csr)) #define __stmxcsr(__csr) __asm __volatile("stmxcsr %0" : "=m" (*(__csr))) -static __inline int +__fenv_static inline int feclearexcept(int __excepts) { fenv_t __env; @@ -131,7 +135,7 @@ feclearexcept(int __excepts) return (0); } -static __inline int +__fenv_static inline int fegetexceptflag(fexcept_t *__flagp, int __excepts) { __uint32_t __mxcsr; @@ -149,7 +153,7 @@ fegetexceptflag(fexcept_t *__flagp, int __excepts) int fesetexceptflag(const fexcept_t *__flagp, int __excepts); int feraiseexcept(int __excepts); -static __inline int +__fenv_static inline int fetestexcept(int __excepts) { __uint32_t __mxcsr; @@ -163,7 +167,7 @@ fetestexcept(int __excepts) return ((__status | __mxcsr) & __excepts); } -static __inline int +__fenv_static inline int fegetround(void) { __uint16_t __control; @@ -178,7 +182,7 @@ fegetround(void) return (__control & _ROUND_MASK); } -static __inline int +__fenv_static inline int fesetround(int __round) { __uint32_t __mxcsr; @@ -205,7 +209,7 @@ fesetround(int __round) int fegetenv(fenv_t *__envp); int feholdexcept(fenv_t *__envp); -static __inline int +__fenv_static inline int fesetenv(const fenv_t *__envp) { fenv_t __env = *__envp; @@ -234,7 +238,8 @@ int feupdateenv(const fenv_t *__envp); int feenableexcept(int __mask); int fedisableexcept(int __mask); -static __inline int +/* We currently provide no external definition of fegetexcept(). */ +static inline int fegetexcept(void) { __uint16_t __control; diff --git a/lib/msun/ia64/Symbol.map b/lib/msun/ia64/Symbol.map index 00ed4ee..c92e75d 100644 --- a/lib/msun/ia64/Symbol.map +++ b/lib/msun/ia64/Symbol.map @@ -4,3 +4,10 @@ FBSD_1.0 { feupdateenv; }; + +FBSD_1.3 { + fesetexceptflag; + feraiseexcept; + fegetenv; + feholdexcept; +}; diff --git a/lib/msun/ia64/fenv.c b/lib/msun/ia64/fenv.c index 95a5809..9e760da 100644 --- a/lib/msun/ia64/fenv.c +++ b/lib/msun/ia64/fenv.c @@ -27,10 +27,27 @@ */ #include <sys/types.h> + +#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 = 0x0009804c8a70033fULL; +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); + /* * It doesn't pay to inline feupdateenv() because it includes one of * the rare uses of feraiseexcept() where the argument is not a diff --git a/lib/msun/ia64/fenv.h b/lib/msun/ia64/fenv.h index 6f0240f..0f001db 100644 --- a/lib/msun/ia64/fenv.h +++ b/lib/msun/ia64/fenv.h @@ -31,6 +31,10 @@ #include <sys/_types.h> +#ifndef __fenv_static +#define __fenv_static static +#endif + typedef __uint64_t fenv_t; typedef __uint16_t fexcept_t; @@ -63,7 +67,7 @@ extern const fenv_t __fe_dfl_env; #define __stfpsr(__r) __asm __volatile("mov %0=ar.fpsr" : "=r" (*(__r))) #define __ldfpsr(__r) __asm __volatile("mov ar.fpsr=%0;;" : : "r" (__r)) -static __inline int +__fenv_static inline int feclearexcept(int __excepts) { fenv_t __fpsr; @@ -74,7 +78,7 @@ feclearexcept(int __excepts) return (0); } -static __inline int +__fenv_static inline int fegetexceptflag(fexcept_t *__flagp, int __excepts) { fenv_t __fpsr; @@ -84,7 +88,7 @@ fegetexceptflag(fexcept_t *__flagp, int __excepts) return (0); } -static __inline int +__fenv_static inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts) { fenv_t __fpsr; @@ -103,7 +107,7 @@ fesetexceptflag(const fexcept_t *__flagp, int __excepts) * figure this out automatically, and there's no way to tell it. * We assume that constant arguments will be the common case. */ -static __inline int +__fenv_static inline int feraiseexcept(int __excepts) { volatile double d; @@ -138,7 +142,7 @@ feraiseexcept(int __excepts) return (0); } -static __inline int +__fenv_static inline int fetestexcept(int __excepts) { fenv_t __fpsr; @@ -148,7 +152,7 @@ fetestexcept(int __excepts) } -static __inline int +__fenv_static inline int fegetround(void) { fenv_t __fpsr; @@ -157,7 +161,7 @@ fegetround(void) return (__fpsr & _ROUND_MASK); } -static __inline int +__fenv_static inline int fesetround(int __round) { fenv_t __fpsr; @@ -171,7 +175,7 @@ fesetround(int __round) return (0); } -static __inline int +__fenv_static inline int fegetenv(fenv_t *__envp) { @@ -179,7 +183,7 @@ fegetenv(fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int feholdexcept(fenv_t *__envp) { fenv_t __fpsr; @@ -192,7 +196,7 @@ feholdexcept(fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int fesetenv(const fenv_t *__envp) { @@ -204,7 +208,9 @@ int 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) { fenv_t __newfpsr, __oldfpsr; @@ -215,7 +221,7 @@ feenableexcept(int __mask) return (~__oldfpsr & FE_ALL_EXCEPT); } -static __inline int +static inline int fedisableexcept(int __mask) { fenv_t __newfpsr, __oldfpsr; @@ -226,7 +232,7 @@ fedisableexcept(int __mask) return (~__oldfpsr & FE_ALL_EXCEPT); } -static __inline int +static inline int fegetexcept(void) { fenv_t __fpsr; diff --git a/lib/msun/mips/Symbol.map b/lib/msun/mips/Symbol.map index 3121177..971112e 100644 --- a/lib/msun/mips/Symbol.map +++ b/lib/msun/mips/Symbol.map @@ -3,3 +3,11 @@ */ FBSD_1.0 { }; + +FBSD_1.3 { + fesetexceptflag; + feraiseexcept; + fegetenv; + feholdexcept; + feupdateenv; +}; diff --git a/lib/msun/mips/fenv.c b/lib/msun/mips/fenv.c index a6781e0..f96bb64 100644 --- a/lib/msun/mips/fenv.c +++ b/lib/msun/mips/fenv.c @@ -26,10 +26,27 @@ * $FreeBSD$ */ +#define __fenv_static #include <fenv.h> +#ifdef __GNUC_GNU_INLINE__ +#error "This file must be compiled with C99 'inline' semantics" +#endif + /* * Hopefully the system ID byte is immutable, so it's valid to use * this as a default environment. */ const fenv_t __fe_dfl_env = 0; + +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/mips/fenv.h b/lib/msun/mips/fenv.h index d540ae2..f114998 100644 --- a/lib/msun/mips/fenv.h +++ b/lib/msun/mips/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; @@ -68,7 +72,7 @@ extern const fenv_t __fe_dfl_env; #define __wfs(__fpsr) #endif -static __inline int +__fenv_static inline int feclearexcept(int __excepts) { fexcept_t __fpsr; @@ -79,7 +83,7 @@ feclearexcept(int __excepts) return (0); } -static __inline int +__fenv_static inline int fegetexceptflag(fexcept_t *__flagp, int __excepts) { fexcept_t __fpsr; @@ -89,7 +93,7 @@ fegetexceptflag(fexcept_t *__flagp, int __excepts) return (0); } -static __inline int +__fenv_static inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts) { fexcept_t __fpsr; @@ -101,7 +105,7 @@ fesetexceptflag(const fexcept_t *__flagp, int __excepts) return (0); } -static __inline int +__fenv_static inline int feraiseexcept(int __excepts) { fexcept_t __ex = __excepts; @@ -110,7 +114,7 @@ feraiseexcept(int __excepts) return (0); } -static __inline int +__fenv_static inline int fetestexcept(int __excepts) { fexcept_t __fpsr; @@ -119,7 +123,7 @@ fetestexcept(int __excepts) return (__fpsr & __excepts); } -static __inline int +__fenv_static inline int fegetround(void) { @@ -131,14 +135,14 @@ fegetround(void) return (-1); } -static __inline int +__fenv_static inline int fesetround(int __round) { return (-1); } -static __inline int +__fenv_static inline int fegetenv(fenv_t *__envp) { @@ -146,7 +150,7 @@ fegetenv(fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int feholdexcept(fenv_t *__envp) { fenv_t __env; @@ -158,7 +162,7 @@ feholdexcept(fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int fesetenv(const fenv_t *__envp) { @@ -166,7 +170,7 @@ fesetenv(const fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int feupdateenv(const fenv_t *__envp) { fexcept_t __fpsr; @@ -179,7 +183,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) { fenv_t __old_fpsr, __new_fpsr; @@ -190,7 +196,7 @@ feenableexcept(int __mask) return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT); } -static __inline int +static inline int fedisableexcept(int __mask) { fenv_t __old_fpsr, __new_fpsr; @@ -201,7 +207,7 @@ fedisableexcept(int __mask) return ((__old_fpsr >> _FPUSW_SHIFT) & FE_ALL_EXCEPT); } -static __inline int +static inline int fegetexcept(void) { fenv_t __fpsr; 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; diff --git a/lib/msun/sparc64/Symbol.map b/lib/msun/sparc64/Symbol.map index 3121177..971112e 100644 --- a/lib/msun/sparc64/Symbol.map +++ b/lib/msun/sparc64/Symbol.map @@ -3,3 +3,11 @@ */ FBSD_1.0 { }; + +FBSD_1.3 { + fesetexceptflag; + feraiseexcept; + fegetenv; + feholdexcept; + feupdateenv; +}; diff --git a/lib/msun/sparc64/fenv.c b/lib/msun/sparc64/fenv.c index 6e8220f..a1db64e 100644 --- a/lib/msun/sparc64/fenv.c +++ b/lib/msun/sparc64/fenv.c @@ -26,11 +26,28 @@ * $FreeBSD$ */ +#define __fenv_static #include <fenv.h> +#ifdef __GNUC_GNU_INLINE__ +#error "This file must be compiled with C99 'inline' semantics" +#endif + /* * The FSR_version field may be different on different * implementations, but it is immutable and opaque to the * application. Thus, 0 is valid as the default environment. */ const fenv_t __fe_dfl_env = 0; + +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/sparc64/fenv.h b/lib/msun/sparc64/fenv.h index 8273299..d17361f 100644 --- a/lib/msun/sparc64/fenv.h +++ b/lib/msun/sparc64/fenv.h @@ -31,6 +31,10 @@ #include <sys/_types.h> +#ifndef __fenv_static +#define __fenv_static static +#endif + typedef __uint64_t fenv_t; typedef __uint64_t fexcept_t; @@ -70,7 +74,7 @@ extern const fenv_t __fe_dfl_env; #define __ldxfsr(__r) __asm __volatile("ldx %0, %%fsr" : : "m" (__r)) #define __stxfsr(__r) __asm __volatile("stx %%fsr, %0" : "=m" (*(__r))) -static __inline int +__fenv_static __inline int feclearexcept(int __excepts) { fexcept_t __r; @@ -81,7 +85,7 @@ feclearexcept(int __excepts) return (0); } -static __inline int +__fenv_static inline int fegetexceptflag(fexcept_t *__flagp, int __excepts) { fexcept_t __r; @@ -91,7 +95,7 @@ fegetexceptflag(fexcept_t *__flagp, int __excepts) return (0); } -static __inline int +__fenv_static inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts) { fexcept_t __r; @@ -108,7 +112,7 @@ fesetexceptflag(const fexcept_t *__flagp, int __excepts) * inline this function on sparc64 even when the arguments are not * compile-time constants. Perhaps this depends on the register window. */ -static __inline int +__fenv_static inline int feraiseexcept(int __excepts) { volatile double d; @@ -143,7 +147,7 @@ feraiseexcept(int __excepts) return (0); } -static __inline int +__fenv_static inline int fetestexcept(int __excepts) { fexcept_t __r; @@ -152,7 +156,7 @@ fetestexcept(int __excepts) return (__r & __excepts); } -static __inline int +__fenv_static inline int fegetround(void) { fenv_t __r; @@ -161,7 +165,7 @@ fegetround(void) return ((__r >> _ROUND_SHIFT) & _ROUND_MASK); } -static __inline int +__fenv_static inline int fesetround(int __round) { fenv_t __r; @@ -175,7 +179,7 @@ fesetround(int __round) return (0); } -static __inline int +__fenv_static inline int fegetenv(fenv_t *__envp) { @@ -183,7 +187,7 @@ fegetenv(fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int feholdexcept(fenv_t *__envp) { fenv_t __r; @@ -195,7 +199,7 @@ feholdexcept(fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int fesetenv(const fenv_t *__envp) { @@ -203,7 +207,7 @@ fesetenv(const fenv_t *__envp) return (0); } -static __inline int +__fenv_static inline int feupdateenv(const fenv_t *__envp) { fexcept_t __r; @@ -216,7 +220,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) { fenv_t __old_r, __new_r; @@ -227,7 +233,7 @@ feenableexcept(int __mask) return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT); } -static __inline int +static inline int fedisableexcept(int __mask) { fenv_t __old_r, __new_r; @@ -238,7 +244,7 @@ fedisableexcept(int __mask) return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT); } -static __inline int +static inline int fegetexcept(void) { fenv_t __r; |