aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMObjC2Runtime.h
diff options
context:
space:
mode:
authorGravatar dmaclach <dmaclach@google.com>2016-10-07 12:10:23 -0400
committerGravatar Thomas Van Lenten <thomasvl@google.com>2016-10-07 12:21:06 -0400
commit42124b3691197c3c4f52f069775fa0390a8ff942 (patch)
treeebd373d398ea64b45bdc1d196fa0a2c5f57cabfd /Foundation/GTMObjC2Runtime.h
parent57eeab4193210df8ab0c81e9d3f1ee1ad3e24492 (diff)
First cut at pruning things/updating things.
Remove a bunch of code that Google stopped using/maintaining rather than trying to update it it. Some would be hard to update, some actually has system provided replacements; others are patterns that just don't seem as common now. Prune out the code related to macOS <= 10.5, start pruning some of the really old iOS support also. Get the projects mostly limping again with modern Xcodes so tests can be run. If someone ends up on this commit via history for something they still find as useful, feel free to do a pull request to bring the snippet of code back to life and update it for current SDKs.
Diffstat (limited to 'Foundation/GTMObjC2Runtime.h')
-rw-r--r--Foundation/GTMObjC2Runtime.h90
1 files changed, 4 insertions, 86 deletions
diff --git a/Foundation/GTMObjC2Runtime.h b/Foundation/GTMObjC2Runtime.h
index e4e2ac7..e14df70 100644
--- a/Foundation/GTMObjC2Runtime.h
+++ b/Foundation/GTMObjC2Runtime.h
@@ -16,98 +16,16 @@
// the License.
//
+// These headers only being pulled in to avoid breaking changes.
+
+#pragma GCC warning "GTMObjcRuntime.h is deprecated and should no longer be used."
+
#import <objc/objc-api.h>
#import <objc/objc-auto.h>
#import "GTMDefines.h"
-// These functions exist for code that we want to compile on both the < 10.5
-// sdks and on the >= 10.5 sdks without warnings. It basically reimplements
-// certain parts of the objc2 runtime in terms of the objc1 runtime. It is not
-// a complete implementation as I've only implemented the routines I know we
-// use. Feel free to add more as necessary.
-// These functions are not documented because they conform to the documentation
-// for the ObjC2 Runtime.
-
-#if OBJC_API_VERSION >= 2 // Only have optional and req'd keywords in ObjC2.
-#define AT_OPTIONAL @optional
-#define AT_REQUIRED @required
-#else
-#define AT_OPTIONAL
-#define AT_REQUIRED
-#endif
-
-// The file objc-runtime.h was moved to runtime.h and in Leopard, objc-runtime.h
-// was just a wrapper around runtime.h. For the iPhone SDK, this objc-runtime.h
-// is removed in the iPhoneOS2.0 SDK.
-//
-// The |Object| class was removed in the iPhone2.0 SDK too.
-#if GTM_IPHONE_SDK
#import <objc/message.h>
#import <objc/runtime.h>
-#else
-#import <objc/objc-runtime.h>
-#import <objc/Object.h>
-#endif
#import <libkern/OSAtomic.h>
-#if GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
-#import "objc/Protocol.h"
-
-OBJC_EXPORT Class object_getClass(id obj);
-OBJC_EXPORT const char *class_getName(Class cls);
-OBJC_EXPORT BOOL class_conformsToProtocol(Class cls, Protocol *protocol);
-OBJC_EXPORT BOOL class_respondsToSelector(Class cls, SEL sel);
-OBJC_EXPORT Class class_getSuperclass(Class cls);
-OBJC_EXPORT Method *class_copyMethodList(Class cls, unsigned int *outCount);
-OBJC_EXPORT SEL method_getName(Method m);
-OBJC_EXPORT void method_exchangeImplementations(Method m1, Method m2);
-OBJC_EXPORT IMP method_getImplementation(Method method);
-OBJC_EXPORT IMP method_setImplementation(Method method, IMP imp);
-OBJC_EXPORT struct objc_method_description protocol_getMethodDescription(Protocol *p,
- SEL aSel,
- BOOL isRequiredMethod,
- BOOL isInstanceMethod);
-OBJC_EXPORT BOOL sel_isEqual(SEL lhs, SEL rhs);
-
-// If building for 10.4 but using the 10.5 SDK, don't include these.
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
-// atomics
-// On Leopard these are GC aware
-// Intentionally did not include the non-barrier versions, because I couldn't
-// come up with a case personally where you wouldn't want to use the
-// barrier versions.
-GTM_INLINE bool OSAtomicCompareAndSwapPtrBarrier(void *predicate,
- void *replacement,
- void * volatile *theValue) {
-#if defined(__LP64__) && __LP64__
- return OSAtomicCompareAndSwap64Barrier((int64_t)predicate,
- (int64_t)replacement,
- (int64_t *)theValue);
-#else // defined(__LP64__) && __LP64__
- return OSAtomicCompareAndSwap32Barrier((int32_t)predicate,
- (int32_t)replacement,
- (int32_t *)theValue);
-#endif // defined(__LP64__) && __LP64__
-}
-
-#endif // MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
-#endif // GTM_MACOS_SDK && (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
-
-#if GTM_MACOS_SDK && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
-
-GTM_INLINE BOOL objc_atomicCompareAndSwapGlobalBarrier(id predicate,
- id replacement,
- volatile id *objectLocation) {
- return OSAtomicCompareAndSwapPtrBarrier(predicate,
- replacement,
- (void * volatile *)objectLocation);
-}
-GTM_INLINE BOOL objc_atomicCompareAndSwapInstanceVariableBarrier(id predicate,
- id replacement,
- volatile id *objectLocation) {
- return OSAtomicCompareAndSwapPtrBarrier(predicate,
- replacement,
- (void * volatile *)objectLocation);
-}
-#endif // GTM_MACOS_SDK && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)