public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-5275] Darwin, fixincludes: Handle Apple Blocks in objc/runtime.h.
@ 2023-01-21 17:11 Iain D Sandoe
  0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2023-01-21 17:11 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:046dc9d0d4683bab99d28983d8841ba3c56ef744

commit r13-5275-g046dc9d0d4683bab99d28983d8841ba3c56ef744
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Wed Jan 18 23:25:36 2023 +0000

    Darwin, fixincludes: Handle Apple Blocks in objc/runtime.h.
    
    The macOS 13 SDK has unguarded Apple Blocks use in objc/runtime.h which
    causes most of the objective-c tests to fail.
    
    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
    
    fixincludes/ChangeLog:
    
            * fixincl.x: Regenerate.
            * inclhack.def (darwin_objc_runtime_1): New hack.
            * tests/base/objc/runtime.h: New file.

Diff:
---
 fixincludes/fixincl.x                 | 63 ++++++++++++++++++++++++++++++++---
 fixincludes/inclhack.def              | 35 +++++++++++++++++++
 fixincludes/tests/base/objc/runtime.h | 24 +++++++++++++
 3 files changed, 117 insertions(+), 5 deletions(-)

diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index 35167dc82a8..acb906eea29 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  January 18, 2023 at 07:54:50 PM by AutoGen 5.18.7
+ * It has been AutoGen-ed  January 18, 2023 at 09:06:47 PM by AutoGen 5.18.7
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Jan 18 19:54:50 GMT 2023
+/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Jan 18 21:06:47 GMT 2023
  *
  * 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 273 fixup descriptions.
+ * This file contains 274 fixup descriptions.
  *
  * See README for more information.
  *
@@ -3084,6 +3084,53 @@ static const char* apzDarwin_Os_Trace_2Patch[] = {
 #endif",
     (char*)NULL };
 
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ *  Description of Darwin_Objc_Runtime_1 fix
+ */
+tSCC zDarwin_Objc_Runtime_1Name[] =
+     "darwin_objc_runtime_1";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zDarwin_Objc_Runtime_1List[] =
+  "objc/runtime.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+tSCC* apzDarwin_Objc_Runtime_1Machs[] = {
+        "*-*-darwin2*",
+        (const char*)NULL };
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zDarwin_Objc_Runtime_1Select0[] =
+       "OBJC_EXPORT void.*\n\
+objc_enumerateClasses.*\n\
+.*\n\
+.*\n\
+.*\n\
+.*void \\(\\^ _Nonnull block.*\n\
+.*\n\
+.*\n\
+.*OBJC_REFINED_FOR_SWIFT.*";
+
+#define    DARWIN_OBJC_RUNTIME_1_TEST_CT  1
+static tTestDesc aDarwin_Objc_Runtime_1Tests[] = {
+  { TT_EGREP,    zDarwin_Objc_Runtime_1Select0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Darwin_Objc_Runtime_1
+ */
+static const char* apzDarwin_Objc_Runtime_1Patch[] = {
+    "format",
+    "#if __BLOCKS__\n\
+%0\n\
+#endif",
+    (char*)NULL };
+
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
  *  Description of Darwin_Os_Trace_3 fix
@@ -11115,9 +11162,9 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          311
+#define REGEX_COUNT          312
 #define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT            273
+#define FIX_COUNT            274
 
 /*
  *  Enumerate the fixes
@@ -11196,6 +11243,7 @@ typedef enum {
     DARWIN_LONGJMP_NORETURN_FIXIDX,
     DARWIN_OS_TRACE_1_FIXIDX,
     DARWIN_OS_TRACE_2_FIXIDX,
+    DARWIN_OBJC_RUNTIME_1_FIXIDX,
     DARWIN_OS_TRACE_3_FIXIDX,
     DARWIN_OS_BASE_1_FIXIDX,
     DARWIN_DISPATCH_OBJECT_1_FIXIDX,
@@ -11764,6 +11812,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      DARWIN_OS_TRACE_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aDarwin_Os_Trace_2Tests,   apzDarwin_Os_Trace_2Patch, 0 },
 
+  {  zDarwin_Objc_Runtime_1Name,    zDarwin_Objc_Runtime_1List,
+     apzDarwin_Objc_Runtime_1Machs,
+     DARWIN_OBJC_RUNTIME_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aDarwin_Objc_Runtime_1Tests,   apzDarwin_Objc_Runtime_1Patch, 0 },
+
   {  zDarwin_Os_Trace_3Name,    zDarwin_Os_Trace_3List,
      apzDarwin_Os_Trace_3Machs,
      DARWIN_OS_TRACE_3_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index ea879b73bad..b02dd8e0575 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -1491,6 +1491,41 @@ fix = {
   test_text = "typedef void (^os_trace_payload_t)(xpc_object_t xdict);";
 };
 
+/*
+ *  macOSX 13.0 SDK objc/runtime.h uses Apple Blocks extension without a guard.
+ */
+
+fix = {
+  hackname  = darwin_objc_runtime_1;
+  mach      = "*-*-darwin2*";
+  files     = objc/runtime.h;
+  select    =   <<- _EOSelect_
+	OBJC_EXPORT void.*
+	objc_enumerateClasses.*
+	.*
+	.*
+	.*
+	.*void \(\^ _Nonnull block.*
+	.*
+	.*
+	.*OBJC_REFINED_FOR_SWIFT.*
+	_EOSelect_;
+  c_fix     = format;
+  c_fix_arg = "#if __BLOCKS__\n%0\n#endif";
+  test_text = <<- _OBJC_RUNTIME_1
+OBJC_EXPORT void
+objc_enumerateClasses(const void * _Nullable image,
+                      const char * _Nullable namePrefix,
+                      Protocol * _Nullable conformingTo,
+                      Class _Nullable subclassing,
+                      void (^ _Nonnull block)(Class _Nonnull aClass, BOOL * _Nonnull stop)
+                      OBJC_NOESCAPE)
+OBJC_AVAILABLE(13.0, 16.0, 16.0, 9.0, 7.0)
+OBJC_REFINED_FOR_SWIFT;
+_OBJC_RUNTIME_1;
+};
+
+
 /*
  *  In Mac OS X 10.1[012] <os/trace.h>, need to guard users of
  *  os_trace_payload_t typedef, too.
diff --git a/fixincludes/tests/base/objc/runtime.h b/fixincludes/tests/base/objc/runtime.h
new file mode 100644
index 00000000000..8b4855bb8ab
--- /dev/null
+++ b/fixincludes/tests/base/objc/runtime.h
@@ -0,0 +1,24 @@
+/*  DO NOT EDIT THIS FILE.
+
+    It has been auto-edited by fixincludes from:
+
+	"fixinc/tests/inc/objc/runtime.h"
+
+    This had to be done to correct non-standard usages in the
+    original, manufacturer supplied header file.  */
+
+
+
+#if defined( DARWIN_OBJC_RUNTIME_1_CHECK )
+#if __BLOCKS__
+OBJC_EXPORT void
+objc_enumerateClasses(const void * _Nullable image,
+                      const char * _Nullable namePrefix,
+                      Protocol * _Nullable conformingTo,
+                      Class _Nullable subclassing,
+                      void (^ _Nonnull block)(Class _Nonnull aClass, BOOL * _Nonnull stop)
+                      OBJC_NOESCAPE)
+OBJC_AVAILABLE(13.0, 16.0, 16.0, 9.0, 7.0)
+OBJC_REFINED_FOR_SWIFT;
+#endif
+#endif  /* DARWIN_OBJC_RUNTIME_1_CHECK */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-21 17:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-21 17:11 [gcc r13-5275] Darwin, fixincludes: Handle Apple Blocks in objc/runtime.h Iain D Sandoe

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