diff --git a/Source/NSEnumerator.m b/Source/NSEnumerator.m index cf6735b33..96ca2e365 100644 --- a/Source/NSEnumerator.m +++ b/Source/NSEnumerator.m @@ -97,12 +97,3 @@ - (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state } @end -/** - * objc_enumerationMutation() is called whenever a collection mutates in the - * middle of fast enumeration. - */ -void objc_enumerationMutation(id obj) -{ - [NSException raise: NSGenericException - format: @"Collection %@ was mutated while being enumerated", obj]; -} diff --git a/Source/NSObject.m b/Source/NSObject.m index eb74ca365..4ee876b9a 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -83,6 +83,16 @@ #endif #endif +/* objc_enumerationMutation() is called whenever a collection mutates in the + * middle of fast enumeration. We need to have this defined and linked into + * any code that uses fast enumeration, so we define it in NSObject.h + */ +void objc_enumerationMutation(id obj) +{ + [NSException raise: NSGenericException + format: @"Collection %@ was mutated while being enumerated", obj]; +} + /* platforms which do not support weak */ #if defined (__WIN32) #define WEAK_ATTRIBUTE