Module Name:    src
Committed By:   riastradh
Date:           Sun Nov  5 16:28:05 UTC 2023

Modified Files:
        src/tests/lib/libm: t_fenv.c

Log Message:
t_fenv: Add #pragma STDC FENV_ACCESS ON and verify FLT_RADIX is 2.

Except gcc doesn't implement this pragma, so make it conditional.

And clang only supports it on some architectures, so just leave it
out for now with a comment about why.

PR port-mips/57680

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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/libm/t_fenv.c
diff -u src/tests/lib/libm/t_fenv.c:1.9 src/tests/lib/libm/t_fenv.c:1.10
--- src/tests/lib/libm/t_fenv.c:1.9	Sun Nov  5 16:06:27 2023
+++ src/tests/lib/libm/t_fenv.c	Sun Nov  5 16:28:05 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fenv.c,v 1.9 2023/11/05 16:06:27 riastradh Exp $ */
+/* $NetBSD: t_fenv.c,v 1.10 2023/11/05 16:28:05 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,17 +29,26 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fenv.c,v 1.9 2023/11/05 16:06:27 riastradh Exp $");
+__RCSID("$NetBSD: t_fenv.c,v 1.10 2023/11/05 16:28:05 riastradh Exp $");
 
 #include <atf-c.h>
 
 #include <fenv.h>
 #ifdef __HAVE_FENV
 
+/* XXXGCC gcc lacks #pragma STDC FENV_ACCESS */
+/* XXXCLANG clang lacks #pragma STDC FENV_ACCESS on some ports */
+#if !defined(__GNUC__)
+#pragma STDC FENV_ACCESS ON
+#endif
+
 #include <float.h>
 #include <ieeefp.h>
 #include <stdlib.h>
 
+#if FLT_RADIX != 2
+#error This test assumes binary floating-point arithmetic.
+#endif
 
 #if (__arm__ && !__SOFTFP__) || __aarch64__
 	/*

Reply via email to