Patchwork libobjc: remove deprecated API (patch 7)

login
register
mail settings
Submitter Nicola Pero
Date June 3, 2011, 7:15 p.m.
Message ID <1307128539.834222057@www2.webmail.us>
Download mbox | patch
Permalink /patch/98630/
State New
Headers show

Comments

Nicola Pero - June 3, 2011, 7:15 p.m.
This patch removes another bunch of deprecated functions and hooks from libobjc,
in particular objc_valloc(), the various _objc_alloc and similar hooks and the
_objc_unexpected_exception hook.

Committed to trunk.

Thanks

Patch

Index: Makefile.in
===================================================================
--- Makefile.in (revision 174614)
+++ Makefile.in (working copy)
@@ -132,11 +132,8 @@  OBJC_DEPRECATED_H = \
   Object.h \
   Protocol.h \
   objc_get_uninstalled_dtable.h \
-  objc_malloc.h \
   objc_msg_sendv.h \
   objc_object_alloc.h \
-  objc_unexpected_exception.h \
-  objc_valloc.h \
   struct_objc_category.h \
   struct_objc_class.h \
   struct_objc_ivar.h \
@@ -268,16 +265,14 @@  sendmsg_gc.lo: sendmsg.c runtime-info.h
 # These files have separate rules because they require special
 # compiler flags.
 
-# -Wno-deprecated-declarations is to silence warnings from using 
-# _objc_unexpected_exception.
 exception.lo: exception.c
        $(LIBTOOL_COMPILE) $(CC) $< -c \
-          $(ALL_CFLAGS) $(INCLUDES) -fexceptions -Wno-deprecated-declarations \
+          $(ALL_CFLAGS) $(INCLUDES) -fexceptions \
           -o $@
 
 exception_gc.lo: exception.c
        $(LIBTOOL_COMPILE) $(CC) $< -c \
-          $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fexceptions -Wno-deprecated-declarations \
+          $(ALL_CFLAGS) $(INCLUDES) $(OBJC_GCFLAGS) -fexceptions \
           -o $@
 
 doc: info dvi pdf html
Index: libobjc.def
===================================================================
--- libobjc.def (revision 174610)
+++ libobjc.def (working copy)
@@ -26,7 +26,6 @@  objc_get_uninstalled_dtable
 _objc_load_callback
 objc_malloc
 objc_atomic_malloc
-objc_valloc
 objc_realloc
 objc_calloc
 objc_free
@@ -36,7 +35,6 @@  objc_mutex_deallocate
 objc_mutex_lock
 objc_mutex_trylock
 objc_mutex_unlock
-_objc_unexpected_exception
 objc_thread_detach
 objc_thread_exit
 objc_thread_get_data
Index: exception.c
===================================================================
--- exception.c (revision 174593)
+++ exception.c (working copy)
@@ -31,12 +31,6 @@  see the files COPYING3 and COPYING.RUNTIME respect
 #include "unwind-pe.h"
 #include <string.h> /* For memcpy */
 
-/* This hook allows libraries to sepecify special actions when an
-   exception is thrown without a handler in place.  This is deprecated
-   in favour of objc_set_uncaught_exception_handler ().  */
-void (*_objc_unexpected_exception) (id exception); /* !T:SAFE */
-
-
 /* 'is_kind_of_exception_matcher' is our default exception matcher -
    it determines if the object 'exception' is of class 'catch_class',
    or of a subclass.  */
@@ -539,13 +533,6 @@  objc_exception_throw (id exception)
       (*__objc_uncaught_exception_handler) (exception);
     }
 
-  /* As a last resort support the old, deprecated way of setting an
-     uncaught exception handler.  */
-  if (_objc_unexpected_exception != 0)
-    {
-      (*_objc_unexpected_exception) (exception);
-    }
-
   abort ();
 }
 
Index: ChangeLog
===================================================================
--- ChangeLog   (revision 174614)
+++ ChangeLog   (working copy)
@@ -1,5 +1,24 @@ 
 2011-06-03  Nicola Pero  <nicola.pero@meta-innovation.com>
 
+       * Makefile.in (OBJC_DEPRECATED_H): Removed objc_valloc.h,
+       objc_malloc.h and objc_unexpected_exception.h.
+       (exception.lo): Do not use -Wno-deprecated-declarations.
+       (exception_gc.lo): Likewise.
+       * objc/objc-api.h: Do not include deprecated/objc_valloc.h,
+       deprecated/objc_malloc.h and
+       deprecated/objc_unexpected_exception.h.
+       * objc/deprecated/objc_valloc.h: Removed.
+       * objc/deprecated/objc_malloc.h: Removed.
+       * objc/deprecated/objc_unexpected_exception.h: Removed.
+       * exception.c (_objc_unexpected_exception): Removed.
+       (objc_exception_throw): Do not check for
+       _objc_unexpected_exception.
+       * memory.c (objc_valloc, _objc_malloc, _objc_atomic_malloc,
+       _objc_valloc, _objc_realloc, _objc_calloc, _objc_free): Removed.        
+       * libobjc.def (_objc_unexpected_exception, objc_valloc): Removed.
+       
+2011-06-03  Nicola Pero  <nicola.pero@meta-innovation.com>
+
        * objc/objc.h: Do not include deprecated/STR.h.
        * objc/deprecated/STR.h: Removed.
        * Makefile.in (OBJC_DEPRECATED_H): removed STR.h.
Index: memory.c
===================================================================
--- memory.c    (revision 174593)
+++ memory.c    (working copy)
@@ -133,38 +133,3 @@  objc_free (void *mem)
 }
 
 #endif /* !OBJC_WITH_GC */
-
-/* The rest of the file contains deprecated code.  */
-
-#if OBJC_WITH_GC
-
-void *
-objc_valloc (size_t size)
-{
-  void *res = (void *)(GC_malloc (size));
-  if (! res)
-    _objc_abort ("Virtual memory exhausted\n");
-  return res;
-}
-
-#else
-
-void *
-objc_valloc (size_t size)
-{
-  void *res = (void *)(malloc (size));
-  if (! res)
-    _objc_abort ("Virtual memory exhausted\n");
-  return res;
-}
-
-#endif /* !OBJC_WITH_GC */
-
-/* Hook functions for memory allocation and disposal.  Deprecated and
-   currently unused.  */
-void *(*_objc_malloc) (size_t) = malloc;
-void *(*_objc_atomic_malloc) (size_t) = malloc;
-void *(*_objc_valloc) (size_t) = malloc;
-void *(*_objc_realloc) (void *, size_t) = realloc;
-void *(*_objc_calloc) (size_t, size_t) = calloc;
-void (*_objc_free) (void *) = free;
Index: objc/deprecated/objc_malloc.h
===================================================================
--- objc/deprecated/objc_malloc.h       (revision 174593)
+++ objc/deprecated/objc_malloc.h       (working copy)
@@ -1,17 +0,0 @@ 
-/*
-** Hook functions for memory allocation and disposal.
-** This makes it easy to substitute garbage collection systems
-** such as Boehm's GC by assigning these function pointers
-** to the GC's allocation routines.  By default these point
-** to the ANSI standard malloc, realloc, free, etc.
-**
-** Users should call the normal objc routines above for
-** memory allocation and disposal within their programs.
-*/
-objc_EXPORT void *(*_objc_malloc)(size_t);
-objc_EXPORT void *(*_objc_atomic_malloc)(size_t);
-objc_EXPORT void *(*_objc_valloc)(size_t);
-objc_EXPORT void *(*_objc_realloc)(void *, size_t);
-objc_EXPORT void *(*_objc_calloc)(size_t, size_t);
-objc_EXPORT void (*_objc_free)(void *);
-
Index: objc/deprecated/objc_valloc.h
===================================================================
--- objc/deprecated/objc_valloc.h       (revision 174593)
+++ objc/deprecated/objc_valloc.h       (working copy)
@@ -1,2 +0,0 @@ 
-void *
-objc_valloc(size_t size);
Index: objc/deprecated/objc_unexpected_exception.h
===================================================================
--- objc/deprecated/objc_unexpected_exception.h (revision 174593)
+++ objc/deprecated/objc_unexpected_exception.h (working copy)
@@ -1,9 +0,0 @@ 
-/*
-** Hook for uncaught exceptions.  This hook is called when an
-** exception is thrown and no valid exception handler is in place.
-** The function is expected never to return.  If the function returns
-** the result is currently undefined.  This is deprecated.  Please use
-** objc_set_uncaught_exception_handler() from objc/objc-exception.h
-** instead.
-*/
-objc_EXPORT void (*_objc_unexpected_exception)(id) __attribute__ ((deprecated));
Index: objc/objc-api.h
===================================================================
--- objc/objc-api.h     (revision 174610)
+++ objc/objc-api.h     (working copy)
@@ -218,11 +218,6 @@  objc_calloc(size_t nelem, size_t size);
 objc_EXPORT void
 objc_free(void *mem);
 
-#include "deprecated/objc_valloc.h"
-#include "deprecated/objc_malloc.h"
-
-#include "deprecated/objc_unexpected_exception.h"
-
 objc_EXPORT Method_t class_get_class_method(MetaClass _class, SEL aSel);
 
 objc_EXPORT Method_t class_get_instance_method(Class _class, SEL aSel);