fenv.h: stop declaring feclearexcept() extern inline

The function is already exported from libm.  We only need to stop
declare it extern inline, and instead provide a macro which uses the
internal inline function __feclearexcept_int() instead.

PR:	277958
Reviewed by:	dim (x86)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D55975
This commit is contained in:
Konstantin Belousov
2026-03-19 19:19:09 +02:00
parent 7e7d4e711f
commit f39754d51b
11 changed files with 58 additions and 13 deletions
+6 -1
View File
@@ -38,7 +38,12 @@ const fenv_t __fe_dfl_env = 0;
#error "This file must be compiled with C99 'inline' semantics"
#endif
extern inline int feclearexcept(int __excepts);
int
(feclearexcept)(int excepts)
{
return (__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);
+5 -2
View File
@@ -81,8 +81,11 @@ extern const fenv_t __fe_dfl_env;
#define __mrs_fpsr(__r) __asm __volatile("mrs %0, fpsr" : "=r" (__r))
#define __msr_fpsr(__r) __asm __volatile("msr fpsr, %0" : : "r" (__r))
__fenv_static __inline int
feclearexcept(int __excepts)
int feclearexcept(int);
#define feclearexcept(a) __feclearexcept_int(a)
__fenv_static inline int
__feclearexcept_int(int __excepts)
{
fexcept_t __r;
+6 -1
View File
@@ -46,7 +46,12 @@ const fenv_t __fe_dfl_env = {
__INITIAL_MXCSR__
};
extern inline int feclearexcept(int __excepts);
int
(feclearexcept)(int excepts)
{
return (__feclearexcept_int(excepts));
}
extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts);
int
+6 -1
View File
@@ -70,7 +70,12 @@ const fenv_t __fe_dfl_env = 0;
#error "This file must be compiled with C99 'inline' semantics"
#endif
extern inline int feclearexcept(int __excepts);
int
(feclearexcept)(int excepts)
{
return (__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);
+4 -1
View File
@@ -111,8 +111,11 @@ int fegetexcept(void);
#define _FPU_MASK_SHIFT 8
int feclearexcept(int);
#define feclearexcept(a) __feclearexcept_int(a)
__fenv_static inline int
feclearexcept(int __excepts)
__feclearexcept_int(int __excepts)
{
fexcept_t __fpsr;
+6 -1
View File
@@ -88,7 +88,12 @@ __test_sse(void)
return (0);
}
extern inline int feclearexcept(int __excepts);
int
(feclearexcept)(int excepts)
{
return (__feclearexcept_int(excepts));
}
extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts);
int
+6 -1
View File
@@ -35,7 +35,12 @@
const fenv_t __fe_dfl_env = 0x00000000;
extern inline int feclearexcept(int __excepts);
int
(feclearexcept)(int excepts)
{
return (__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);
+4 -1
View File
@@ -111,8 +111,11 @@ union __fpscr {
} __bits;
};
int feclearexcept(int);
#define feclearexcept(a) __feclearexcept_int(a)
__fenv_static inline int
feclearexcept(int __excepts)
__feclearexcept_int(int __excepts)
{
union __fpscr __r;
+6 -1
View File
@@ -37,7 +37,12 @@
*/
const fenv_t __fe_dfl_env = 0;
extern inline int feclearexcept(int __excepts);
int
(feclearexcept)(int excepts)
{
return (__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);
+4 -1
View File
@@ -79,8 +79,11 @@ extern const fenv_t __fe_dfl_env;
#define __rfs(__fcsr) __asm __volatile("csrr %0, fcsr" : "=r" (__fcsr))
#define __wfs(__fcsr) __asm __volatile("csrw fcsr, %0" :: "r" (__fcsr))
int feclearexcept(int);
#define feclearexcept(a) __feclearexcept_int(a)
__fenv_static inline int
feclearexcept(int __excepts)
__feclearexcept_int(int __excepts)
{
__asm __volatile("csrc fflags, %0" :: "r"(__excepts));
+5 -2
View File
@@ -143,6 +143,9 @@ fegetexcept(void)
#endif /* __BSD_VISIBLE */
int feclearexcept(int);
#define feclearexcept(a) __feclearexcept_int(a)
#ifdef __i386__
/* After testing for SSE support once, we cache the result in __has_sse. */
@@ -164,7 +167,7 @@ int __test_sse(void);
} while (0)
__fenv_static inline int
feclearexcept(int __excepts)
__feclearexcept_int(int __excepts)
{
fenv_t __env;
__uint32_t __mxcsr;
@@ -262,7 +265,7 @@ fesetenv(const fenv_t *__envp)
#else /* __amd64__ */
__fenv_static inline int
feclearexcept(int __excepts)
__feclearexcept_int(int __excepts)
{
fenv_t __env;