diff options
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/bug-strtod.c | 6 | ||||
-rw-r--r-- | stdlib/bug-strtod2.c | 2 | ||||
-rw-r--r-- | stdlib/tst-strtod-round-skeleton.c | 24 | ||||
-rw-r--r-- | stdlib/tst-strtod.h | 7 | ||||
-rw-r--r-- | stdlib/tst-strtod6.c | 2 |
5 files changed, 19 insertions, 22 deletions
diff --git a/stdlib/bug-strtod.c b/stdlib/bug-strtod.c index c8b56aa..ac5193e 100644 --- a/stdlib/bug-strtod.c +++ b/stdlib/bug-strtod.c @@ -23,7 +23,7 @@ #include "tst-strtod.h" -#define TEST_STRTOD(FSUF, FTYPE, FTOSTR, FTOSTRM, LSUF, CSUF) \ +#define TEST_STRTOD(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \ static int \ test_strto ## FSUF (void) \ { \ @@ -45,8 +45,8 @@ test_strto ## FSUF (void) \ { \ char fstr[FSTRLENMAX]; \ char fcntstr[FSTRLENMAX]; \ - FTOSTR (fstr, sizeof (fstr), "%" FTOSTRM "g", f); \ - FTOSTR (fcntstr, sizeof (fstr), "%" FTOSTRM "g", (FTYPE) cnt); \ + FTOSTR (fstr, sizeof (fstr), "%g", f); \ + FTOSTR (fcntstr, sizeof (fstr), "%g", (FTYPE) cnt); \ printf ("strto" #FSUF "(\"%s\") " \ "failed for cnt == %d (%s instead of %s)\n", \ buf, cnt, fstr, fcntstr); \ diff --git a/stdlib/bug-strtod2.c b/stdlib/bug-strtod2.c index cd13e9a..6128f2d 100644 --- a/stdlib/bug-strtod2.c +++ b/stdlib/bug-strtod2.c @@ -12,7 +12,7 @@ static const char *tests[] = }; #define ntests (sizeof (tests) / sizeof (tests[0])) -#define TEST_STRTOD(FSUF, FTYPE, FTOSTR, FTOSTRM, LSUF, CSUF) \ +#define TEST_STRTOD(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \ static int \ test_strto ## FSUF (void) \ { \ diff --git a/stdlib/tst-strtod-round-skeleton.c b/stdlib/tst-strtod-round-skeleton.c index 1853c52..2e99dbd 100644 --- a/stdlib/tst-strtod-round-skeleton.c +++ b/stdlib/tst-strtod-round-skeleton.c @@ -58,11 +58,11 @@ /* Generator to create an FTYPE member variabled named FSUF used to populate struct member variables. */ -#define FTYPE_MEMBER(FSUF, FTYPE, FTOSTR, FTOSTRM, LSUF, CSUF) \ +#define FTYPE_MEMBER(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \ FTYPE FSUF; /* Likewise, but each member is of type bool. */ -#define BOOL_MEMBER(FSUF, FTYPE, FTOSTR, FTOSTRM, LSUF, CSUF) \ +#define BOOL_MEMBER(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \ bool FSUF; #define STRUCT_FOREACH_FLOAT_FTYPE GEN_TEST_STRTOD_FOREACH (FTYPE_MEMBER) @@ -96,13 +96,13 @@ /* long double is special, and handled above. */ /* Selector for expected result field of a given type. */ -#define _ENTRY(FSUF, FTYPE, FTOSTR, FTOSTRM, LSUF, CSUF, ...) \ +#define _ENTRY(FSUF, FTYPE, FTOSTR, LSUF, CSUF, ...) \ CONCAT (CHOOSE_ ## FSUF (__VA_ARGS__), LSUF), #define ENTRY(...) \ GEN_TEST_STRTOD_FOREACH (_ENTRY, __VA_ARGS__) /* Selector for boolean exact tag of expected results. */ -#define _XNTRY(FSUF, FTYPE, FTOSTR, FTOSTRM, LSUF, CSUF, ...) \ +#define _XNTRY(FSUF, FTYPE, FTOSTR, LSUF, CSUF, ...) \ CHOOSE_ ## FSUF (__VA_ARGS__), #define XNTRY(...) \ GEN_TEST_STRTOD_FOREACH (_XNTRY, __VA_ARGS__) @@ -157,21 +157,19 @@ struct test { #define STR(x) STRX (x) #define FNPFXS STR (FNPFX) -#define GEN_ONE_TEST(FSUF, FTYPE, FTOSTR, FTOSTRM, LSUF, CSUF) \ +#define GEN_ONE_TEST(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \ { \ FTYPE f = STRTO (FSUF) (s, NULL); \ if (f != expected->FSUF \ || (copysign ## CSUF) (1.0 ## LSUF, f) \ != (copysign ## CSUF) (1.0 ## LSUF, expected->FSUF)) \ { \ - CHAR efstr[FSTRLENMAX]; \ - CHAR fstr[FSTRLENMAX]; \ - FTOSTR (efstr, FSTRLENMAX, L_("%") L_(FTOSTRM) L_("a"), \ - expected->FSUF); \ - FTOSTR (fstr, FSTRLENMAX, L_("%") L_(FTOSTRM) L_("a"), f);\ - printf (FNPFXS "to" #FSUF " (" STRM ") returned " STRM \ - " not " STRM " (%s)\n", \ - s, fstr, efstr, mode_name); \ + char efstr[FSTRLENMAX]; \ + char fstr[FSTRLENMAX]; \ + FTOSTR (efstr, FSTRLENMAX, "%a", expected->FSUF); \ + FTOSTR (fstr, FSTRLENMAX, "%a", f); \ + printf (FNPFXS "to" #FSUF " (" STRM ") returned %s not " \ + "%s (%s)\n", s, fstr, efstr, mode_name); \ if (ROUNDING_TESTS (FTYPE, rnd_mode) || exact->FSUF) \ result = 1; \ else \ diff --git a/stdlib/tst-strtod.h b/stdlib/tst-strtod.h index 607cf39..b8e9cd4 100644 --- a/stdlib/tst-strtod.h +++ b/stdlib/tst-strtod.h @@ -23,14 +23,13 @@ /* Splat n variants of the same test for the various strtod functions. */ #define GEN_TEST_STRTOD_FOREACH(mfunc, ...) \ - mfunc ( f, float, snprintf, "", f, f, ##__VA_ARGS__) \ - mfunc ( d, double, snprintf, "", , , ##__VA_ARGS__) \ - mfunc ( ld, long double, snprintf, "L", L, l, ##__VA_ARGS__) + mfunc ( f, float, strfromf, f, f, ##__VA_ARGS__) \ + mfunc ( d, double, strfromd, , , ##__VA_ARGS__) \ + mfunc ( ld, long double, strfroml, L, l, ##__VA_ARGS__) /* The arguments to the generated macros are: FSUF - Function suffix FTYPE - float type FTOSTR - float to string func - FTOSTRM - Optional modifier for FTOSTR format LSUF - Literal suffix CSUF - C standardish suffix for many of the math functions */ diff --git a/stdlib/tst-strtod6.c b/stdlib/tst-strtod6.c index 6b3bb84..9bfbdc2 100644 --- a/stdlib/tst-strtod6.c +++ b/stdlib/tst-strtod6.c @@ -5,7 +5,7 @@ #include "tst-strtod.h" -#define TEST_STRTOD(FSUF, FTYPE, FTOSTR, FTOSTRM, LSUF, CSUF) \ +#define TEST_STRTOD(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \ static int \ test_strto ## FSUF (const char str[]) \ { \ |