From patchwork Sat Oct 9 22:23:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Pero X-Patchwork-Id: 67333 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id D9A56B70AE for ; Sun, 10 Oct 2010 09:23:18 +1100 (EST) Received: (qmail 21772 invoked by alias); 9 Oct 2010 22:23:15 -0000 Received: (qmail 21757 invoked by uid 22791); 9 Oct 2010 22:23:13 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL, BAYES_00, TW_BJ, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 09 Oct 2010 22:23:08 +0000 Received: from eggs.gnu.org ([140.186.70.92]:39573) by fencepost.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1P4hoo-0007mh-Su for gcc-patches@gnu.org; Sat, 09 Oct 2010 18:23:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P4hon-0001Xg-Bh for gcc-patches@gnu.org; Sat, 09 Oct 2010 18:23:06 -0400 Received: from smtp181.iad.emailsrvr.com ([207.97.245.181]:53133) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P4hon-0001Xb-5O for gcc-patches@gnu.org; Sat, 09 Oct 2010 18:23:05 -0400 Received: from relay28.relay.iad.mlsrvr.com (localhost [127.0.0.1]) by relay28.relay.iad.mlsrvr.com (SMTP Server) with ESMTP id AED201B4154 for ; Sat, 9 Oct 2010 18:23:04 -0400 (EDT) Received: from dynamic5.wm-web.iad.mlsrvr.com (dynamic5.wm-web.iad.mlsrvr.com [192.168.2.146]) by relay28.relay.iad.mlsrvr.com (SMTP Server) with ESMTP id A8C3E1B4150 for ; Sat, 9 Oct 2010 18:23:04 -0400 (EDT) Received: from meta-innovation.com (localhost [127.0.0.1]) by dynamic5.wm-web.iad.mlsrvr.com (Postfix) with ESMTP id 87C878D0505 for ; Sat, 9 Oct 2010 18:23:04 -0400 (EDT) Received: by www2.webmail.us (Authenticated sender: nicola.pero@meta-innovation.com, from: nicola.pero@meta-innovation.com) with HTTP; Sun, 10 Oct 2010 00:23:04 +0200 (CEST) Date: Sun, 10 Oct 2010 00:23:04 +0200 (CEST) Subject: libobjc - more header reorganization From: "Nicola Pero" To: "gcc-patches@gnu.org" MIME-Version: 1.0 X-Type: plain Message-ID: <1286662984.55394416@192.168.2.227> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch makes some more changes to libobjc along the lines of the header reorganization we're pursuing. Committed to trunk. Thanks Index: sendmsg.c =================================================================== --- sendmsg.c (revision 165239) +++ sendmsg.c (working copy) @@ -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. */ Index: Makefile.in =================================================================== --- Makefile.in (revision 165239) +++ Makefile.in (working copy) @@ -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 \ Index: objc-foreach.c =================================================================== --- objc-foreach.c (revision 165239) +++ objc-foreach.c (working copy) @@ -27,8 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respect objc_set_enumeration_mutation_handler(), the two functions required to handle mutations during a fast enumeration. */ +#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() */ -#include "objc-private/error.h" /* For _objc_abort() */ /* The enumeration mutation handler currently in use. */ static void (*__objc_enumeration_mutation_handler)(id) = NULL; Index: ChangeLog =================================================================== --- ChangeLog (revision 165239) +++ ChangeLog (working copy) @@ -1,3 +1,17 @@ +2010-10-10 Nicola Pero + + * 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 * objc/objc-api.h (struct objc_super, Super, Super_t, Index: Object.m =================================================================== --- Object.m (revision 165239) +++ Object.m (working copy) @@ -172,14 +172,14 @@ see the files COPYING3 and COPYING.RUNTIME respect + (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 Index: objc/deprecated/METHOD_NULL.h =================================================================== --- objc/deprecated/METHOD_NULL.h (revision 0) +++ objc/deprecated/METHOD_NULL.h (revision 0) @@ -0,0 +1,2 @@ +/* For functions which return Method_t */ +#define METHOD_NULL (Method_t)0 Index: objc/objc-api.h =================================================================== --- objc/objc-api.h (revision 165239) +++ objc/objc-api.h (working copy) @@ -40,9 +40,8 @@ see the files COPYING3 and COPYING.RUNTIME respect 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 _cla 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);