diff options
author | Gabriel F. T. Gomes <gabriel@inconstante.eti.br> | 2018-06-10 22:42:34 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabriel@inconstante.eti.br> | 2018-12-07 17:28:26 -0200 |
commit | 10446f5d9f2cf4d91c8ae483fd2b5470242ae2a1 (patch) | |
tree | 68e631fca5b65a44e28f5b3791ff2e9b8fc56a25 /libio/libioP.h | |
parent | 45f33aac78e86d0f23c74a207295f3c7a77a94c0 (diff) | |
download | glibc-10446f5d9f2cf4d91c8ae483fd2b5470242ae2a1.zip glibc-10446f5d9f2cf4d91c8ae483fd2b5470242ae2a1.tar.gz glibc-10446f5d9f2cf4d91c8ae483fd2b5470242ae2a1.tar.bz2 |
Prepare vfscanf to use __strtof128_internal
On powerpc64le, long double can currently take two formats: the same as
double (-mlong-double-64) or IBM Extended Precision (default with
-mlong-double-128 or explicitly with -mabi=ibmlongdouble). The internal
implementation of scanf-like functions is aware of these possibilites
and, based on the format in use, properly calls __strtold_internal or
__strtod_internal, saving the return to a variable of type double or
long double.
When library support for TS 18661-3 was added to glibc, a new function,
__strtof128_internal, was added to enable reading of floating-point
values with IEEE binary128 format into the _Float128 type. Now that
powerpc64le is getting support for its third long double format, and
taking into account that this format is the same as the format of
_Float128, this patch extends __vfscanf_internal and __vfwscanf_internal
to call __strtof128_internal or __wcstof128_internal when appropriate.
The result gets saved into a variable of _Float128 type.
Tested for powerpc64le.
Diffstat (limited to 'libio/libioP.h')
-rw-r--r-- | libio/libioP.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/libio/libioP.h b/libio/libioP.h index ce5228e..958ef9b 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -759,9 +759,21 @@ extern off64_t _IO_seekpos_unlocked (FILE *, off64_t, int) allocation for input strings with %as, %aS and %a[, a GNU extension, is disabled. This is the behavior that the __isoc99_scanf family of functions use. When the flag is set to zero, automatic allocation is - enabled. */ -#define SCANF_LDBL_IS_DBL 0x0001 -#define SCANF_ISOC99_A 0x0002 + enabled. + + SCANF_LDBL_USES_FLOAT128 is used on platforms where the long double + format used to be different from the IEC 60559 double format *and* + also different from the Quadruple 128-bits IEC 60559 format (such as + the IBM Extended Precision format on powerpc or the 80-bits IEC 60559 + format on x86), but was later converted to the Quadruple 128-bits IEC + 60559 format, which is the same format that the _Float128 always has + (hence the `USES_FLOAT128' suffix in the name of the flag). When set + to one, this macros indicates that long double values are to be + handled as having this new format. Otherwise, they should be handled + as the previous format on that platform. */ +#define SCANF_LDBL_IS_DBL 0x0001 +#define SCANF_ISOC99_A 0x0002 +#define SCANF_LDBL_USES_FLOAT128 0x0004 extern int __vfscanf_internal (FILE *fp, const char *format, va_list argp, unsigned int flags) |