Conditionally compile __unsafe_unretained
Addresses, and hopefully fixes, issue #77.
diff --git a/include/internal/catch_objc.hpp b/include/internal/catch_objc.hpp
index 8d6d23b..cc82778 100644
--- a/include/internal/catch_objc.hpp
+++ b/include/internal/catch_objc.hpp
@@ -33,27 +33,29 @@
id performOptionalSelector( id obj, SEL sel );
#if !CATCH_ARC_ENABLED
-inline void arcSafeRelease( NSObject* obj )
-{
- [obj release];
-}
-inline id performOptionalSelector( id obj, SEL sel )
-{
- if( [obj respondsToSelector: sel] )
- return [obj performSelector: sel];
- return nil;
-}
+ inline void arcSafeRelease( NSObject* obj )
+ {
+ [obj release];
+ }
+ inline id performOptionalSelector( id obj, SEL sel )
+ {
+ if( [obj respondsToSelector: sel] )
+ return [obj performSelector: sel];
+ return nil;
+ }
+ #define CATCH_UNSAFE_UNRETAINED
#else
-inline void arcSafeRelease( NSObject* ){}
-inline id performOptionalSelector( id obj, SEL sel )
-{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
- if( [obj respondsToSelector: sel] )
- return [obj performSelector: sel];
-#pragma clang diagnostic pop
- return nil;
-}
+ inline void arcSafeRelease( NSObject* ){}
+ inline id performOptionalSelector( id obj, SEL sel )
+ {
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
+ if( [obj respondsToSelector: sel] )
+ return [obj performSelector: sel];
+ #pragma clang diagnostic pop
+ return nil;
+ }
+ #define CATCH_UNSAFE_UNRETAINED __unsafe_unretained
#endif
///////////////////////////////////////////////////////////////////////////////
@@ -171,7 +173,7 @@
size_t noTestMethods = 0;
int noClasses = objc_getClassList( NULL, 0 );
- Class* classes = (__unsafe_unretained Class *)malloc( sizeof(Class) * noClasses);
+ Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
objc_getClassList( classes, noClasses );
for( int c = 0; c < noClasses; c++ )