From fb1ca2aa3e58cad474c918f34e5e5eed70f5d94a Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 6 Dec 2017 23:06:12 +0000 Subject: Support defining strtof32, wcstof32 aliases. This patch adds support for defining strtof32, wcstof32, strtof32_l and wcstof32_l functions as aliases of the corresponding float functions when _Float32 support is enabled. Tested for x86_64; also tested with build-many-glibcs.py in conjunction with other _Float32 changes. * stdlib/strtof.c: Include [__HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32] (strtof32): Define and later undefine as macro. Define as weak alias if [!USE_WIDE_CHAR]. [__HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32] (wcstof32): Define and later undefine as macro. Define as weak alias if [USE_WIDE_CHAR]. * stdlib/strtof_l.c: Include [__HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32] (strtof32_l): Define and later undefine as macro. Define as weak alias if [!USE_WIDE_CHAR]. [__HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32] (wcstof32_l): Define and later undefine as macro. Define as weak alias if [USE_WIDE_CHAR]. --- stdlib/strtof.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'stdlib/strtof.c') diff --git a/stdlib/strtof.c b/stdlib/strtof.c index 6005121..7f47362 100644 --- a/stdlib/strtof.c +++ b/stdlib/strtof.c @@ -20,6 +20,13 @@ /* The actual implementation for all floating point sizes is in strtod.c. These macros tell it to produce the `float' version, `strtof'. */ +#include + +#if __HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32 +# define strtof32 __hide_strtof32 +# define wcstof32 __hide_wcstof32 +#endif + #define FLOAT float #define FLT FLT #ifdef USE_WIDE_CHAR @@ -32,3 +39,13 @@ #include "strtod.c" + +#if __HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32 +# undef strtof32 +# undef wcstof32 +# ifdef USE_WIDE_CHAR +weak_alias (wcstof, wcstof32) +# else +weak_alias (strtof, strtof32) +# endif +#endif -- cgit v1.1