summaryrefslogtreecommitdiff
path: root/stdlib/tst-strtod-nan-locale-main.c
diff options
context:
space:
mode:
authorPaul E. Murphy <murphyp@linux.vnet.ibm.com>2016-07-25 13:10:00 -0500
committerGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>2017-06-12 14:48:53 -0300
commit45f39d458827e07ab3075bed75f2670581a89f33 (patch)
treeac092e2911ec5b2fabfd650b51ee4d939ef7e882 /stdlib/tst-strtod-nan-locale-main.c
parent9527ae8291dbc6097f4f93c4ccce69b577f8a261 (diff)
float128: Add strtof128, wcstof128, and related functions.
The implementations are contained with sysdeps/ieee754/float128 as they are only built when _Float128 is enabled within libc/m. * include/gmp.h (__mpn_construct_float128): New declaration. * include/stdlib.h: Include bits/floatn.h for _Float128 tests. (__strtof128_l): New declaration. (__strtof128_nan): Likewise. (__wcstof128_nan): Likewise. (__strtof128_internal): Likewise. (____strtof128_l_internal): Likewise. * include/wchar.h: Include bits/floatn.h for _Float128 tests. (__wcstof128_l): New declaration. (__wcstof128_internal): Likewise. * stdlib/Makefile (bug-strtod2): Link libm too. * stdlib/stdlib.h (strtof128): New declaration. (strtof128_l): Likewise. * stdlib/tst-strtod-nan-locale-main.c: Updated to use tst-strtod.h macros to ensure float128 gets tested too. * stdlib/tst-strtod-round-skeleton.c (CHOOSE_f128): New macro. * stdlib/tst-strtod.h: Include bits/floatn.h for _Float128 tests. (IF_FLOAT128): New macro. (GEN_TEST_STRTOD): Update to optionally include _Float128 in the tests. (STRTOD_TEST_FOREACH): Likewise. * sysdeps/ieee754/float128/Makefile: Insert new strtof128 and wcstof128 functions into libc. * sysdeps/ieee754/float128/Versions: Add exports for the above new functions. * sysdeps/ieee754/float128/mpn2float128.c: New file. * sysdeps/ieee754/float128/strtod_nan_float128.h: New file. * sysdeps/ieee754/float128/strtof128.c: New file. * sysdeps/ieee754/float128/strtof128_l.c: New file. * sysdeps/ieee754/float128/strtof128_nan.c: New file. * sysdeps/ieee754/float128/wcstof128.c: New file. * sysdeps/ieee754/float128/wcstof128_l.c: New file. * sysdeps/ieee754/float128/wcstof128_nan.c: New fike. * wcsmbs/Makefile: (CFLAGS-wcstof128.c): Append strtox-CFLAGS. (CFLAGS-wcstof128_l): Likewise. * wcsmbs/wchar.h: Include bits/floatn.h for _Float128 tests. (wcstof128): New declaration. (wcstof128_l): Likewise.
Diffstat (limited to 'stdlib/tst-strtod-nan-locale-main.c')
-rw-r--r--stdlib/tst-strtod-nan-locale-main.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/stdlib/tst-strtod-nan-locale-main.c b/stdlib/tst-strtod-nan-locale-main.c
index 8044dad89f..8222174a59 100644
--- a/stdlib/tst-strtod-nan-locale-main.c
+++ b/stdlib/tst-strtod-nan-locale-main.c
@@ -23,6 +23,8 @@
#include <stdlib.h>
#include <wchar.h>
+#include <stdlib/tst-strtod.h>
+
#define STR_(X) #X
#define STR(X) STR_(X)
#define FNPFXS STR (FNPFX)
@@ -30,20 +32,22 @@
#define CONCAT(X, Y) CONCAT_ (X, Y)
#define FNX(FN) CONCAT (FNPFX, FN)
-#define TEST(LOC, STR, FN, TYPE) \
- do \
+#define TEST_STRTOD(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \
+static int \
+test_strto ## FSUF (const char * loc, CHAR * s) \
+{ \
+ CHAR *ep; \
+ FTYPE val = FNX (FSUF) (s, &ep); \
+ if (isnan (val) && *ep == 0) \
+ printf ("PASS: %s: " FNPFXS #FSUF " (" SFMT ")\n", loc, s); \
+ else \
{ \
- CHAR *ep; \
- TYPE val = FNX (FN) (STR, &ep); \
- if (isnan (val) && *ep == 0) \
- printf ("PASS: %s: " FNPFXS #FN " (" SFMT ")\n", LOC, STR); \
- else \
- { \
- printf ("FAIL: %s: " FNPFXS #FN " (" SFMT ")\n", LOC, STR); \
- result = 1; \
- } \
+ printf ("FAIL: %s: " FNPFXS #FSUF " (" SFMT ")\n", loc, s); \
+ return 1; \
} \
- while (0)
+ return 0; \
+}
+GEN_TEST_STRTOD_FOREACH (TEST_STRTOD)
static int
test_one_locale (const char *loc)
@@ -64,13 +68,9 @@ test_one_locale (const char *loc)
s[4] = L_('A') + i - 10;
s[5] = L_(')');
s[6] = 0;
- TEST (loc, s, f, float);
- TEST (loc, s, d, double);
- TEST (loc, s, ld, long double);
+ result |= STRTOD_TEST_FOREACH (test_strto, loc, s);
s[4] = L_('a') + i - 10;
- TEST (loc, s, f, float);
- TEST (loc, s, d, double);
- TEST (loc, s, ld, long double);
+ result |= STRTOD_TEST_FOREACH (test_strto, loc, s);
}
return result;
}