This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3 4/8] float128: Add public _Float128 declarations to libm.
On Thu, 11 May 2017, Gabriel F. T. Gomes wrote:
> > Or maybe nothing actually requires bits/floatn.h and bits/floatn-compat.h
> > to be separate and all the definitions should just go in bits/floatn.h
> > unless and until there are two architectures that need different versions
> > of one of the headers but the same version of the other. That would avoid
> > various places needing to #include bits/floatn-compat.h, and avoid the
> > need to get includes in the correct order.
>
> With bits/floatn.h moved from sysdeps/powerpc/powerpc64le to
> sysdeps/powerpc (as explained above), merging bits/floatn-compat.h into
> bits/floatn.h means that the workarounds for old compilers will be visible
> in the headers for powerpc and powerpc64 installations. That doesn't mean
> that the workarounds will be defined (since they'll be inside #if
> clauses). Is that visibility a problem?
No, it's expected.
> #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
> #include <bits/libc-header-start.h>
This shouldn't be necessary in bits/floatn.h, only in the including
header. (And I'd say that bits/floatn.h should have a multiple-inclusion
guard.)
> /* Defined to concatenate the literal suffix to be used with _Float128
> types, if __HAVE_FLOAT128 is 1. */
> #if __HAVE_FLOAT128
> # if !__GNUC_PREREQ (7, 0)
> /* The literal suffix (f128) exist for powerpc only since GCC 7.0. */
> # define __f128(x) x##q
> # else
> # define __f128(x) x##f128
> # endif
> #endif
Needs to allow for C++ (given that you've defined __HAVE_FLOAT128 for C++,
but C++ doesn't have the f128 suffix).
> /* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */
> #if __HAVE_FLOAT128
> # if !__GNUC_PREREQ (7, 0)
> /* Add a typedef for older GCC compilers which don't natively support
> _Complex _Float128. */
> typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__KC__)));
> # define __CFLOAT128 __cfloat128
> # else
> # define __CFLOAT128 _Complex _Float128
> # endif
> #endif
Likewise.
> /* The type _Float128 exist for powerpc only since GCC 7.0. */
> # if !__GNUC_PREREQ (7, 0)
> typedef __float128 _Float128;
> # endif
Would need to do this for C++ for newer compilers as well.
--
Joseph S. Myers
joseph@codesourcery.com