This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] powerpc: Fix the compiler mode used with C++ when -mabi=ieeelongdouble
Joseph Myers <joseph@codesourcery.com> writes:
> On Fri, 27 Apr 2018, Tulio Magno Quites Machado Filho wrote:
>
>> When compiling C++ code with -mabi=ieeelongdouble, KCtype is
>> unavailable and TCtype should be used instead.
>
> In that case (-mabi=ieeelongdouble), I'd expect you to use "typedef long
> double _Float128;" for C++, and _Complex long double as the definition of
> __CFLOAT128 for C++, and x##l as the definition of __f128 for C++, as it's
> essentially the case implemented by
> sysdeps/ieee754/ldbl-128/bits/floatn.h. You shouldn't need to use mode
> attributes at all.
Agreed.
> (Uses of __HAVE_DISTINCT_FLOAT128 and __HAVE_FLOAT64X_LONG_DOUBLE will
> need careful review to see if additional macros are needed to cover this
> -mabi=ieeelongdouble case, but the general rule is that they relate to the
> *default* long double type for that glibc binary - meaning the one with
> __*l symbols, as selection of such implementation-namespace one-per-format
> symbols is generally what they are used for in installed headers - meaning
> the existing definitions for powerpc remain correct even with
> -mabi=ieeelongdouble and you should not copy the
> sysdeps/ieee754/ldbl-128/bits/floatn.h definitions of those macros.)
Ack.
I haven't seen requirement for additional macros yet, but when _Float128 is
typedef'ed to long double, the following changes are also necessary:
diff --git a/math/math.h b/math/math.h
index 9b6cdce431..1f1ae6014f 100644
--- a/math/math.h
+++ b/math/math.h
@@ -1025,7 +1025,11 @@ issignaling (long double __val)
return __issignalingl (__val);
# endif
}
-# if __HAVE_DISTINCT_FLOAT128
+# if __HAVE_DISTINCT_FLOAT128 \
+ && (!defined __cplusplus \
+ || defined __cplusplus && __LDBL_MANT_DIG__ != 113)
+/* When using an IEEE 128-bit long double, _Float128 is defined as long double
+ in C++. */
inline int issignaling (_Float128 __val) { return __issignalingf128 (__val); }
# endif
} /* extern C++ */
Is it architecturally-agnostic OK?
--
Tulio Magno