aboutsummaryrefslogtreecommitdiff
path: root/GTMDefines.h
diff options
context:
space:
mode:
authorGravatar thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-01-09 20:34:30 +0000
committerGravatar thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-01-09 20:34:30 +0000
commit4fd103b5de98d2f469b982677ea389e7ee7d64b3 (patch)
treed0eb379fdc78996bc2e201515d26c7521d1fc8dc /GTMDefines.h
parent84d1232477f398339e48ea504c45048e9328ef9b (diff)
- turned off _debug framework support in tests since we now capture a lot more
in log validation. - Added GTM_SUPPORT_GC for controlling the inclusion of GC related code. - If you are using GTMUnitTestDevLog, it also tries to capture logs from NSAssert. - Added GTM_FOREACH_OBJECT/GTM_FOREACH_KEY that uses NSEnumerator and objectEnumerator/keyEnumerator on 10.4, but on 10.5+/iPhone uses FastEnumeration. - GTMNSWorkspace+Running gives a variety of ways of determining the attributes of running processes.
Diffstat (limited to 'GTMDefines.h')
-rw-r--r--GTMDefines.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/GTMDefines.h b/GTMDefines.h
index 5242e88..b41a6c8 100644
--- a/GTMDefines.h
+++ b/GTMDefines.h
@@ -155,6 +155,26 @@ GTM_EXTERN void _GTMUnitTestDevLog(NSString *format, ...);
typedef char _GTMCompileAssertSymbol(__LINE__, msg) [ ((test) ? 1 : -1) ]
#endif // _GTMCompileAssert
+// Macro to allow fast enumeration when building for 10.5 or later, and
+// reliance on NSEnumerator for 10.4. Remember, NSDictionary w/ FastEnumeration
+// does keys, so pick the right thing, nothing is done on the FastEnumeration
+// side to be sure you're getting what you wanted.
+#ifndef GTM_FOREACH_OBJECT
+ #if defined(TARGET_OS_IPHONE) || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
+ #define GTM_FOREACH_OBJECT(element, collection) \
+ for (element in collection)
+ #define GTM_FOREACH_KEY(element, collection) \
+ for (element in collection)
+ #else
+ #define GTM_FOREACH_OBJECT(element, collection) \
+ for (NSEnumerator * _ ## element ## _enum = [collection objectEnumerator]; \
+ (element = [_ ## element ## _enum nextObject]) != nil; )
+ #define GTM_FOREACH_KEY(element, collection) \
+ for (NSEnumerator * _ ## element ## _enum = [collection keyEnumerator]; \
+ (element = [_ ## element ## _enum nextObject]) != nil; )
+ #endif
+#endif
+
// ============================================================================
// ----------------------------------------------------------------------------
@@ -179,6 +199,23 @@ GTM_EXTERN void _GTMUnitTestDevLog(NSString *format, ...);
#define GTM_MACOS_SDK 1
#endif
+// Provide a symbol to include/exclude extra code for GC support. (This mainly
+// just controls the inclusion of finalize methods).
+#ifndef GTM_SUPPORT_GC
+ #if GTM_IPHONE_SDK
+ // iPhone never needs GC
+ #define GTM_SUPPORT_GC 0
+ #else
+ // We can't find a symbol to tell if GC is supported/required, so best we
+ // do on Mac targets is include it if we're on 10.5 or later.
+ #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
+ #define GTM_SUPPORT_GC 0
+ #else
+ #define GTM_SUPPORT_GC 1
+ #endif
+ #endif
+#endif
+
// To simplify support for 64bit (and Leopard in general), we provide the type
// defines for non Leopard SDKs
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4