1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Support defining strtof64, strtof32x, wcstof64, wcstof32x aliases.

This patch adds support for defining strtof64, strtof32x, wcstof64,
wcstof32x and the corresponding _l functions as aliases of the
corresponding double functions when _Float64 and _Float32x support is
enabled.

Tested for x86_64; also tested with build-many-glibcs.py in
conjunction with other _Float64 / _Float32x changes.

	* stdlib/strtod.c: Include <bits/floatn.h>.
	(BUILD_DOUBLE): New macro.
	[BUILD_DOUBLE && __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64]
	(strtof64): Define and later undefine as macro.  Define as weak
	alias if [!USE_WIDE_CHAR].
	[BUILD_DOUBLE && __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64]
	(wcstof64): Define and later undefine as macro.  Define as weak
	alias if [USE_WIDE_CHAR].
	[BUILD_DOUBLE && __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X]
	(strtof32x): Define and later undefine as macro.  Define as weak
	alias if [!USE_WIDE_CHAR].
	[BUILD_DOUBLE && __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X]
	(wcstof32x): Define and later undefine as macro.  Define as weak
	alias if [USE_WIDE_CHAR].
	* stdlib/strtod_l.c: Include <bits/floatn.h>.
	(BUILD_DOUBLE): New macro.
	[BUILD_DOUBLE && __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64]
	(strtof64_l): Define and later undefine as macro.  Define as weak
	alias if [!USE_WIDE_CHAR].
	[BUILD_DOUBLE && __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64]
	(wcstof64_l): Define and later undefine as macro.  Define as weak
	alias if [USE_WIDE_CHAR].
	[BUILD_DOUBLE && __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X]
	(strtof32x_l): Define and later undefine as macro.  Define as weak
	alias if [!USE_WIDE_CHAR].
	[BUILD_DOUBLE && __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X]
	(wcstof32x_l): Define and later undefine as macro.  Define as weak
	alias if [USE_WIDE_CHAR].
This commit is contained in:
Joseph Myers
2017-12-05 18:31:53 +00:00
parent 94d80dfc73
commit a5a2a76bb7
3 changed files with 111 additions and 0 deletions

View File

@ -17,6 +17,25 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <bits/floatn.h>
#ifdef FLOAT
# define BUILD_DOUBLE 0
#else
# define BUILD_DOUBLE 1
#endif
#if BUILD_DOUBLE
# if __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64
# define strtof64_l __hide_strtof64_l
# define wcstof64_l __hide_wcstof64_l
# endif
# if __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X
# define strtof32x_l __hide_strtof32x_l
# define wcstof32x_l __hide_wcstof32x_l
# endif
#endif
#include <locale.h>
extern double ____strtod_l_internal (const char *, char **, int, locale_t);
@ -1784,3 +1803,24 @@ compat_symbol (libc, strtod_l, strtold_l, GLIBC_2_3);
# endif
# endif
#endif
#if BUILD_DOUBLE
# if __HAVE_FLOAT64 && !__HAVE_DISTINCT_FLOAT64
# undef strtof64_l
# undef wcstof64_l
# ifdef USE_WIDE_CHAR
weak_alias (wcstod_l, wcstof64_l)
# else
weak_alias (strtod_l, strtof64_l)
# endif
# endif
# if __HAVE_FLOAT32X && !__HAVE_DISTINCT_FLOAT32X
# undef strtof32x_l
# undef wcstof32x_l
# ifdef USE_WIDE_CHAR
weak_alias (wcstod_l, wcstof32x_l)
# else
weak_alias (strtod_l, strtof32x_l)
# endif
# endif
#endif