This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH 2/3] libc/include/sys/fenv.h: Add glibc extension of FE_NOMASK_ENV.
________________________________________
> From: newlib-owner@sourceware.org <newlib-owner@sourceware.org> on behalf of joel@rtems.org <joel@rtems.org>
> Sent: Wednesday, August 28, 2019 11:06 AM
> To: newlib@sourceware.org
> Cc: Joel Sherrill
> Subject: [PATCH 2/3] libc/include/sys/fenv.h: Add glibc extension of FE_NOMASK_ENV.
>
> From: Joel Sherrill <joel@rtems.org>
>
> ---
> newlib/libc/include/sys/fenv.h | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/newlib/libc/include/sys/fenv.h b/newlib/libc/include/sys/fenv.h
> index e0983fa..d2c1302 100644
> --- a/newlib/libc/include/sys/fenv.h
> +++ b/newlib/libc/include/sys/fenv.h
> @@ -110,4 +110,13 @@ typedef int fexcept_t;
> extern const fenv_t *_fe_dfl_env;
> #define FE_DFL_ENV _fe_dfl_env
>
> +#if __GNU_VISIBLE
> +/* If possible, the GNU C Library defines a macro FE_NOMASK_ENV which
> + represents an environment where every exception raised causes a trap
> + to occur. You can test for this macro using #ifdef. It is only defined
> + if _GNU_SOURCE is defined. */
> +extern const fenv_t *_fe_nomask_env;
> +#define FE_NOMASK_ENV (_fe_nomask_env)
> +#endif /* __GNU_VISIBLE */
> +
> #endif /* _SYS_FENV_H_ */
> --
> 1.8.3.1
--------------------------------------------------------------------------------
It says define it when possible. But this is unconditional in terms of
whether an implementation can do so or not. (It is conditional on the
__GNU_VISIBLE option, but that's a compilation choice for GNU_SOURCE.)
There needs to be a way to know if traps are possible are not. This
seems more appropriate to be undefined by default, as many embedded
applications don't even have the concept of traps.
Craig