Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/gen Support using fenv instead of fpsetmask i...
details: https://anonhg.NetBSD.org/src/rev/584500c338c6
branches: trunk
changeset: 326355:584500c338c6
user: matt <matt%NetBSD.org@localhost>
date: Sun Jan 26 21:04:46 2014 +0000
description:
Support using fenv instead of fpsetmask if HAVE_FENV is defined.
diffstat:
tests/lib/libc/gen/t_siginfo.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diffs (42 lines):
diff -r f3256463cf50 -r 584500c338c6 tests/lib/libc/gen/t_siginfo.c
--- a/tests/lib/libc/gen/t_siginfo.c Sun Jan 26 20:42:06 2014 +0000
+++ b/tests/lib/libc/gen/t_siginfo.c Sun Jan 26 21:04:46 2014 +0000
@@ -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 @@
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 @@
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);
Home |
Main Index |
Thread Index |
Old Index