This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 4/6] ldbl-128: Rename 'long double' to 'ldouble_t'
On 08/16/2016 01:10 PM, Joseph Myers wrote:
> On Tue, 16 Aug 2016, Paul E. Murphy wrote:
>
>> Add a layer of macro indirection for long double files
>> which need to be built using another typename. Likewise,
>> add the L(num) macro used in a later patch to override
>> real constants.
>>
>> These changes produce identical binaries for s390x and
>> aarch64.
>>
>> * sysdeps/generic/math_private.h:
>> [!__LDOUBLE_T_OVERRIDDEN] (ldouble_t): New default macro
>> alias for long double.
>> [!__LDOUBLE_T_OVERRIDDEN] (L): New default macro to apply
>> long double literal suffix.
>
> I don't think ldouble_t is the right name here; it could be confused with
> long_double_t, the type name added by TS 18661-3 for a type with the
> evaluation format used for long double.
>
> I think the right name to use is _Float128; that name unambiguously
> relates to the format these functions are written for. (When we can
> assume a compiler with _FloatN / _FloatNx support, the ideal would be that
> these functions always define the associated _Float128 function names, use
> *f128 constants directly, etc., and may or may not, depending on the glibc
> configuration, also have aliases with the long double names, with
> _Float64x names or with both sets of names. This series is of course only
> achieving an interim step towards such a goal which isn't possible yet,
> but there should be no problem using the _Float128 name for the macro
> now.)
That was my original thought, but it begs the question of why the
implementation should reside in ldbl-128 folder.
Likewise, other long double formats do include some ldbl-128 files
with the intent of building them using the native long double format
(e.g ldbl-128ibm e_j0l.c). Thus, calling such a macro _Float128 is
misleading, or wrong, in those circumstances.
I have no objection to calling it another name maybe m_ldouble, or
LONG_DOUBLE.
>
>> diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h
>> index 08b04e0..15f1efc 100644
>> --- a/sysdeps/generic/math_private.h
>> +++ b/sysdeps/generic/math_private.h
>> @@ -185,6 +185,13 @@ do { \
>> ldbl-128 files as another type (e.g _Float128). */
>> #define mathx_hidden_def(name) hidden_def(name)
>>
>> +/* These hooks let us override certain long double files using
>> + a different type (e.g building ldbl-128 as _Float128). */
>> +#ifndef __LDOUBLE_T_OVERRIDDEN
>> +# define ldouble_t long double
>> +# define L(x) x##L
>> +#endif
>
> I don't think this header is the right place for something entirely
> specific to the ldbl-128 function implementations.
Ultimately, this will be needed to build the ldbl-128ibm under whatever
typename emerges when transitioning the ppc64le long double format.