From e4f1c1be61d916345655d5edba309502046c9473 Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Sun, 2 Jun 2024 21:07:23 +0200
Subject: [PATCH] fixincludes: bypass some fixes for recent darwin headers

fixincludes/ChangeLog:

	* fixincl.x: Regenerate.
	* inclhack.def (darwin_stdint_7, darwin_dispatch_object_1,
	darwin_os_trace_2, darwin_os_base_1): Include bypasses
	for recent headers, fixed by Apple.
---
 fixincludes/fixincl.x    | 42 +++++++++++++++++++++++++++++++++-------
 fixincludes/inclhack.def |  4 ++++
 2 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index e52f11d8460f..caaff2883e00 100644
--- a/fixincludes/fixincl.x
+++ b/fixincludes/fixincl.x
@@ -2,11 +2,11 @@
  *
  * DO NOT EDIT THIS FILE   (fixincl.x)
  *
- * It has been AutoGen-ed  August 17, 2023 at 10:16:38 AM by AutoGen 5.18.12
+ * It has been AutoGen-ed  June  4, 2024 at 02:35:55 PM by AutoGen 5.18.16
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Aug 17 10:16:38 CEST 2023
+/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Jun  4 14:35:55 CEST 2024
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -3070,8 +3070,15 @@ tSCC* apzDarwin_Os_Trace_2Machs[] = {
 tSCC zDarwin_Os_Trace_2Select0[] =
        "typedef.*\\^os_trace_payload_t.*";
 
-#define    DARWIN_OS_TRACE_2_TEST_CT  1
+/*
+ *  content bypass pattern - skip fix if pattern found
+ */
+tSCC zDarwin_Os_Trace_2Bypass0[] =
+       "#ifdef __BLOCKS__";
+
+#define    DARWIN_OS_TRACE_2_TEST_CT  2
 static tTestDesc aDarwin_Os_Trace_2Tests[] = {
+  { TT_NEGREP,   zDarwin_Os_Trace_2Bypass0, (regex_t*)NULL },
   { TT_EGREP,    zDarwin_Os_Trace_2Select0, (regex_t*)NULL }, };
 
 /*
@@ -3199,8 +3206,15 @@ tSCC zDarwin_Os_Base_1Select0[] =
        "#define __has_attribute.*\n\
 #endif";
 
-#define    DARWIN_OS_BASE_1_TEST_CT  1
+/*
+ *  content bypass pattern - skip fix if pattern found
+ */
+tSCC zDarwin_Os_Base_1Bypass0[] =
+       "#define __has_extension";
+
+#define    DARWIN_OS_BASE_1_TEST_CT  2
 static tTestDesc aDarwin_Os_Base_1Tests[] = {
+  { TT_NEGREP,   zDarwin_Os_Base_1Bypass0, (regex_t*)NULL },
   { TT_EGREP,    zDarwin_Os_Base_1Select0, (regex_t*)NULL }, };
 
 /*
@@ -3239,8 +3253,15 @@ tSCC* apzDarwin_Dispatch_Object_1Machs[] = {
 tSCC zDarwin_Dispatch_Object_1Select0[] =
        "typedef void.*\\^dispatch_block_t.*";
 
-#define    DARWIN_DISPATCH_OBJECT_1_TEST_CT  1
+/*
+ *  content bypass pattern - skip fix if pattern found
+ */
+tSCC zDarwin_Dispatch_Object_1Bypass0[] =
+       "#ifdef __BLOCKS__";
+
+#define    DARWIN_DISPATCH_OBJECT_1_TEST_CT  2
 static tTestDesc aDarwin_Dispatch_Object_1Tests[] = {
+  { TT_NEGREP,   zDarwin_Dispatch_Object_1Bypass0, (regex_t*)NULL },
   { TT_EGREP,    zDarwin_Dispatch_Object_1Select0, (regex_t*)NULL }, };
 
 /*
@@ -3591,8 +3612,15 @@ tSCC zDarwin_Stdint_7Select0[] =
        "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n\
 #define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)";
 
-#define    DARWIN_STDINT_7_TEST_CT  1
+/*
+ *  content bypass pattern - skip fix if pattern found
+ */
+tSCC zDarwin_Stdint_7Bypass0[] =
+       "#ifdef __LP64__";
+
+#define    DARWIN_STDINT_7_TEST_CT  2
 static tTestDesc aDarwin_Stdint_7Tests[] = {
+  { TT_NEGREP,   zDarwin_Stdint_7Bypass0, (regex_t*)NULL },
   { TT_EGREP,    zDarwin_Stdint_7Select0, (regex_t*)NULL }, };
 
 /*
@@ -11169,7 +11197,7 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          313
+#define REGEX_COUNT          317
 #define MACH_LIST_SIZE_LIMIT 187
 #define FIX_COUNT            274
 
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 19e0ea2df662..35402d0621cf 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -1486,6 +1486,7 @@ fix = {
   mach      = "*-*-darwin*";
   files     = os/trace.h;
   select    = "typedef.*\\^os_trace_payload_t.*";
+  bypass    = "#ifdef __BLOCKS__";
   c_fix     = format;
   c_fix_arg = "#if __BLOCKS__\n%0\n#endif";
   test_text = "typedef void (^os_trace_payload_t)(xpc_object_t xdict);";
@@ -1566,6 +1567,7 @@ fix = {
 #define __has_attribute.*
 #endif
 OS_BASE_1_SEL;
+  bypass    = "#define __has_extension";
   c_fix     = format;
   c_fix_arg = <<- OS_BASE_1_FIX
 %0
@@ -1589,6 +1591,7 @@ fix = {
   mach      = "*-*-darwin*";
   files     = dispatch/object.h;
   select    = "typedef void.*\\^dispatch_block_t.*";
+  bypass    = "#ifdef __BLOCKS__";
   c_fix     = format;
   c_fix_arg = "#if __BLOCKS__\n%0\n#endif";
   test_text = <<- DISPATCH_OBJECT_1_TEST
@@ -1791,6 +1794,7 @@ fix = {
 		"#endif";
     select    = "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n"
 		"#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)";
+    bypass = '#ifdef __LP64__';
     test_text = "#define INTMAX_C(v)  (v ## LL)\n"
 		"#define UINTMAX_C(v) (v ## ULL)";
 };
-- 
GitLab