summaryrefslogtreecommitdiff
path: root/libobjc
diff options
context:
space:
mode:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-09 22:22:23 +0000
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-09 22:22:23 +0000
commit83b8166b952e51101aa2873b28415b04716d5e5d (patch)
tree4c22a690a34cb9deabdd429ff045afebaf9343b9 /libobjc
parent5be42b3963507aba2ab5946c590b70d9bd3a1e25 (diff)
downloadgcc-83b8166b952e51101aa2873b28415b04716d5e5d.tar.gz
In libobjc/:
2010-10-10 Nicola Pero <nicola.pero@meta-innovation.com> * objc-foreach.c: Include objc-private/common.h. * objc/deprecated/METHOD_NULL.h: New file. * objc/objc-api.h: Include deprecated/METHOD_NULL.h instead of defining METHOD_NULL here. * Makefile.in (OBJC_DEPRECATED_H): Added METHOD_NULL.h. * Object.m ([+instancesRespondTo:]): Use (Method_t)0 instead of METHOD_NULL. ([-respondsTo:]): Same change. * objc/objc-api.h (method_get_imp): Converted it into a normal function so that we can hide the internals of struct objc_method. * sendmsg.c (method_get_imp): Implemented. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165241 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc')
-rw-r--r--libobjc/ChangeLog14
-rw-r--r--libobjc/Makefile.in1
-rw-r--r--libobjc/Object.m4
-rw-r--r--libobjc/objc-foreach.c3
-rw-r--r--libobjc/objc/deprecated/METHOD_NULL.h2
-rw-r--r--libobjc/objc/objc-api.h11
-rw-r--r--libobjc/sendmsg.c7
7 files changed, 31 insertions, 11 deletions
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index 63c2a6410b1..f388a68bce9 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,17 @@
+2010-10-10 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * objc-foreach.c: Include objc-private/common.h.
+ * objc/deprecated/METHOD_NULL.h: New file.
+ * objc/objc-api.h: Include deprecated/METHOD_NULL.h instead of
+ defining METHOD_NULL here.
+ * Makefile.in (OBJC_DEPRECATED_H): Added METHOD_NULL.h.
+ * Object.m ([+instancesRespondTo:]): Use (Method_t)0 instead of
+ METHOD_NULL.
+ ([-respondsTo:]): Same change.
+ * objc/objc-api.h (method_get_imp): Converted it into a normal
+ function so that we can hide the internals of struct objc_method.
+ * sendmsg.c (method_get_imp): Implemented.
+
2010-10-09 Nicola Pero <nicola.pero@meta-innovation.com>
* objc/objc-api.h (struct objc_super, Super, Super_t,
diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in
index d99ab26a0a6..25d60770888 100644
--- a/libobjc/Makefile.in
+++ b/libobjc/Makefile.in
@@ -131,6 +131,7 @@ OBJC_H = \
# User-visible header files containing deprecated APIs, from the
# objc/deprecated directory
OBJC_DEPRECATED_H = \
+ METHOD_NULL.h \
MetaClass.h \
Object.h \
STR.h \
diff --git a/libobjc/Object.m b/libobjc/Object.m
index 3a5bcb31688..441c471b2a1 100644
--- a/libobjc/Object.m
+++ b/libobjc/Object.m
@@ -172,14 +172,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ (BOOL)instancesRespondTo:(SEL)aSel
{
- return class_get_instance_method(self, aSel)!=METHOD_NULL;
+ return class_get_instance_method(self, aSel) != (Method_t)0;
}
- (BOOL)respondsTo:(SEL)aSel
{
return ((object_is_instance(self)
?class_get_instance_method(self->isa, aSel)
- :class_get_class_method(self->isa, aSel))!=METHOD_NULL);
+ :class_get_class_method(self->isa, aSel)) != (Method_t)0);
}
+ (IMP)instanceMethodFor:(SEL)aSel
diff --git a/libobjc/objc-foreach.c b/libobjc/objc-foreach.c
index 83a91011d12..a06a77ec8e5 100644
--- a/libobjc/objc-foreach.c
+++ b/libobjc/objc-foreach.c
@@ -27,8 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
objc_set_enumeration_mutation_handler(), the two functions required
to handle mutations during a fast enumeration.
*/
-#include "objc/runtime.h" /* For objc_enumerationMutation() and objc_set_enumeration_mutation_handler() */
+#include "objc-private/common.h"
#include "objc-private/error.h" /* For _objc_abort() */
+#include "objc/runtime.h" /* For objc_enumerationMutation() and objc_set_enumeration_mutation_handler() */
/* The enumeration mutation handler currently in use. */
static void (*__objc_enumeration_mutation_handler)(id) = NULL;
diff --git a/libobjc/objc/deprecated/METHOD_NULL.h b/libobjc/objc/deprecated/METHOD_NULL.h
new file mode 100644
index 00000000000..6912be345e1
--- /dev/null
+++ b/libobjc/objc/deprecated/METHOD_NULL.h
@@ -0,0 +1,2 @@
+/* For functions which return Method_t */
+#define METHOD_NULL (Method_t)0
diff --git a/libobjc/objc/objc-api.h b/libobjc/objc/objc-api.h
index ff457f2cec7..5f9043086b7 100644
--- a/libobjc/objc/objc-api.h
+++ b/libobjc/objc/objc-api.h
@@ -40,9 +40,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
extern "C" {
#endif /* __cplusplus */
-/* For functions which return Method_t */
-#define METHOD_NULL (Method_t)0
- /* Boolean typedefs */
+#include "deprecated/METHOD_NULL.h"
+
/* Method descriptor returned by introspective Object methods.
This is really just the first part of the more complete objc_method
structure defined below and used internally by the runtime. */
@@ -441,11 +440,7 @@ extern void class_ivar_set_gcinvisible (Class _class,
const char* ivarname,
BOOL gcInvisible);
-static inline IMP
-method_get_imp(Method_t method)
-{
- return (method!=METHOD_NULL)?method->method_imp:(IMP)0;
-}
+objc_EXPORT IMP method_get_imp(Method_t method);
objc_EXPORT IMP get_imp (Class _class, SEL sel);
diff --git a/libobjc/sendmsg.c b/libobjc/sendmsg.c
index 621d5314d37..a822af4a31a 100644
--- a/libobjc/sendmsg.c
+++ b/libobjc/sendmsg.c
@@ -194,6 +194,13 @@ get_imp (Class class, SEL sel)
return res;
}
+/* Given a method, return its implementation. */
+IMP
+method_get_imp (Method_t method)
+{
+ return (method != (Method_t)0) ? method->method_imp : (IMP)0;
+}
+
/* Query if an object can respond to a selector, returns YES if the
object implements the selector otherwise NO. Does not check if the
method can be forwarded. */