Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/stdlib Only do the long double tests if __HAV...



details:   https://anonhg.NetBSD.org/src/rev/8f99c3e363e4
branches:  trunk
changeset: 765751:8f99c3e363e4
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Jun 04 22:55:57 2011 +0000

description:
Only do the long double tests if __HAVE_LONG_DOUBLE is defined

diffstat:

 tests/lib/libc/stdlib/t_strtod.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (67 lines):

diff -r 7e60259932d7 -r 8f99c3e363e4 tests/lib/libc/stdlib/t_strtod.c
--- a/tests/lib/libc/stdlib/t_strtod.c  Sat Jun 04 22:49:49 2011 +0000
+++ b/tests/lib/libc/stdlib/t_strtod.c  Sat Jun 04 22:55:57 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_strtod.c,v 1.15 2011/06/04 11:12:28 jruoho Exp $ */
+/*     $NetBSD: t_strtod.c,v 1.16 2011/06/04 22:55:57 matt Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /* Public domain, Otto Moerbeek <otto%drijf.net@localhost>, 2006. */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_strtod.c,v 1.15 2011/06/04 11:12:28 jruoho Exp $");
+__RCSID("$NetBSD: t_strtod.c,v 1.16 2011/06/04 22:55:57 matt Exp $");
 
 #include <errno.h>
 #include <math.h>
@@ -111,11 +111,13 @@
 
 #ifndef __vax__
 
-       static const char *str[] =
+       static const char * const str[] =
            { "Inf", "INF", "-Inf", "-INF", "Infinity", "+Infinity",
              "INFINITY", "-INFINITY", "InFiNiTy", "+InFiNiTy" };
 
+#ifdef __HAVE_LONG_DOUBLE
        long double ld;
+#endif
        double d;
        float f;
        size_t i;
@@ -136,8 +138,10 @@
                f = strtof(str[i], NULL);
                ATF_REQUIRE(isinf(f) != 0);
 
+#ifdef __HAVE_LONG_DOUBLE
                ld = strtold(str[i], NULL);
                ATF_REQUIRE(isinf(ld) != 0);
+#endif
        }
 #endif
 }
@@ -153,7 +157,9 @@
 #ifndef __vax__
 
        const char *str = "NaN(x)y";
+#if __HAVE_LONG_DOUBLE
        long double ld;
+#endif
        char *end;
        double d;
        float f;
@@ -168,10 +174,12 @@
        ATF_REQUIRE(isnanf(f) != 0);
        ATF_REQUIRE(strcmp(end, "y") == 0);
 
+#ifdef __HAVE_LONG_DOUBLE
        ld = strtold(str, &end);
        ATF_REQUIRE(isnan(ld) != 0);
        ATF_REQUIRE(__isnanl(ld) != 0);
        ATF_REQUIRE(strcmp(end, "y") == 0);
+#endif
 
 #endif
 }



Home | Main Index | Thread Index | Old Index