ObjC/ObjC++/testsuite: Remove unused method_get_* functions from next-encode-assist files

Nicola Pero nicola.pero@meta-innovation.com
Wed Jun 8 22:32:00 GMT 2011


This patch removes a number of functions from the ObjC/ObjC++ testsuite next-encode-assist
files which are never used in the testsuite ... and will never be, since they have been removed
from the GNU runtime. ;-)

The next-encode-assist provides a compatible implementation for the NeXT runtime of some
special GNU runtime functions.  There is obviously no point in providing an implementation
of functions that have been removed and are never used.

OK to commit ?

Thanks

Index: ChangeLog
===================================================================
--- ChangeLog   (revision 174812)
+++ ChangeLog   (working copy)
@@ -1,3 +1,21 @@
+2011-06-08  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       * objc-obj-c++-shared/objc-test-suite-next-encode-assist.h
+       (PMETH, arglist_t): Removed.
+       (method_get_number_of_arguments): Removed.      
+       (method_get_nth_argument): Removed.
+       (method_get_first_argument): Removed.
+       (method_get_next_argument): Removed.
+       (method_get_sizeof_arguments): Removed.
+       * objc-obj-c++-shared/objc-test-suite-next-encode-assist-impl.h
+       (PMETH): Removed.
+       (method_get_number_of_arguments): Removed.
+       (method_get_nth_argument): Removed.
+       (method_get_first_argument): Removed.
+       (method_get_next_argument): Removed.
+       (method_get_sizeof_arguments): Removed. 
+       * objc-obj-c++-shared/objc-test-suite-types.h (PMETH): Removed.
+       
 2011-06-08  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        PR middle-end/21953
Index: objc-obj-c++-shared/objc-test-suite-next-encode-assist-impl.h
===================================================================
--- objc-obj-c++-shared/objc-test-suite-next-encode-assist-impl.h       (revision 174812)
+++ objc-obj-c++-shared/objc-test-suite-next-encode-assist-impl.h       (working copy)
@@ -7,10 +7,8 @@
 #include "next-abi.h"
 #ifdef NEXT_OBJC_USE_NEW_INTERFACE
 #include <objc/runtime.h>
-typedef void * PMETH;
 #else
 #include <objc/objc-runtime.h>
-typedef struct objc_method * PMETH;
 #endif
 
 /* ---- */
@@ -486,136 +484,7 @@ objc_skip_argspec (const char *type)
   type = objc_skip_offset (type);
   return type;
 }
-/*
-  Return the number of arguments that the method MTH expects.
-  Note that all methods need two implicit arguments `self' and
-  `_cmd'.
-*/
-int
-method_get_number_of_arguments (PMETH mth)
-{
-  int i = 0;
-#ifdef NEXT_OBJC_USE_NEW_INTERFACE
-  const char *type = method_getTypeEncoding((Method)mth);
-#else
-  const char *type = mth->method_types;
-#endif
-  while (*type)
-    {
-      type = objc_skip_argspec (type);
-      i += 1;
-    }
-  return i - 1;
-}
 
-/*
-  Return the size of the argument block needed on the stack to invoke
-  the method MTH.  This may be zero, if all arguments are passed in
-  registers.
-*/
-
-int
-method_get_sizeof_arguments (PMETH mth)
-{
-#ifdef NEXT_OBJC_USE_NEW_INTERFACE
-  const char *type = objc_skip_typespec (method_getTypeEncoding((Method)mth));
-#else
-  const char *type = objc_skip_typespec (mth->method_types);
-#endif
-  return atoi (type);
-}
-
-/*
-  Return a pointer to the next argument of ARGFRAME.  type points to
-  the last argument.  Typical use of this look like:
-
-  {
-    char *datum, *type;
-    for (datum = method_get_first_argument (method, argframe, &type);
-         datum; datum = method_get_next_argument (argframe, &type))
-      {
-        unsigned flags = objc_get_type_qualifiers (type);
-        type = objc_skip_type_qualifiers (type);
-       if (*type != _C_PTR)
-          [portal encodeData: datum ofType: type];
-       else
-         {
-           if ((flags & _F_IN) == _F_IN)
-              [portal encodeData: *(char **) datum ofType: ++type];
-         }
-      }
-  }
-*/
-
-char *
-method_get_next_argument (arglist_t argframe, const char **type)
-{
-  const char *t = objc_skip_argspec (*type);
-
-  if (*t == '\0')
-    return 0;
-
-  *type = t;
-  t = objc_skip_typespec (t);
-
-  if (*t == '+')
-    return argframe->arg_regs + atoi (++t);
-  else
-    return argframe->arg_ptr + atoi (t);
-}
-
-/*
-  Return a pointer to the value of the first argument of the method
-  described in M with the given argumentframe ARGFRAME.  The type
-  is returned in TYPE.  type must be passed to successive calls of
-  method_get_next_argument.
-*/
-char *
-method_get_first_argument (PMETH m,
-                          arglist_t argframe,
-                          const char **type)
-{
-#ifdef NEXT_OBJC_USE_NEW_INTERFACE
-  *type = method_getTypeEncoding((Method)m);
-#else
-  *type = m->method_types;
-#endif
-
-  return method_get_next_argument (argframe, type);
-}
-
-/*
-   Return a pointer to the ARGth argument of the method
-   M from the frame ARGFRAME.  The type of the argument
-   is returned in the value-result argument TYPE
-*/
-
-char *
-method_get_nth_argument (PMETH m,
-                        arglist_t argframe, int arg,
-                        const char **type)
-{
-#ifdef NEXT_OBJC_USE_NEW_INTERFACE
-  const char *t = objc_skip_argspec (method_getTypeEncoding((Method)m));
-#else
-  const char *t = objc_skip_argspec (m->method_types);
-#endif
-
-  if (arg > method_get_number_of_arguments (m))
-    return 0;
-
-  while (arg--)
-    t = objc_skip_argspec (t);
-
-  *type = t;
-  t = objc_skip_typespec (t);
-
-  if (*t == '+')
-    return argframe->arg_regs + atoi (++t);
-  else
-    return argframe->arg_ptr + atoi (t);
-}
-
 unsigned
 objc_get_type_qualifiers (const char *type)
 {
Index: objc-obj-c++-shared/objc-test-suite-next-encode-assist.h
===================================================================
--- objc-obj-c++-shared/objc-test-suite-next-encode-assist.h    (revision 174812)
+++ objc-obj-c++-shared/objc-test-suite-next-encode-assist.h    (working copy)
@@ -6,10 +6,8 @@
 #include "next-abi.h"
 #ifdef NEXT_OBJC_USE_NEW_INTERFACE
 #include <objc/runtime.h>
-typedef void * PMETH;
 #else
 #include <objc/objc-runtime.h>
-typedef struct objc_method * PMETH;
 
 /* Missing from old NeXT objc headers... */
 #define _C_LNG_LNG  'q'
@@ -54,11 +52,6 @@ struct objc_struct_layout
   unsigned int record_align;
 };
 
-typedef union arglist {
-  char *arg_ptr;
-  char arg_regs[sizeof (char*)];
-} *arglist_t;                   /* argument frame */
-
 void objc_layout_structure_get_info (struct objc_struct_layout *,unsigned int *,
                                     unsigned int *, const char **);
 void objc_layout_structure (const char *, struct objc_struct_layout *);
@@ -77,11 +70,5 @@ const char *objc_skip_typespec (const char *);
 const char *objc_skip_offset (const char *);
 const char *objc_skip_argspec (const char *);
 
-int method_get_number_of_arguments (PMETH);
-int method_get_sizeof_arguments (PMETH);
-char *method_get_next_argument (arglist_t , const char **);
-char *method_get_first_argument (PMETH, arglist_t, const char **);
-char *method_get_nth_argument (PMETH, arglist_t, int, const char **);
-
 #endif /* __NEXT_RUNTIME__ */
 #endif /* _OBJC_TEST_SUITE_NEXT_ENCODE_ASSIST_H_ */
Index: objc-obj-c++-shared/objc-test-suite-types.h
===================================================================
--- objc-obj-c++-shared/objc-test-suite-types.h (revision 174812)
+++ objc-obj-c++-shared/objc-test-suite-types.h (working copy)
@@ -45,11 +45,6 @@ typedef void * TNS_STRING_REF_T;
 
 /* Where there are equivalent interfaces between APIs we substitute
    a macro or typedef.  */
-#ifdef NEXT_OBJC_USE_NEW_INTERFACE
-typedef void * PMETH;
-#else
-typedef struct objc_method * PMETH;
-#endif
 
 #ifdef __OBJC2__
 /* Const String Class ref.  */



More information about the Gcc-patches mailing list