summaryrefslogtreecommitdiffstats
path: root/lib/msun/ia64
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2011-10-10 15:43:09 +0000
committerdas <das@FreeBSD.org>2011-10-10 15:43:09 +0000
commita38603b0b57960e07b576fdc7c8ed64d919770d0 (patch)
treea50d2b89f2f16772503039f06c8507b9292a1daa /lib/msun/ia64
parent768c3db25c16c726fe7df21f139f54cd6342dfbf (diff)
downloadFreeBSD-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/ia64')
-rw-r--r--lib/msun/ia64/Symbol.map7
-rw-r--r--lib/msun/ia64/fenv.c17
-rw-r--r--lib/msun/ia64/fenv.h32
3 files changed, 43 insertions, 13 deletions
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;
OpenPOWER on IntegriCloud