From 2d976b61e2bd491cfc8c506b96589f56e7e4188a Mon Sep 17 00:00:00 2001 From: Frederik Seiffert Date: Fri, 26 Mar 2021 18:06:36 +0100 Subject: [PATCH] Export objc_enumerationMutation() function. --- mutation.m | 1 + objc/runtime.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/mutation.m b/mutation.m index 867cbb7..dfb12a0 100644 --- a/mutation.m +++ b/mutation.m @@ -4,6 +4,7 @@ // This function is exported as a weak symbol to enable GNUstep or some other // framework to replace it trivially +OBJC_PUBLIC void __attribute__((weak)) objc_enumerationMutation(id obj) { fprintf(stderr, "Mutation occured during enumeration."); diff --git a/objc/runtime.h b/objc/runtime.h index 99a6e8c..979562c 100644 --- a/objc/runtime.h +++ b/objc/runtime.h @@ -1150,6 +1150,14 @@ id object_getPrototype_np(id object); OBJC_PUBLIC int objc_set_apple_compatible_objcxx_exceptions(int newValue) OBJC_NONPORTABLE; +/** + * This function is inserted by the compiler when a mutation is detected during + * a foreach iteration. It is exported as a weak symbol to enable GNUstep or + * some other framework to replace it trivially. + */ +OBJC_PUBLIC +void __attribute__((weak)) objc_enumerationMutation(id obj); + #define _C_ID '@' #define _C_CLASS '#'