Module Name:    src
Committed By:   riastradh
Date:           Mon Sep  9 15:06:29 UTC 2024

Modified Files:
        src/distrib/sets/lists/debug: mi
        src/distrib/sets/lists/tests: mi
        src/include: math.h
        src/tests/lib/libm: Makefile

Log Message:
math.h: Add math_errhandling, MATH_ERRNO, MATH_ERREXCEPT.

XXX Should maybe put a __math_errhandling in machine/math.h, but only
VAX uses MATH_ERRNO and that's not likely to change any time soon, so
this will serve for now with less churn.

PR standards/56234: missing C99 frobs in <math.h>


To generate a diff of this commit:
cvs rdiff -u -r1.447 -r1.448 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1336 -r1.1337 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.71 -r1.72 src/include/math.h
cvs rdiff -u -r1.49 -r1.50 src/tests/lib/libm/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.447 src/distrib/sets/lists/debug/mi:1.448
--- src/distrib/sets/lists/debug/mi:1.447	Mon Sep  2 05:17:45 2024
+++ src/distrib/sets/lists/debug/mi	Mon Sep  9 15:06:29 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.447 2024/09/02 05:17:45 ozaki-r Exp $
+# $NetBSD: mi,v 1.448 2024/09/09 15:06:29 riastradh Exp $
 #
 ./etc/mtree/set.debug                           comp-sys-root
 ./usr/lib					comp-sys-usr		compatdir
@@ -2321,6 +2321,7 @@
 ./usr/libdata/debug/usr/tests/lib/libm/t_cos.debug			tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_cosh.debug			tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_erf.debug			tests-lib-debug		debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libm/t_errhandling.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_exp.debug			tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_fe_round.debug			tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libm/t_fenv.debug			tests-lib-debug		debug,atf,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1336 src/distrib/sets/lists/tests/mi:1.1337
--- src/distrib/sets/lists/tests/mi:1.1336	Tue Sep  3 08:02:39 2024
+++ src/distrib/sets/lists/tests/mi	Mon Sep  9 15:06:29 2024
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1336 2024/09/03 08:02:39 ozaki-r Exp $
+# $NetBSD: mi,v 1.1337 2024/09/09 15:06:29 riastradh Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3965,6 +3965,7 @@
 ./usr/tests/lib/libm/t_cos				tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libm/t_cosh				tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libm/t_erf				tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libm/t_errhandling			tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libm/t_exp				tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libm/t_fe_round				tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libm/t_fenv				tests-lib-tests		compattestfile,atf

Index: src/include/math.h
diff -u src/include/math.h:1.71 src/include/math.h:1.72
--- src/include/math.h:1.71	Mon Sep  9 15:05:51 2024
+++ src/include/math.h	Mon Sep  9 15:06:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: math.h,v 1.71 2024/09/09 15:05:51 riastradh Exp $	*/
+/*	$NetBSD: math.h,v 1.72 2024/09/09 15:06:29 riastradh Exp $	*/
 
 /*
  * ====================================================
@@ -21,13 +21,6 @@
 #include <sys/cdefs.h>
 #include <sys/featuretest.h>
 
-/*
- * Missing for C99 support:
- * - MATH_ERRNO
- * - MATH_ERREXCEPT
- * - math_errhandling
- */
-
 union __float_u {
 	unsigned char __dummy[sizeof(float)];
 	float __val;
@@ -157,6 +150,15 @@ extern const union __float_u __nanf;
 #define	FP_ILOGB0	INT_MIN
 #define	FP_ILOGBNAN	INT_MAX
 
+/* 7.12#9 error handling (__math_errhandling from machine/math.h) */
+#define	MATH_ERRNO		1
+#define	MATH_ERREXCEPT		2
+#ifdef __vax__			/* XXX !__HAVE_FENV */
+#define	math_errhandling	MATH_ERRNO
+#else
+#define	math_errhandling	MATH_ERREXCEPT
+#endif
+
 #endif /* C99 || _XOPEN_SOURCE >= 600 */
 
 /*

Index: src/tests/lib/libm/Makefile
diff -u src/tests/lib/libm/Makefile:1.49 src/tests/lib/libm/Makefile:1.50
--- src/tests/lib/libm/Makefile:1.49	Sun May  5 02:53:02 2024
+++ src/tests/lib/libm/Makefile	Mon Sep  9 15:06:29 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.49 2024/05/05 02:53:02 riastradh Exp $
+# $NetBSD: Makefile,v 1.50 2024/09/09 15:06:29 riastradh Exp $
 
 .include <bsd.own.mk>
 
@@ -25,6 +25,7 @@ TESTS_C+=	t_ceil
 TESTS_C+=	t_cos
 TESTS_C+=	t_cosh
 TESTS_C+=	t_erf
+TESTS_C+=	t_errhandling
 TESTS_C+=	t_exp
 TESTS_C+=	t_fenv
 TESTS_C+=	t_fe_round

Reply via email to