Module Name:    src
Committed By:   riastradh
Date:           Tue May 14 14:55:44 UTC 2024

Modified Files:
        src/tests/lib/libc/gen: t_fpsetmask.c
        src/tests/lib/libm: t_fenv.c

Log Message:
t_fpsetmask, t_fenv: Skip fp exception trap tests on RISC-V.

No architectural support for fp exception traps.

While here, make the macros behave a little better as C statements.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/lib/libc/gen/t_fpsetmask.c
cvs rdiff -u -r1.17 -r1.18 src/tests/lib/libm/t_fenv.c

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

Modified files:

Index: src/tests/lib/libc/gen/t_fpsetmask.c
diff -u src/tests/lib/libc/gen/t_fpsetmask.c:1.21 src/tests/lib/libc/gen/t_fpsetmask.c:1.22
--- src/tests/lib/libc/gen/t_fpsetmask.c:1.21	Sun Aug 23 11:04:58 2020
+++ src/tests/lib/libc/gen/t_fpsetmask.c	Tue May 14 14:55:43 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fpsetmask.c,v 1.21 2020/08/23 11:04:58 gson Exp $ */
+/*	$NetBSD: t_fpsetmask.c,v 1.22 2024/05/14 14:55:43 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -61,16 +61,25 @@ ATF_TC_BODY(no_test, tc)
 #if (__arm__ && !__SOFTFP__) || __aarch64__
 	/*
 	 * Some NEON fpus do not trap on IEEE 754 FP exceptions.
-	 * skip these tests if running on them and compiled for
+	 * Skip these tests if running on them and compiled for
 	 * hard float.
 	 */
-#define	FPU_PREREQ()							\
-	if (0 == fpsetmask(fpsetmask(FP_X_INV)))			\
-		atf_tc_skip("FPU does not implement traps on FP exceptions");
+#define	FPU_PREREQ() do							      \
+{									      \
+	if (0 == fpsetmask(fpsetmask(FP_X_INV)))			      \
+		atf_tc_skip("FPU does not implement traps on FP exceptions"); \
+} while (0)
+#endif
+
+#ifdef __riscv__
+#ifdef __riscv__
+#define	FPU_PREREQ()							      \
+	atf_tc_skip("RISC-V does not support floating-point exception traps")
+#endif
 #endif
 
 #ifndef FPU_PREREQ
-#define	FPU_PREREQ()	/* nothing */
+#define	FPU_PREREQ()	__nothing
 #endif
 
 void		sigfpe(int, siginfo_t *, void *);

Index: src/tests/lib/libm/t_fenv.c
diff -u src/tests/lib/libm/t_fenv.c:1.17 src/tests/lib/libm/t_fenv.c:1.18
--- src/tests/lib/libm/t_fenv.c:1.17	Sun May 12 21:53:26 2024
+++ src/tests/lib/libm/t_fenv.c	Tue May 14 14:55:44 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fenv.c,v 1.17 2024/05/12 21:53:26 riastradh Exp $ */
+/* $NetBSD: t_fenv.c,v 1.18 2024/05/14 14:55:44 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fenv.c,v 1.17 2024/05/12 21:53:26 riastradh Exp $");
+__RCSID("$NetBSD: t_fenv.c,v 1.18 2024/05/14 14:55:44 riastradh Exp $");
 
 #include <atf-c.h>
 
@@ -52,28 +52,37 @@ __RCSID("$NetBSD: t_fenv.c,v 1.17 2024/0
 
 #if (__arm__ && !__SOFTFP__) || __aarch64__
 	/*
-	 * Some NEON fpus  do not trap on IEEE 754 FP exceptions.
+	 * Some NEON fpus do not trap on IEEE 754 FP exceptions.
 	 * Skip these tests if running on them and compiled for
 	 * hard float.
 	 */
-#define	FPU_EXC_PREREQ()						\
-	if (0 == fpsetmask(fpsetmask(FP_X_INV)))			\
-		atf_tc_skip("FPU does not implement traps on FP exceptions");
+#define	FPU_EXC_PREREQ() do						      \
+{									      \
+	if (0 == fpsetmask(fpsetmask(FP_X_INV)))			      \
+		atf_tc_skip("FPU does not implement traps on FP exceptions"); \
+} while (0)
 
 	/*
 	 * Same as above: some don't allow configuring the rounding mode.
 	 */
-#define	FPU_RND_PREREQ()						\
-	if (0 == fpsetround(fpsetround(FP_RZ)))				\
-		atf_tc_skip("FPU does not implement configurable "	\
-		    "rounding modes");
+#define	FPU_RND_PREREQ() do						      \
+{									      \
+	if (0 == fpsetround(fpsetround(FP_RZ)))				      \
+		atf_tc_skip("FPU does not implement configurable "	      \
+		    "rounding modes");					      \
+} while (0)
+#endif
+
+#ifdef __riscv__
+#define	FPU_EXC_PREREQ()						      \
+	atf_tc_skip("RISC-V does not support floating-point exception traps")
 #endif
 
 #ifndef FPU_EXC_PREREQ
-#define	FPU_EXC_PREREQ()	/* nothing */
+#define	FPU_EXC_PREREQ()	__nothing
 #endif
 #ifndef FPU_RND_PREREQ
-#define	FPU_RND_PREREQ()	/* nothing */
+#define	FPU_RND_PREREQ()	__nothing
 #endif
 
 

Reply via email to