From patchwork Sun Dec 19 02:13:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Pero X-Patchwork-Id: 76111 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 7A0E0B70B0 for ; Sun, 19 Dec 2010 13:13:17 +1100 (EST) Received: (qmail 26213 invoked by alias); 19 Dec 2010 02:13:15 -0000 Received: (qmail 26199 invoked by uid 22791); 19 Dec 2010 02:13:14 -0000 X-SWARE-Spam-Status: No, hits=0.0 required=5.0 tests=AWL, BAYES_50, SARE_SUB_ENC_UTF8, 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; Sun, 19 Dec 2010 02:13:07 +0000 Received: from eggs.gnu.org ([140.186.70.92]:34173) by fencepost.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1PU8li-0003Lh-5a for gcc-patches@gnu.org; Sat, 18 Dec 2010 21:13:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PU8lj-0006DQ-3g for gcc-patches@gnu.org; Sat, 18 Dec 2010 21:13:04 -0500 Received: from smtp131.iad.emailsrvr.com ([207.97.245.131]:36470) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PU8li-0006DK-Su for gcc-patches@gnu.org; Sat, 18 Dec 2010 21:13:03 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp33.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id 5A788303A1 for ; Sat, 18 Dec 2010 21:13:02 -0500 (EST) Received: from dynamic2.wm-web.iad.mlsrvr.com (dynamic2.wm-web.iad1a.rsapps.net [192.168.2.151]) by smtp33.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id 4A0093039C for ; Sat, 18 Dec 2010 21:13:00 -0500 (EST) Received: from meta-innovation.com (localhost [127.0.0.1]) by dynamic2.wm-web.iad.mlsrvr.com (Postfix) with ESMTP id 25A7028E8066 for ; Sat, 18 Dec 2010 21:13:00 -0500 (EST) Received: by www2.webmail.us (Authenticated sender: nicola.pero@meta-innovation.com, from: nicola.pero@meta-innovation.com) with HTTP; Sun, 19 Dec 2010 03:13:00 +0100 (CET) Date: Sun, 19 Dec 2010 03:13:00 +0100 (CET) Subject: =?UTF-8?Q?libobjc:=20header=20cleanup=20for=20new=20API=20(6)?= From: "Nicola Pero" To: "gcc-patches@gnu.org" MIME-Version: 1.0 X-Type: plain Message-ID: <1292724780.152826388@192.168.2.229> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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 adds a declaration of a hook that was available in the old API and should be available in the new API as well, but I had forgotten to declare it in the headers. :-( Committed to trunk. Thanks Index: init.c =================================================================== --- init.c (revision 168043) +++ init.c (working copy) @@ -83,11 +83,7 @@ /* Add protocol to class. */ static void __objc_class_add_protocols (Class, struct objc_protocol_list *); -/* This is a hook which is called by __objc_exec_class every time a - class or a category is loaded into the runtime. This may e.g. help - a dynamic loader determine the classes that have been loaded when - an object file is dynamically linked in. */ -/* TODO: This needs to be declared in a public file with the new API. */ +/* Load callback hook. */ void (*_objc_load_callback) (Class class, struct objc_category *category); /* !T:SAFE */ /* Are all categories/classes resolved? */ @@ -724,6 +720,10 @@ objc_send_load (); objc_mutex_unlock (__objc_runtime_mutex); + + /* TODO: Do we need to add a call to __objc_resolve_class_links() + here ? gnustep-base does it manually after it loads a module. + Shouldn't we do it automatically ? */ } static void Index: ChangeLog =================================================================== --- ChangeLog (revision 168043) +++ ChangeLog (working copy) @@ -1,5 +1,11 @@ 2010-12-19 Nicola Pero + * init.c: Updated comments. + * objc/objc-api.h: Updated comments. + * objc/runtime.h (_objc_load_callback): Declare. + +2010-12-19 Nicola Pero + * objc/Object.h: Include deprecated/typedstream.h and deprecated/hash.h instead of typedstream.h. Updated comments. Index: objc/runtime.h =================================================================== --- objc/runtime.h (revision 168043) +++ objc/runtime.h (working copy) @@ -876,7 +876,15 @@ /* TODO: Add all the other functions in the API. */ +/** Implementation: the following hook is in init.c. */ +/* This is a hook which is called by __objc_exec_class every time a + class or a category is loaded into the runtime. This may e.g. help + a dynamic loader determine the classes that have been loaded when + an object file is dynamically linked in. */ +objc_EXPORT void (*_objc_load_callback)(Class _class, struct objc_category *category); + + /** Implementation: the following functions are in objc-foreach.c. */ /* 'objc_enumerationMutation()' is called when a collection is Index: objc/objc-api.h =================================================================== --- objc/objc-api.h (revision 168043) +++ objc/objc-api.h (working copy) @@ -26,25 +26,28 @@ #ifndef __objc_api_INCLUDE_GNU #define __objc_api_INCLUDE_GNU -/* - This file declares the "traditional" GNU Objective-C Runtime API. - It is the API supported by older versions of the GNU Objective-C - Runtime. Include this file to use it. +/* This file declares the "traditional" GNU Objective-C Runtime API. + It is the API supported by older versions of the GNU Objective-C + Runtime. Include this file to use it. - This API is being replaced by the "modern" GNU Objective-C Runtime - API, which is declared in objc/runtime.h. The "modern" API is very - similar to the API used by the modern Apple/NeXT runtime. + This API is being replaced by the "modern" GNU Objective-C Runtime + API, which is declared in objc/runtime.h. The "modern" API is very + similar to the API used by the modern Apple/NeXT runtime. - Because the two APIs have some conflicting definitions (in - particular, Method and Category are defined differently) you should - include either objc/objc-api.h (to use the traditional GNU - Objective-C Runtime API) or objc/runtime.h (to use the modern GNU - Objective-C Runtime API), but not both. -*/ + The last version of GCC supporting the traditional API is GCC 4.6. + This file will not exist in later versions of GCC. + + Because the two APIs have some conflicting definitions (in + particular, Method and Category are defined differently) you should + include either objc/objc-api.h (to use the traditional GNU + Objective-C Runtime API) or objc/runtime.h (to use the modern GNU + Objective-C Runtime API), but not both. */ #ifdef __objc_runtime_INCLUDE_GNU # error You can not include both objc/objc-api.h and objc/runtime.h. Include objc/objc-api.h for the traditional GNU Objective-C Runtime API and objc/runtime.h for the modern one. #endif +/* TODO: A deprecation warning any time the file is included ? */ + #include "objc.h" #ifndef GNU_LIBOBJC_COMPILING_LIBOBJC_ITSELF # include "deprecated/hash.h" @@ -182,6 +185,8 @@ ** objc_get_class if the runtime is not able to find the class. ** This may e.g. try to load in the class using dynamic loading. ** The function is guaranteed to be passed a non-NULL name string. +** In the Modern API, this is replaced by +** objc_setGetUnknownClassHandler (). */ objc_EXPORT Class (*_objc_lookup_class)(const char *name);