git: 87d65c747a43 - main - lib/msun: Allow building tests with WARNS=6

Alex Richardson arichardson at FreeBSD.org
Mon Mar 22 12:00:29 UTC 2021


The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=87d65c747a4389901c2bbbcb1ec4878b2df7b32c

commit 87d65c747a4389901c2bbbcb1ec4878b2df7b32c
Author:     Alex Richardson <arichardson at FreeBSD.org>
AuthorDate: 2021-02-25 14:28:17 +0000
Commit:     Alex Richardson <arichardson at FreeBSD.org>
CommitDate: 2021-03-22 11:55:07 +0000

    lib/msun: Allow building tests with WARNS=6
    
    The only change needed is to mark a few variables as static.
---
 contrib/netbsd-tests/lib/libm/t_ldexp.c     | 19 +++++++++----------
 contrib/netbsd-tests/lib/libm/t_precision.c |  4 ++--
 contrib/netbsd-tests/lib/libm/t_round.c     |  2 +-
 contrib/netbsd-tests/lib/libm/t_scalbn.c    |  2 +-
 lib/msun/tests/Makefile                     |  2 +-
 5 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/contrib/netbsd-tests/lib/libm/t_ldexp.c b/contrib/netbsd-tests/lib/libm/t_ldexp.c
index 977b2219873b..40c69206e741 100644
--- a/contrib/netbsd-tests/lib/libm/t_ldexp.c
+++ b/contrib/netbsd-tests/lib/libm/t_ldexp.c
@@ -53,7 +53,7 @@ struct ldexp_test {
 	const char *result;
 };
 
-struct ldexp_test ldexp_basic[] = {
+static struct ldexp_test ldexp_basic[] = {
 	{ 1.0,	5,	SKIP,	"                     32" },
 	{ 1.0,	1022,	SKIP,	"4.4942328371557897693233e+307" },
 	{ 1.0,	1023,	-1,	"4.4942328371557897693233e+307" },
@@ -71,7 +71,7 @@ struct ldexp_test ldexp_basic[] = {
 	{ 0,	0,	0,	NULL }
 };
 
-struct ldexp_test ldexp_zero[] = {
+static struct ldexp_test ldexp_zero[] = {
 	{ 0.0,	-1,	SKIP,	"                      0" },
 	{ 0.0,	0,	SKIP,	"                      0" },
 	{ 0.0,	1,	SKIP,	"                      0" },
@@ -82,7 +82,7 @@ struct ldexp_test ldexp_zero[] = {
 	{ 0,	0,	0,	NULL }
 };
 
-struct ldexp_test ldexp_infinity[] = {
+static struct ldexp_test ldexp_infinity[] = {
 	{ 1.0,	1024,	-1,	"                    inf" },
 	{ 1.0,	1024,	0,	"                    inf" },
 	{ 1.0,	1024,	1,	"                    inf" },
@@ -92,7 +92,7 @@ struct ldexp_test ldexp_infinity[] = {
 	{ 0,	0,	0,	NULL }
 };
 
-struct ldexp_test ldexp_overflow[] = {
+static struct ldexp_test ldexp_overflow[] = {
 	{ 1.0,	1024,	SKIP,	"                    inf" },
 	{ 1.0,	1023,	1,	"                    inf" },
 	{ 1.0,	-1022,	2046,	"                    inf" },
@@ -106,7 +106,7 @@ struct ldexp_test ldexp_overflow[] = {
 	{ 0,	0,	0,	NULL }
 };
 
-struct ldexp_test ldexp_denormal[] = {
+static struct ldexp_test ldexp_denormal[] = {
 	{ 1.0,	-1023,	SKIP,	"1.1125369292536006915451e-308" },
 	{ 1.0,	-1022,	-1,	"1.1125369292536006915451e-308" },
 	{ 1.0,	1023,	-2046,	"1.1125369292536006915451e-308" },
@@ -120,7 +120,7 @@ struct ldexp_test ldexp_denormal[] = {
 	{ 0,	0,	0,	NULL }
 };
 
-struct ldexp_test ldexp_underflow[] = {
+static struct ldexp_test ldexp_underflow[] = {
 	{ 1.0,	-1075,	SKIP,	"                      0" },
 	{ 1.0,	-1074,	-1,	"                      0" },
 	{ 1.0,	1023,	-2098,	"                      0" },
@@ -132,7 +132,7 @@ struct ldexp_test ldexp_underflow[] = {
 	{ 0,	0,	0,	NULL }
 };
 
-struct ldexp_test ldexp_denormal_large[] = {
+static struct ldexp_test ldexp_denormal_large[] = {
 	{ 1.0,	-1028,	1024,	"                 0.0625" },
 	{ 1.0,	-1028,	1025,	"                  0.125" },
 	{ 1.0,	-1028,	1026,	"                   0.25" },
@@ -177,10 +177,9 @@ run_test(struct ldexp_test *table)
 			v = ldexp(v, table->exp2);
 
 		(void)snprintf(outbuf, sizeof(outbuf), FORMAT, v);
-
 		ATF_CHECK_STREQ_MSG(table->result, outbuf,
-			    "Entry %zu:\n\tExp: \"%s\"\n\tAct: \"%s\"",
-			    i, table->result, outbuf);
+			    "Entry %zu:\n\tExp: \"%s\"\n\tAct: \"%s\"/%a",
+			    i, table->result, outbuf, v);
 	}
 }
 
diff --git a/contrib/netbsd-tests/lib/libm/t_precision.c b/contrib/netbsd-tests/lib/libm/t_precision.c
index eb8e29546eb6..b953845c21f4 100644
--- a/contrib/netbsd-tests/lib/libm/t_precision.c
+++ b/contrib/netbsd-tests/lib/libm/t_precision.c
@@ -44,9 +44,9 @@ ATF_TC_HEAD(t_precision, tc)
 	    "Basic precision test for double and long double");
 }
 
-volatile double x = 1;
+static volatile double x = 1;
 #if __HAVE_LONG_DOUBLE
-volatile long double y = 1;
+static volatile long double y = 1;
 #endif
 
 ATF_TC_BODY(t_precision, tc)
diff --git a/contrib/netbsd-tests/lib/libm/t_round.c b/contrib/netbsd-tests/lib/libm/t_round.c
index 7d32586f1aa5..bafc894943ce 100644
--- a/contrib/netbsd-tests/lib/libm/t_round.c
+++ b/contrib/netbsd-tests/lib/libm/t_round.c
@@ -117,7 +117,7 @@ ATF_TC_HEAD(rounding_alpha_simple, tc)
 }
 
 
-double rounding_alpha_simple_even = 9223372036854775808.000000; /* 2^63 */
+static double rounding_alpha_simple_even = 9223372036854775808.000000; /* 2^63 */
 
 ATF_TC_BODY(rounding_alpha_simple, tc)
 {
diff --git a/contrib/netbsd-tests/lib/libm/t_scalbn.c b/contrib/netbsd-tests/lib/libm/t_scalbn.c
index f6adaaa993ec..dce07aac3c78 100644
--- a/contrib/netbsd-tests/lib/libm/t_scalbn.c
+++ b/contrib/netbsd-tests/lib/libm/t_scalbn.c
@@ -49,7 +49,7 @@ struct testcase {
 	int error;
 	int except;
 };
-struct testcase test_vals[] = {
+static struct testcase test_vals[] = {
 	{ 0,		1.00085,	1.00085,	0, 0 },
 	{ 0,		0.99755,	0.99755,	0, 0 },
 	{ 0,		-1.00085,	-1.00085,	0, 0 },
diff --git a/lib/msun/tests/Makefile b/lib/msun/tests/Makefile
index 309f49c6dddd..4ef25c0a909a 100644
--- a/lib/msun/tests/Makefile
+++ b/lib/msun/tests/Makefile
@@ -88,7 +88,7 @@ SRCS.ilogb2_test=	ilogb_test.c
 
 LIBADD+=	m
 
-WARNS?=		1
+WARNS?=		6
 
 # Copied from lib/msun/Makefile
 .if ${MACHINE_CPUARCH} == "i386"


More information about the dev-commits-src-main mailing list