public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] fixincludes: Fix up powerpc floatn.h tweaks [PR107059]
       [not found] <alpine.DEB.2.22.394.2209280022150.425621@digraph.polyomino.org.uk>
@ 2022-09-28 18:19 ` Jakub Jelinek
  2022-09-30  7:20   ` [PATCH] fixincludes: Deal also with the _Float128x cases [PR107059] Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2022-09-28 18:19 UTC (permalink / raw)
  To: Joseph Myers, Bruce Korb, Jason Merrill; +Cc: gcc-patches

Hi!

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).

Ok for trunk?

BTW, we have some multi-arch related issue with fixincludes too, apparently
fixincludes never worked properly on multi-arch (aka Debian/Ubuntu) :(.

2022-09-28  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.

--- gcc/inclhack.def.jj	2022-09-27 12:29:21.309769836 +0200
+++ gcc/inclhack.def	2022-09-28 19:56:07.222783768 +0200
@@ -2060,11 +2060,11 @@ fix = {
 fix = {
     hackname  = glibc_cxx_floatn_2;
     files     = bits/floatn.h, bits/floatn-common.h, "*/bits/floatn.h", "*/bits/floatn-common.h";
-    select    = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
+    select    = "^([ \t]*#[ \t]*(el)?if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
 		"(([ \t]*/\\*[^\n]*\\*/\n)?"
 		"[ \t]*typedef[ \t]+[^\n]*[ \t]+_Float(16|32|64|128)x?([ \t]+__attribute__ \\(\\(__mode__ \\(__HF__\\)\\)\\))?;)";
     c_fix     = format;
-    c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2";
+    c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%3";
     test_text = <<-EOT
 	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
 	typedef float _Float16 __attribute__ ((__mode__ (__HF__)));
@@ -2072,6 +2072,10 @@ fix = {
 	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
 	typedef __float128 _Float128;
 	#  endif
+	#  if 0
+	#  elif !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	typedef __float128 _Float128;
+	#  endif
 	EOT;
 };
 
@@ -2110,6 +2114,22 @@ fix = {
 	#  endif
 	EOT;
 };
+
+fix = {
+    hackname  = glibc_cxx_floatn_4;
+    files     = bits/floatn.h, "*/bits/floatn.h";
+    select    = "^([ \t]*#[ \t]*if __LDBL_MANT_DIG__ == 113 && )defined __cplusplus\n"
+		"(([ \t]*/\\*[^\n]*\\*/\n)?"
+		"[ \t]*typedef[ \t]+[^\n]*[ \t]+_Float128;)";
+    c_fix     = format;
+    c_fix_arg = "%1defined __cplusplus && !__GNUC_PREREQ (13, 0)\n%2";
+    test_text = <<-EOT
+	#  if __LDBL_MANT_DIG__ == 113 && defined __cplusplus
+	typedef long double _Float128;
+	#   define __CFLOAT128 _Complex long double
+	#  endif
+	EOT;
+};
 
 /*  glibc-2.3.5 defines pthread mutex initializers incorrectly,
  *  so we replace them with versions that correspond to the
--- gcc/fixincl.x.jj	2022-09-27 12:29:21.328769578 +0200
+++ gcc/fixincl.x	2022-09-28 19:56:15.990125976 +0200
@@ -2,11 +2,11 @@
  *
  * DO NOT EDIT THIS FILE   (fixincl.x)
  *
- * It has been AutoGen-ed  September 27, 2022 at 12:21:44 PM by AutoGen 5.18.16
+ * It has been AutoGen-ed  September 28, 2022 at 07:56:15 PM by AutoGen 5.18.16
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Sep 27 12:21:44 CEST 2022
+/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Sep 28 19:56:15 CEST 2022
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -15,7 +15,7 @@
  * certain ANSI-incompatible system header files which are fixed to work
  * correctly with ANSI C and placed in a directory that GNU C will search.
  *
- * This file contains 270 fixup descriptions.
+ * This file contains 271 fixup descriptions.
  *
  * See README for more information.
  *
@@ -4167,7 +4167,7 @@ tSCC zGlibc_Cxx_Floatn_2List[] =
  *  content selection pattern - do fix if pattern found
  */
 tSCC zGlibc_Cxx_Floatn_2Select0[] =
-       "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n\
+       "^([ \t]*#[ \t]*(el)?if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n\
 (([ \t]*/\\*[^\n\
 ]*\\*/\n\
 )?[ \t]*typedef[ \t]+[^\n\
@@ -4183,7 +4183,7 @@ static tTestDesc aGlibc_Cxx_Floatn_2Test
 static const char* apzGlibc_Cxx_Floatn_2Patch[] = {
     "format",
     "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n\
-%2",
+%3",
     (char*)NULL };
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -4233,6 +4233,46 @@ static const char* apzGlibc_Cxx_Floatn_3
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
+ *  Description of Glibc_Cxx_Floatn_4 fix
+ */
+tSCC zGlibc_Cxx_Floatn_4Name[] =
+     "glibc_cxx_floatn_4";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zGlibc_Cxx_Floatn_4List[] =
+  "bits/floatn.h\0*/bits/floatn.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzGlibc_Cxx_Floatn_4Machs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zGlibc_Cxx_Floatn_4Select0[] =
+       "^([ \t]*#[ \t]*if __LDBL_MANT_DIG__ == 113 && )defined __cplusplus\n\
+(([ \t]*/\\*[^\n\
+]*\\*/\n\
+)?[ \t]*typedef[ \t]+[^\n\
+]*[ \t]+_Float128;)";
+
+#define    GLIBC_CXX_FLOATN_4_TEST_CT  1
+static tTestDesc aGlibc_Cxx_Floatn_4Tests[] = {
+  { TT_EGREP,    zGlibc_Cxx_Floatn_4Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Glibc_Cxx_Floatn_4
+ */
+static const char* apzGlibc_Cxx_Floatn_4Patch[] = {
+    "format",
+    "%1defined __cplusplus && !__GNUC_PREREQ (13, 0)\n\
+%2",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
  *  Description of Glibc_Mutex_Init fix
  */
 tSCC zGlibc_Mutex_InitName[] =
@@ -10998,9 +11038,9 @@ static const char* apzX11_SprintfPatch[]
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          308
+#define REGEX_COUNT          309
 #define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT            270
+#define FIX_COUNT            271
 
 /*
  *  Enumerate the fixes
@@ -11106,6 +11146,7 @@ typedef enum {
     GLIBC_CXX_FLOATN_1_FIXIDX,
     GLIBC_CXX_FLOATN_2_FIXIDX,
     GLIBC_CXX_FLOATN_3_FIXIDX,
+    GLIBC_CXX_FLOATN_4_FIXIDX,
     GLIBC_MUTEX_INIT_FIXIDX,
     GLIBC_STDINT_FIXIDX,
     GLIBC_STRNCPY_FIXIDX,
@@ -11779,6 +11820,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      GLIBC_CXX_FLOATN_3_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aGlibc_Cxx_Floatn_3Tests,   apzGlibc_Cxx_Floatn_3Patch, 0 },
 
+  {  zGlibc_Cxx_Floatn_4Name,    zGlibc_Cxx_Floatn_4List,
+     apzGlibc_Cxx_Floatn_4Machs,
+     GLIBC_CXX_FLOATN_4_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aGlibc_Cxx_Floatn_4Tests,   apzGlibc_Cxx_Floatn_4Patch, 0 },
+
   {  zGlibc_Mutex_InitName,    zGlibc_Mutex_InitList,
      apzGlibc_Mutex_InitMachs,
      GLIBC_MUTEX_INIT_TEST_CT, FD_MACH_ONLY,
--- gcc/tests/base/bits/floatn.h.jj	2022-09-28 19:59:27.625087388 +0200
+++ gcc/tests/base/bits/floatn.h	2022-09-28 19:56:30.855465791 +0200
@@ -45,6 +45,10 @@ typedef float _Float16 __attribute__ ((_
 #  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 */
 
 
@@ -72,3 +76,11 @@ typedef _Complex float __cfloat128 __att
 #   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 */


	Jakub


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] fixincludes: Deal also with the _Float128x cases [PR107059]
  2022-09-28 18:19 ` [PATCH] fixincludes: Fix up powerpc floatn.h tweaks [PR107059] Jakub Jelinek
@ 2022-09-30  7:20   ` Jakub Jelinek
  2022-10-04 16:57     ` will schmidt
  2022-10-04 21:20     ` Jason Merrill
  0 siblings, 2 replies; 4+ messages in thread
From: Jakub Jelinek @ 2022-09-30  7:20 UTC (permalink / raw)
  To: Joseph Myers, Bruce Korb, Jason Merrill, gcc-patches

On Wed, Sep 28, 2022 at 08:19:43PM +0200, Jakub Jelinek via Gcc-patches wrote:
> 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).

This incremental patch deals handles the above 3 cases, so we
fixinclude what glibc itself changed too.

Bootstrapped/regtested on x86_64-linux and i686-linux (together with the
previously posted fixincludes/ change too), ok for trunk?

2022-09-30  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/107059
	* inclhack.def (glibc_cxx_floatn_5): New.
	* fixincl.x: Regenerated.
	* tests/base/bits/floatn.h: Regenerated.

--- fixincludes/inclhack.def.jj	2022-09-29 22:18:47.974402688 +0200
+++ fixincludes/inclhack.def	2022-09-29 22:22:48.151145670 +0200
@@ -2131,6 +2131,23 @@ fix = {
 	EOT;
 };
 
+fix = {
+    hackname  = glibc_cxx_floatn_5;
+    files     = bits/floatn.h, bits/floatn-common.h, "*/bits/floatn.h", "*/bits/floatn-common.h";
+    select    = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
+		"([ \t]*#[ \t]+error \"_Float128[xX] supported but no )";
+    c_fix     = format;
+    c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2";
+    test_text = <<-EOT
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	#   error "_Float128X supported but no constant suffix"
+	#  endif
+	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+	#   error "_Float128x supported but no type"
+	#  endif
+	EOT;
+};
+
 /*  glibc-2.3.5 defines pthread mutex initializers incorrectly,
  *  so we replace them with versions that correspond to the
  *  definition.
--- fixincludes/fixincl.x.jj	2022-09-29 22:18:47.975402675 +0200
+++ fixincludes/fixincl.x	2022-09-29 22:22:55.675909244 +0200
@@ -2,11 +2,11 @@
  *
  * DO NOT EDIT THIS FILE   (fixincl.x)
  *
- * It has been AutoGen-ed  September 28, 2022 at 07:56:15 PM by AutoGen 5.18.16
+ * It has been AutoGen-ed  September 29, 2022 at 10:22:55 PM by AutoGen 5.18.16
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Sep 28 19:56:15 CEST 2022
+/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Sep 29 22:22:55 CEST 2022
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -15,7 +15,7 @@
  * certain ANSI-incompatible system header files which are fixed to work
  * correctly with ANSI C and placed in a directory that GNU C will search.
  *
- * This file contains 271 fixup descriptions.
+ * This file contains 272 fixup descriptions.
  *
  * See README for more information.
  *
@@ -4273,6 +4273,43 @@ static const char* apzGlibc_Cxx_Floatn_4
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
+ *  Description of Glibc_Cxx_Floatn_5 fix
+ */
+tSCC zGlibc_Cxx_Floatn_5Name[] =
+     "glibc_cxx_floatn_5";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zGlibc_Cxx_Floatn_5List[] =
+  "bits/floatn.h\0bits/floatn-common.h\0*/bits/floatn.h\0*/bits/floatn-common.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzGlibc_Cxx_Floatn_5Machs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zGlibc_Cxx_Floatn_5Select0[] =
+       "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n\
+([ \t]*#[ \t]+error \"_Float128[xX] supported but no )";
+
+#define    GLIBC_CXX_FLOATN_5_TEST_CT  1
+static tTestDesc aGlibc_Cxx_Floatn_5Tests[] = {
+  { TT_EGREP,    zGlibc_Cxx_Floatn_5Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Glibc_Cxx_Floatn_5
+ */
+static const char* apzGlibc_Cxx_Floatn_5Patch[] = {
+    "format",
+    "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n\
+%2",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
  *  Description of Glibc_Mutex_Init fix
  */
 tSCC zGlibc_Mutex_InitName[] =
@@ -11038,9 +11075,9 @@ static const char* apzX11_SprintfPatch[]
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          309
+#define REGEX_COUNT          310
 #define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT            271
+#define FIX_COUNT            272
 
 /*
  *  Enumerate the fixes
@@ -11147,6 +11184,7 @@ typedef enum {
     GLIBC_CXX_FLOATN_2_FIXIDX,
     GLIBC_CXX_FLOATN_3_FIXIDX,
     GLIBC_CXX_FLOATN_4_FIXIDX,
+    GLIBC_CXX_FLOATN_5_FIXIDX,
     GLIBC_MUTEX_INIT_FIXIDX,
     GLIBC_STDINT_FIXIDX,
     GLIBC_STRNCPY_FIXIDX,
@@ -11825,6 +11863,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      GLIBC_CXX_FLOATN_4_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aGlibc_Cxx_Floatn_4Tests,   apzGlibc_Cxx_Floatn_4Patch, 0 },
 
+  {  zGlibc_Cxx_Floatn_5Name,    zGlibc_Cxx_Floatn_5List,
+     apzGlibc_Cxx_Floatn_5Machs,
+     GLIBC_CXX_FLOATN_5_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aGlibc_Cxx_Floatn_5Tests,   apzGlibc_Cxx_Floatn_5Patch, 0 },
+
   {  zGlibc_Mutex_InitName,    zGlibc_Mutex_InitList,
      apzGlibc_Mutex_InitMachs,
      GLIBC_MUTEX_INIT_TEST_CT, FD_MACH_ONLY,
--- fixincludes/tests/base/bits/floatn.h.jj	2022-09-29 22:18:47.976402661 +0200
+++ fixincludes/tests/base/bits/floatn.h	2022-09-29 22:23:19.703717787 +0200
@@ -84,3 +84,13 @@ typedef long double _Float128;
 #   define __CFLOAT128 _Complex long double
 #  endif
 #endif  /* GLIBC_CXX_FLOATN_4_CHECK */
+
+
+#if defined( GLIBC_CXX_FLOATN_5_CHECK )
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+#   error "_Float128X supported but no constant suffix"
+#  endif
+#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
+#   error "_Float128x supported but no type"
+#  endif
+#endif  /* GLIBC_CXX_FLOATN_5_CHECK */


	Jakub


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fixincludes: Deal also with the _Float128x cases [PR107059]
  2022-09-30  7:20   ` [PATCH] fixincludes: Deal also with the _Float128x cases [PR107059] Jakub Jelinek
@ 2022-10-04 16:57     ` will schmidt
  2022-10-04 21:20     ` Jason Merrill
  1 sibling, 0 replies; 4+ messages in thread
From: will schmidt @ 2022-10-04 16:57 UTC (permalink / raw)
  To: Jakub Jelinek, Joseph Myers, Bruce Korb, Jason Merrill, gcc-patches

On Fri, 2022-09-30 at 09:20 +0200, Jakub Jelinek via Gcc-patches wrote:
> On Wed, Sep 28, 2022 at 08:19:43PM +0200, Jakub Jelinek via Gcc-
> patches wrote:
> > 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).
> 
> This incremental patch deals handles the above 3 cases, so we
> fixinclude what glibc itself changed too.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux (together with
> the
> previously posted fixincludes/ change too), ok for trunk?

Hi,

The combination of these two patches allows me to build gcc
successfully.  (PPC64LE with RHEL9).

A nit that Part1 needed massaging
of the path/to/files (i.e. gcc/inclhack.def versus
fixincludes/inclhack.def) to apply.

I can't otherwise speak to the
changes, aside from they seem to work for me.

Thanks
-WIll



> 
> 2022-09-30  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR bootstrap/107059
> 	* inclhack.def (glibc_cxx_floatn_5): New.
> 	* fixincl.x: Regenerated.
> 	* tests/base/bits/floatn.h: Regenerated.
> 
> --- fixincludes/inclhack.def.jj	2022-09-29 22:18:47.974402688
> +0200
> +++ fixincludes/inclhack.def	2022-09-29 22:22:48.151145670 +0200
> @@ -2131,6 +2131,23 @@ fix = {
>  	EOT;
>  };
> 
> +fix = {
> +    hackname  = glibc_cxx_floatn_5;
> +    files     = bits/floatn.h, bits/floatn-common.h,
> "*/bits/floatn.h", "*/bits/floatn-common.h";
> +    select    = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\|
> )defined __cplusplus\n"
> +		"([ \t]*#[ \t]+error \"_Float128[xX] supported but no
> )";
> +    c_fix     = format;
> +    c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13,
> 0))\n%2";
> +    test_text = <<-EOT
> +	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
> +	#   error "_Float128X supported but no constant suffix"
> +	#  endif
> +	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
> +	#   error "_Float128x supported but no type"
> +	#  endif
> +	EOT;
> +};
> +
>  /*  glibc-2.3.5 defines pthread mutex initializers incorrectly,
>   *  so we replace them with versions that correspond to the
>   *  definition.
> --- fixincludes/fixincl.x.jj	2022-09-29 22:18:47.975402675 +0200
> +++ fixincludes/fixincl.x	2022-09-29 22:22:55.675909244 +0200
> @@ -2,11 +2,11 @@
>   *
>   * DO NOT EDIT THIS FILE   (fixincl.x)
>   *
> - * It has been AutoGen-ed  September 28, 2022 at 07:56:15 PM by
> AutoGen 5.18.16
> + * It has been AutoGen-ed  September 29, 2022 at 10:22:55 PM by
> AutoGen 5.18.16
>   * From the definitions    inclhack.def
>   * and the template file   fixincl
>   */
> -/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Sep 28 19:56:15 CEST 2022
> +/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Sep 29 22:22:55 CEST 2022
>   *
>   * You must regenerate it.  Use the ./genfixes script.
>   *
> @@ -15,7 +15,7 @@
>   * certain ANSI-incompatible system header files which are fixed to
> work
>   * correctly with ANSI C and placed in a directory that GNU C will
> search.
>   *
> - * This file contains 271 fixup descriptions.
> + * This file contains 272 fixup descriptions.
>   *
>   * See README for more information.
>   *
> @@ -4273,6 +4273,43 @@ static const char* apzGlibc_Cxx_Floatn_4
> 
>  /* * * * * * * * * * * * * * * * * * * * * * * * * *
>   *
> + *  Description of Glibc_Cxx_Floatn_5 fix
> + */
> +tSCC zGlibc_Cxx_Floatn_5Name[] =
> +     "glibc_cxx_floatn_5";
> +
> +/*
> + *  File name selection pattern
> + */
> +tSCC zGlibc_Cxx_Floatn_5List[] =
> +  "bits/floatn.h\0bits/floatn-
> common.h\0*/bits/floatn.h\0*/bits/floatn-common.h\0";
> +/*
> + *  Machine/OS name selection pattern
> + */
> +#define apzGlibc_Cxx_Floatn_5Machs (const char**)NULL
> +
> +/*
> + *  content selection pattern - do fix if pattern found
> + */
> +tSCC zGlibc_Cxx_Floatn_5Select0[] =
> +       "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined
> __cplusplus\n\
> +([ \t]*#[ \t]+error \"_Float128[xX] supported but no )";
> +
> +#define    GLIBC_CXX_FLOATN_5_TEST_CT  1
> +static tTestDesc aGlibc_Cxx_Floatn_5Tests[] = {
> +  { TT_EGREP,    zGlibc_Cxx_Floatn_5Select0, (regex_t*)NULL }, };
> +
> +/*
> + *  Fix Command Arguments for Glibc_Cxx_Floatn_5
> + */
> +static const char* apzGlibc_Cxx_Floatn_5Patch[] = {
> +    "format",
> +    "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n\
> +%2",
> +    (char*)NULL };
> +
> +/* * * * * * * * * * * * * * * * * * * * * * * * * *
> + *
>   *  Description of Glibc_Mutex_Init fix
>   */
>  tSCC zGlibc_Mutex_InitName[] =
> @@ -11038,9 +11075,9 @@ static const char* apzX11_SprintfPatch[]
>   *
>   *  List of all fixes
>   */
> -#define REGEX_COUNT          309
> +#define REGEX_COUNT          310
>  #define MACH_LIST_SIZE_LIMIT 187
> -#define FIX_COUNT            271
> +#define FIX_COUNT            272
> 
>  /*
>   *  Enumerate the fixes
> @@ -11147,6 +11184,7 @@ typedef enum {
>      GLIBC_CXX_FLOATN_2_FIXIDX,
>      GLIBC_CXX_FLOATN_3_FIXIDX,
>      GLIBC_CXX_FLOATN_4_FIXIDX,
> +    GLIBC_CXX_FLOATN_5_FIXIDX,
>      GLIBC_MUTEX_INIT_FIXIDX,
>      GLIBC_STDINT_FIXIDX,
>      GLIBC_STRNCPY_FIXIDX,
> @@ -11825,6 +11863,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
>       GLIBC_CXX_FLOATN_4_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
>       aGlibc_Cxx_Floatn_4Tests,   apzGlibc_Cxx_Floatn_4Patch, 0 },
> 
> +  {  zGlibc_Cxx_Floatn_5Name,    zGlibc_Cxx_Floatn_5List,
> +     apzGlibc_Cxx_Floatn_5Machs,
> +     GLIBC_CXX_FLOATN_5_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
> +     aGlibc_Cxx_Floatn_5Tests,   apzGlibc_Cxx_Floatn_5Patch, 0 },
> +
>    {  zGlibc_Mutex_InitName,    zGlibc_Mutex_InitList,
>       apzGlibc_Mutex_InitMachs,
>       GLIBC_MUTEX_INIT_TEST_CT, FD_MACH_ONLY,
> --- fixincludes/tests/base/bits/floatn.h.jj	2022-09-29
> 22:18:47.976402661 +0200
> +++ fixincludes/tests/base/bits/floatn.h	2022-09-29
> 22:23:19.703717787 +0200
> @@ -84,3 +84,13 @@ typedef long double _Float128;
>  #   define __CFLOAT128 _Complex long double
>  #  endif
>  #endif  /* GLIBC_CXX_FLOATN_4_CHECK */
> +
> +
> +#if defined( GLIBC_CXX_FLOATN_5_CHECK )
> +#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus &&
> !__GNUC_PREREQ (13, 0))
> +#   error "_Float128X supported but no constant suffix"
> +#  endif
> +#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus &&
> !__GNUC_PREREQ (13, 0))
> +#   error "_Float128x supported but no type"
> +#  endif
> +#endif  /* GLIBC_CXX_FLOATN_5_CHECK */
> 
> 
> 	Jakub
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fixincludes: Deal also with the _Float128x cases [PR107059]
  2022-09-30  7:20   ` [PATCH] fixincludes: Deal also with the _Float128x cases [PR107059] Jakub Jelinek
  2022-10-04 16:57     ` will schmidt
@ 2022-10-04 21:20     ` Jason Merrill
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Merrill @ 2022-10-04 21:20 UTC (permalink / raw)
  To: Jakub Jelinek, Joseph Myers, Bruce Korb, gcc-patches

On 9/30/22 03:20, Jakub Jelinek wrote:
> On Wed, Sep 28, 2022 at 08:19:43PM +0200, Jakub Jelinek via Gcc-patches wrote:
>> 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).
> 
> This incremental patch deals handles the above 3 cases, so we
> fixinclude what glibc itself changed too.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux (together with the
> previously posted fixincludes/ change too), ok for trunk?

Both OK on Friday if no comments before then.

> 2022-09-30  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR bootstrap/107059
> 	* inclhack.def (glibc_cxx_floatn_5): New.
> 	* fixincl.x: Regenerated.
> 	* tests/base/bits/floatn.h: Regenerated.
> 
> --- fixincludes/inclhack.def.jj	2022-09-29 22:18:47.974402688 +0200
> +++ fixincludes/inclhack.def	2022-09-29 22:22:48.151145670 +0200
> @@ -2131,6 +2131,23 @@ fix = {
>   	EOT;
>   };
>   
> +fix = {
> +    hackname  = glibc_cxx_floatn_5;
> +    files     = bits/floatn.h, bits/floatn-common.h, "*/bits/floatn.h", "*/bits/floatn-common.h";
> +    select    = "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n"
> +		"([ \t]*#[ \t]+error \"_Float128[xX] supported but no )";
> +    c_fix     = format;
> +    c_fix_arg = "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n%2";
> +    test_text = <<-EOT
> +	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
> +	#   error "_Float128X supported but no constant suffix"
> +	#  endif
> +	#  if !__GNUC_PREREQ (7, 0) || defined __cplusplus
> +	#   error "_Float128x supported but no type"
> +	#  endif
> +	EOT;
> +};
> +
>   /*  glibc-2.3.5 defines pthread mutex initializers incorrectly,
>    *  so we replace them with versions that correspond to the
>    *  definition.
> --- fixincludes/fixincl.x.jj	2022-09-29 22:18:47.975402675 +0200
> +++ fixincludes/fixincl.x	2022-09-29 22:22:55.675909244 +0200
> @@ -2,11 +2,11 @@
>    *
>    * DO NOT EDIT THIS FILE   (fixincl.x)
>    *
> - * It has been AutoGen-ed  September 28, 2022 at 07:56:15 PM by AutoGen 5.18.16
> + * It has been AutoGen-ed  September 29, 2022 at 10:22:55 PM by AutoGen 5.18.16
>    * From the definitions    inclhack.def
>    * and the template file   fixincl
>    */
> -/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Sep 28 19:56:15 CEST 2022
> +/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Sep 29 22:22:55 CEST 2022
>    *
>    * You must regenerate it.  Use the ./genfixes script.
>    *
> @@ -15,7 +15,7 @@
>    * certain ANSI-incompatible system header files which are fixed to work
>    * correctly with ANSI C and placed in a directory that GNU C will search.
>    *
> - * This file contains 271 fixup descriptions.
> + * This file contains 272 fixup descriptions.
>    *
>    * See README for more information.
>    *
> @@ -4273,6 +4273,43 @@ static const char* apzGlibc_Cxx_Floatn_4
>   
>   /* * * * * * * * * * * * * * * * * * * * * * * * * *
>    *
> + *  Description of Glibc_Cxx_Floatn_5 fix
> + */
> +tSCC zGlibc_Cxx_Floatn_5Name[] =
> +     "glibc_cxx_floatn_5";
> +
> +/*
> + *  File name selection pattern
> + */
> +tSCC zGlibc_Cxx_Floatn_5List[] =
> +  "bits/floatn.h\0bits/floatn-common.h\0*/bits/floatn.h\0*/bits/floatn-common.h\0";
> +/*
> + *  Machine/OS name selection pattern
> + */
> +#define apzGlibc_Cxx_Floatn_5Machs (const char**)NULL
> +
> +/*
> + *  content selection pattern - do fix if pattern found
> + */
> +tSCC zGlibc_Cxx_Floatn_5Select0[] =
> +       "^([ \t]*#[ \t]*if !__GNUC_PREREQ \\(7, 0\\) \\|\\| )defined __cplusplus\n\
> +([ \t]*#[ \t]+error \"_Float128[xX] supported but no )";
> +
> +#define    GLIBC_CXX_FLOATN_5_TEST_CT  1
> +static tTestDesc aGlibc_Cxx_Floatn_5Tests[] = {
> +  { TT_EGREP,    zGlibc_Cxx_Floatn_5Select0, (regex_t*)NULL }, };
> +
> +/*
> + *  Fix Command Arguments for Glibc_Cxx_Floatn_5
> + */
> +static const char* apzGlibc_Cxx_Floatn_5Patch[] = {
> +    "format",
> +    "%1(defined __cplusplus && !__GNUC_PREREQ (13, 0))\n\
> +%2",
> +    (char*)NULL };
> +
> +/* * * * * * * * * * * * * * * * * * * * * * * * * *
> + *
>    *  Description of Glibc_Mutex_Init fix
>    */
>   tSCC zGlibc_Mutex_InitName[] =
> @@ -11038,9 +11075,9 @@ static const char* apzX11_SprintfPatch[]
>    *
>    *  List of all fixes
>    */
> -#define REGEX_COUNT          309
> +#define REGEX_COUNT          310
>   #define MACH_LIST_SIZE_LIMIT 187
> -#define FIX_COUNT            271
> +#define FIX_COUNT            272
>   
>   /*
>    *  Enumerate the fixes
> @@ -11147,6 +11184,7 @@ typedef enum {
>       GLIBC_CXX_FLOATN_2_FIXIDX,
>       GLIBC_CXX_FLOATN_3_FIXIDX,
>       GLIBC_CXX_FLOATN_4_FIXIDX,
> +    GLIBC_CXX_FLOATN_5_FIXIDX,
>       GLIBC_MUTEX_INIT_FIXIDX,
>       GLIBC_STDINT_FIXIDX,
>       GLIBC_STRNCPY_FIXIDX,
> @@ -11825,6 +11863,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
>        GLIBC_CXX_FLOATN_4_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
>        aGlibc_Cxx_Floatn_4Tests,   apzGlibc_Cxx_Floatn_4Patch, 0 },
>   
> +  {  zGlibc_Cxx_Floatn_5Name,    zGlibc_Cxx_Floatn_5List,
> +     apzGlibc_Cxx_Floatn_5Machs,
> +     GLIBC_CXX_FLOATN_5_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
> +     aGlibc_Cxx_Floatn_5Tests,   apzGlibc_Cxx_Floatn_5Patch, 0 },
> +
>     {  zGlibc_Mutex_InitName,    zGlibc_Mutex_InitList,
>        apzGlibc_Mutex_InitMachs,
>        GLIBC_MUTEX_INIT_TEST_CT, FD_MACH_ONLY,
> --- fixincludes/tests/base/bits/floatn.h.jj	2022-09-29 22:18:47.976402661 +0200
> +++ fixincludes/tests/base/bits/floatn.h	2022-09-29 22:23:19.703717787 +0200
> @@ -84,3 +84,13 @@ typedef long double _Float128;
>   #   define __CFLOAT128 _Complex long double
>   #  endif
>   #endif  /* GLIBC_CXX_FLOATN_4_CHECK */
> +
> +
> +#if defined( GLIBC_CXX_FLOATN_5_CHECK )
> +#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
> +#   error "_Float128X supported but no constant suffix"
> +#  endif
> +#  if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
> +#   error "_Float128x supported but no type"
> +#  endif
> +#endif  /* GLIBC_CXX_FLOATN_5_CHECK */
> 
> 
> 	Jakub
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-04 21:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <alpine.DEB.2.22.394.2209280022150.425621@digraph.polyomino.org.uk>
2022-09-28 18:19 ` [PATCH] fixincludes: Fix up powerpc floatn.h tweaks [PR107059] Jakub Jelinek
2022-09-30  7:20   ` [PATCH] fixincludes: Deal also with the _Float128x cases [PR107059] Jakub Jelinek
2022-10-04 16:57     ` will schmidt
2022-10-04 21:20     ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).