Module Name:src
Committed By: christos
Date: Sun Jan 2 21:17:19 UTC 2011
Modified Files:
src/tests/lib/libc/ieeefp: Makefile t_except.c
Log Message:
avoid cloberring warning.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/ieeefp/Makefile
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/ieeefp/t_except.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/ieeefp/Makefile
diff -u src/tests/lib/libc/ieeefp/Makefile:1.2 src/tests/lib/libc/ieeefp/Makefile:1.3
--- src/tests/lib/libc/ieeefp/Makefile:1.2 Sun Jan 2 08:49:15 2011
+++ src/tests/lib/libc/ieeefp/Makefile Sun Jan 2 16:17:19 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2011/01/02 13:49:15 martin Exp $
+# $NetBSD: Makefile,v 1.3 2011/01/02 21:17:19 christos Exp $
.include bsd.own.mk
@@ -10,7 +10,5 @@
TESTS_C+= t_subnormal
LDADD.t_subnormal+=-lm
-WARNS=1
.include bsd.test.mk
-
Index: src/tests/lib/libc/ieeefp/t_except.c
diff -u src/tests/lib/libc/ieeefp/t_except.c:1.1 src/tests/lib/libc/ieeefp/t_except.c:1.2
--- src/tests/lib/libc/ieeefp/t_except.c:1.1 Sat Jan 1 22:51:21 2011
+++ src/tests/lib/libc/ieeefp/t_except.c Sun Jan 2 16:17:19 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_except.c,v 1.1 2011/01/02 03:51:21 pgoyette Exp $ */
+/* $NetBSD: t_except.c,v 1.2 2011/01/02 21:17:19 christos Exp $ */
/*-
* Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -163,7 +163,7 @@
int sicode;
};
-static struct ops float_ops[] = {
+static const volatile struct ops float_ops[] = {
{ f_dz, FP_X_DZ, FPE_FLTDIV },
{ f_inv, FP_X_INV, FPE_FLTINV },
{ f_ofl, FP_X_OFL, FPE_FLTOVF },
@@ -171,7 +171,7 @@
{ NULL, 0, 0 }
};
-static struct ops double_ops[] = {
+static const volatile struct ops double_ops[] = {
{ d_dz, FP_X_DZ, FPE_FLTDIV },
{ d_inv, FP_X_INV, FPE_FLTINV },
{ d_ofl, FP_X_OFL, FPE_FLTOVF },
@@ -179,7 +179,7 @@
{ NULL, 0, 0 }
};
-static struct ops long_double_ops[] = {
+static const volatile struct ops long_double_ops[] = {
{ ld_dz, FP_X_DZ, FPE_FLTDIV },
{ ld_inv, FP_X_INV, FPE_FLTINV },
{ ld_ofl, FP_X_OFL, FPE_FLTOVF },
@@ -190,10 +190,11 @@
static sigjmp_buf b;
static void
-masked(struct ops *test_ops)
+masked(const volatile struct ops *test_ops)
{
struct sigaction sa;
fp_except ex1, ex2;
+ static const volatile struct ops *t;
/* mask all exceptions, clear history */
fpsetmask(0);
@@ -209,17 +210,16 @@
/*
* exceptions masked, check whether sticky bits are set correctly
*/
- while (test_ops-op != NULL) {
- (*test_ops-op)();
+ for (t = test_ops; t-op != NULL; t++) {
+ (*t-op)();
ex1 = fpgetsticky();
- ATF_CHECK_EQ(ex1 test_ops-mask, test_ops-mask);
+ ATF_CHECK_EQ(ex1 t-mask, t-mask);
ATF_CHECK_EQ(signal_caught, 0);
/* check correct fpsetsticky() behaviour */
ex2 = fpsetsticky(0);
ATF_CHECK_EQ(fpgetsticky(), 0);
ATF_CHECK_EQ(ex1, ex2);
- test_ops++;
}
}
@@ -227,10 +227,11 @@
#define BARRIER() fpsetmask(0); f_x = f_one * f_one
static void
-unmasked(struct ops *test_ops)
+unmasked(const volatile struct ops *test_ops)
{
struct sigaction sa;
int r;
+ static const volatile struct ops *t;
/* mask all exceptions, clear history */
fpsetmask(0);
@@ -246,17 +247,16 @@
/*
* exception unmasked, check SIGFPE delivery and correct siginfo
*/
- while (test_ops-op != NULL) {
- fpsetmask(test_ops-mask);
+ for (t = test_ops; t-op != NULL; t++) {
+ fpsetmask(t-mask);
r = sigsetjmp(b, 1);
if (!r) {
- (*test_ops-op)();
+ (*t-op)();
BARRIER();
}
ATF_CHECK_EQ(signal_caught, 1);
- ATF_CHECK_EQ(sicode, test_ops-sicode);
+ ATF_CHECK_EQ(sicode, t-sicode);
signal_caught = 0;
- test_ops++;
}
}