Patchwork =?UTF-8?Q?libobjc:=20header=20cleanup=20for=20the=20new=20API=20(2)?=

login
register
mail settings
Submitter Nicola Pero
Date Dec. 19, 2010, 12:54 a.m.
Message ID <1292720071.999819931@192.168.2.229>
Download mbox | patch
Permalink /patch/76106/
State New
Headers show

Comments

Nicola Pero - Dec. 19, 2010, 12:54 a.m.
This moves all methods of the Protocol class into a "Deprecated" category
(the new API isn't supposed to have them, like the Apple/NeXT API; but
I had forgotten to update the files).

Note that I haven't marked anything with __attribute__((deprecated)) (not
just in Protocol.h, everywhere).  It seems that it would be the right thing
to do, but there would be fallouts on the testsuite.  I'll ignore that for
now and maybe do it last for all methods/functions.

Committed to trunk.

Thanks

Patch

Index: Makefile.in
===================================================================
--- Makefile.in (revision 168039)
+++ Makefile.in (working copy)
@@ -135,6 +135,7 @@  OBJC_DEPRECATED_H = \
   METHOD_NULL.h \
   MetaClass.h \
   Object.h \
+  Protocol.h \
   STR.h \
   hash.h \
   objc-list.h \
Index: Protocol.m
===================================================================
--- Protocol.m  (revision 168034)
+++ Protocol.m  (working copy)
@@ -27,9 +27,15 @@ 
 #include "objc-private/module-abi-8.h"
 #include "objc/Protocol.h"
 
-
 @implementation Protocol
+- (BOOL) isEqual: (id)obj
+{
+  return protocol_isEqual (self, obj);
+}
+@end
 
+@implementation Protocol (Deprecated)
+
 - (const char *)name
 {
   return protocol_name;
@@ -97,9 +103,8 @@ 
 - (unsigned) hash
 {
   /* Compute a hash of the protocol_name; use the same hash algorithm
-   * that we use for class names; protocol names and class names are
-   * somewhat similar types of string spaces.
-   */
+     that we use for class names; protocol names and class names are
+     somewhat similar types of string spaces.  */
   int hash = 0, index;
   
   for (index = 0; protocol_name[index] != '\0'; index++)
@@ -112,9 +117,4 @@ 
   return hash;
 }
 
-- (BOOL) isEqual: (id)obj
-{
-  return protocol_isEqual (self, obj);
-}
 @end
-
Index: ChangeLog
===================================================================
--- ChangeLog   (revision 168039)
+++ ChangeLog   (working copy)
@@ -1,5 +1,13 @@ 
 2010-12-19  Nicola Pero  <nicola.pero@meta-innovation.com>
 
+       * Protocol.m: Moved all methods, with the exception of -isEqual:,
+       into the 'Deprecated' category.
+       * objc/Protocol.h: Removed all methods, moved to
+       objc/deprecated/Protocol.h.  Include objc/deprecated/Protocol.h.
+       * objc/deprecated/Protocol.h: New.
+       * Makefile.in (OBJC_DEPRECATED_H): Added Protocol.h.
+       
+2010-12-19  Nicola Pero  <nicola.pero@meta-innovation.com>
+
        * init.c: Include objc-private/selector.h.  Do not declare
        __sel_register_typed_name.
        * objc-private/selector.h (__sel_register_typed_name): Declare.
Index: objc/Protocol.h
===================================================================
--- objc/Protocol.h     (revision 168034)
+++ objc/Protocol.h     (working copy)
@@ -39,25 +39,16 @@ 
   struct objc_protocol_list *protocol_list;
   struct objc_method_description_list *instance_methods, *class_methods; 
 }
+@end
 
-/* The following methods have been replaced by
+/* The Protocol methods have been replaced by
      protocol_getName()
      protocol_conformsToProtocol()
      protocol_getMethodDescription()
 */
 
-/* Obtaining attributes intrinsic to the protocol */
-- (const char *)name;
+#include "deprecated/Protocol.h"
 
-/* Testing protocol conformance */
-- (BOOL) conformsTo: (Protocol *)aProtocolObject;
-
-/* Looking up information specific to a protocol */
-- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;
-- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel;
-
-@end
-
 #ifdef __cplusplus
 }
 #endif
Index: objc/deprecated/Protocol.h
===================================================================
--- objc/deprecated/Protocol.h  (revision 0)
+++ objc/deprecated/Protocol.h  (revision 0)
@@ -0,0 +1,13 @@ 
+/* The following methods were deprecated in GCC 4.6.0 and will be
+   removed in the next GCC release.  */
+@interface Protocol (Deprecated)
+/* Obtaining attributes intrinsic to the protocol */
+- (const char *)name;
+
+/* Testing protocol conformance */
+- (BOOL) conformsTo: (Protocol *)aProtocolObject;
+
+/* Looking up information specific to a protocol */
+- (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel;
+- (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel;
+@end