This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH v2 1/6] Provide an additional macro expansion for F128 in stdlib/tst-strtod.h
- From: "Gabriel F. T. Gomes" <gftg at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Date: Wed, 21 Jun 2017 14:45:20 -0300
- Subject: [PATCH v2 1/6] Provide an additional macro expansion for F128 in stdlib/tst-strtod.h
- Authentication-results: sourceware.org; auth=none
- References: <1498067125-30472-1-git-send-email-gftg@linux.vnet.ibm.com>
New since v1.
-- 8< --
The macro F128 in stdlib/tst-strtod.h is defined to provide the literal
suffix for _Float128 constants. It uses the macro __f128 (), which is
defined in bits/floatn.h to provide the correct literal suffix depending on
what is provided by the compiler.
However, F128 was not being expanded and only worked correctly, when
compiling with GCC 7 (or greater), since F128 is the literal suffix itself.
This patch adds an additional macro expansion so that the macro F128
expands to the correct literal suffix on older compilers.
* stdlib/tst-strtod.h (MMFUNC): New macro to provide an addition
macro expansion.
(GEN_TEST_STRTOD_FOREACH): Use MMFUNC for _Float128.
---
stdlib/tst-strtod.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/stdlib/tst-strtod.h b/stdlib/tst-strtod.h
index e23ac3f..bc82ee0 100644
--- a/stdlib/tst-strtod.h
+++ b/stdlib/tst-strtod.h
@@ -33,12 +33,16 @@
# define IF_FLOAT128(x)
#endif
+/* Provide an extra parameter expansion for mfunc. */
+#define MMFUNC(mmfunc, ...) mmfunc (__VA_ARGS__)
+
/* Splat n variants of the same test for the various strtod functions. */
#define GEN_TEST_STRTOD_FOREACH(mfunc, ...) \
mfunc ( f, float, strfromf, f, f, ##__VA_ARGS__) \
mfunc ( d, double, strfromd, , , ##__VA_ARGS__) \
mfunc ( ld, long double, strfroml, L, l, ##__VA_ARGS__) \
- IF_FLOAT128 (mfunc (f128, _Float128, strfromf128, F128, f128, ##__VA_ARGS__))
+ IF_FLOAT128 (MMFUNC \
+ (mfunc, f128, _Float128, strfromf128, F128, f128, ##__VA_ARGS__))
/* The arguments to the generated macros are:
FSUF - Function suffix
FTYPE - float type
--
2.4.11