Support using fenv instead of fpsetmask if HAVE_FENV is defined.

This commit is contained in:
matt 2014-01-26 21:04:46 +00:00
parent 0d162304ca
commit 2aecc71d04
1 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_siginfo.c,v 1.21 2014/01/25 10:09:47 skrll Exp $ */
/* $NetBSD: t_siginfo.c,v 1.22 2014/01/26 21:04:46 matt Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -45,7 +45,9 @@
#include <setjmp.h>
#include <float.h>
#ifdef _FLOAT_IEEE754
#ifdef HAVE_FENV
#include <fenv.h>
#elif defined(_FLOAT_IEEE754)
#include <ieeefp.h>
#endif
@ -314,7 +316,9 @@ ATF_TC_BODY(sigfpe_flt, tc)
sa.sa_sigaction = sigfpe_flt_action;
sigemptyset(&sa.sa_mask);
sigaction(SIGFPE, &sa, NULL);
#ifdef _FLOAT_IEEE754
#ifdef HAVE_FENV
feenableexcept(FE_ALL_EXCEPT);
#elif defined(_FLOAT_IEEE754)
fpsetmask(FP_X_INV|FP_X_DZ|FP_X_OFL|FP_X_UFL|FP_X_IMP);
#endif
printf("%g\n", 1 / d);
@ -362,7 +366,9 @@ ATF_TC_BODY(sigfpe_int, tc)
sa.sa_sigaction = sigfpe_int_action;
sigemptyset(&sa.sa_mask);
sigaction(SIGFPE, &sa, NULL);
#ifdef _FLOAT_IEEE754
#ifdef HAVE_FENV
feenableexcept(FE_ALL_EXCEPT);
#elif defined(_FLOAT_IEEE754)
fpsetmask(FP_X_INV|FP_X_DZ|FP_X_OFL|FP_X_UFL|FP_X_IMP);
#endif
printf("%ld\n", 1 / l);