mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
On Wed, Sep 28, 2022 at 12:23:31AM +0000, Joseph Myers wrote:
> In general the changes match those made by fixincludes, though I think
> the ones in sysdeps/powerpc/bits/floatn.h, where the header tests
> __LDBL_MANT_DIG__ == 113 or uses #elif, wouldn't match the existing
> fixincludes patterns.
You're right, missed that.
The header has:
/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */
# if __HAVE_FLOAT128
# if __LDBL_MANT_DIG__ == 113 && defined __cplusplus
typedef long double _Float128;
# define __CFLOAT128 _Complex long double
# elif !__GNUC_PREREQ (7, 0) || defined __cplusplus
/* The type _Float128 exist for powerpc only since GCC 7.0. */
typedef __float128 _Float128;
/* Add a typedef for older GCC and C++ 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
and my current rules don't do anything about that.
The following patch fixes that.
I've run additionally
MACRO_LIST=`pwd`/../gcc/macro_list TARGET_MACHINE=x86_64-pc-linux-gnu \
../fixincludes/fixinc.sh /tmp/include-fixed \
`echo /usr/src/libc | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta`
in the builddir/fixincludes directory where /usr/src/libc is latest glibc
trunk checkout and seems the remaining defined __cplusplus cases in the floatn.h
and floatn-common.h headers are ok or acceptable.
The remaining cases are:
#if __GNUC_PREREQ (7, 0) && !defined __cplusplus
# define __HAVE_FLOATN_NOT_TYPEDEF 1
#else
# define __HAVE_FLOATN_NOT_TYPEDEF 0
#endif
which is IMHO ok because this is only used in tgmath.h or tgmath-like math.h
stuff which is C only, as C++ doesn't have _Generic.
Another case are the following 3 snippets:
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
# error "_Float128X supported but no constant suffix"
# else
# define __f128x(x) x##f128x
# endif
...
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
# error "_Float128X supported but no complex type"
# else
# define __CFLOAT128X _Complex _Float128x
# endif
...
# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
# error "_Float128x supported but no type"
# endif
but as no target has _Float128x right now and don't see it
coming soon, it isn't a big deal (on the glibc side it is of
course ok to adjust those).
OT, besides floatn.h and floatn-common.h headers, the only
one remaining in /tmp/include-fixed is sysdeps/arm/unwind.h, perhaps
-#if defined(linux) || defined(__NetBSD__)
+#if defined(__linux__) || defined(__NetBSD__)
should be done in that header (and libgcc/config/arm/unwind-arm.h
too).
2022-10-07 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/107059
* inclhack.def (glibc_cxx_floatn_2): Handle #elif the same as #if.
(glibc_cxx_floatn_4): New.
* fixincl.x: Regenerated.
* tests/base/bits/floatn.h: Regenerated.
87 lines
2.6 KiB
C
87 lines
2.6 KiB
C
/* DO NOT EDIT THIS FILE.
|
|
|
|
It has been auto-edited by fixincludes from:
|
|
|
|
"fixinc/tests/inc/bits/floatn.h"
|
|
|
|
This had to be done to correct non-standard usages in the
|
|
original, manufacturer supplied header file. */
|
|
|
|
|
|
|
|
#if defined( GLIBC_CXX_FLOATN_1_CHECK )
|
|
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
|
|
/* The literal suffix f128 exists only since GCC 7.0. */
|
|
# define __f128(x) x##l
|
|
# else
|
|
# define __f128(x) x##f128
|
|
# endif
|
|
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
|
|
/* The literal suffix (f128) exist for powerpc only since GCC 7.0. */
|
|
# if __LDBL_MANT_DIG__ == 113
|
|
# define __f128(x) x##l
|
|
# else
|
|
# define __f128(x) x##q
|
|
# endif
|
|
# else
|
|
# define __f128(x) x##f128
|
|
# endif
|
|
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
|
|
# ifdef __NO_LONG_DOUBLE_MATH
|
|
# define __f64(x) x##l
|
|
# else
|
|
# define __f64(x) x
|
|
# endif
|
|
# else
|
|
# define __f64(x) x##f64
|
|
# endif
|
|
#endif /* GLIBC_CXX_FLOATN_1_CHECK */
|
|
|
|
|
|
#if defined( GLIBC_CXX_FLOATN_2_CHECK )
|
|
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
|
|
typedef float _Float16 __attribute__ ((__mode__ (__HF__)));
|
|
# endif
|
|
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
|
|
typedef __float128 _Float128;
|
|
# endif
|
|
# if 0
|
|
# elif !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
|
|
typedef __float128 _Float128;
|
|
# endif
|
|
#endif /* GLIBC_CXX_FLOATN_2_CHECK */
|
|
|
|
|
|
#if defined( GLIBC_CXX_FLOATN_3_CHECK )
|
|
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
|
|
# define __CFLOAT128 _Complex long double
|
|
# else
|
|
# define __CFLOAT128 _Complex _Float128
|
|
# endif
|
|
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
|
|
/* Add a typedef for older GCC compilers which don't natively support
|
|
_Complex _Float128. */
|
|
typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
|
|
# define __CFLOAT128 __cfloat128
|
|
# else
|
|
# define __CFLOAT128 _Complex _Float128
|
|
# endif
|
|
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
|
|
# ifdef __NO_LONG_DOUBLE_MATH
|
|
# define __CFLOAT64 _Complex long double
|
|
# else
|
|
# define __CFLOAT64 _Complex double
|
|
# endif
|
|
# else
|
|
# define __CFLOAT64 _Complex _Float64
|
|
# endif
|
|
#endif /* GLIBC_CXX_FLOATN_3_CHECK */
|
|
|
|
|
|
#if defined( GLIBC_CXX_FLOATN_4_CHECK )
|
|
# if __LDBL_MANT_DIG__ == 113 && defined __cplusplus && !__GNUC_PREREQ (13, 0)
|
|
typedef long double _Float128;
|
|
# define __CFLOAT128 _Complex long double
|
|
# endif
|
|
#endif /* GLIBC_CXX_FLOATN_4_CHECK */
|