From dd3dba526f93ec79a1998a9c1845833087d0b134 Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Fri, 3 Jun 2011 17:59:14 +0000 Subject: [PATCH] In libobjc/: 2011-06-03 Nicola Pero In libobjc/: 2011-06-03 Nicola Pero * Makefile.in (OBJC_H): Removed hash.h and sarray.h. (OBJC_DEPRECATED_H): Likewise. * libobjc.def (objc_hash_new, objc_hash_delete, objc_hash_add, objc_hash_remove, objc_hash_next, objc_hash_value_for_key, objc_hash_is_key_in_hash, hash_add, hash_delete, hash_new, hash_next, hash_remove, hash_value_for_key, hash_is_key_in_hash, sarray_at_put, sarray_at_put_safe, sarray_free, sarray_lazy_copy, sarray_new, sarray_realloc, sarray_remove_garbage): Removed. * objc/sarray.h: Removed. * objc/hash.h: Removed. * objc/deprecated/sarray.h: Removed. * objc/deprecated/hash.h: Removed. * objc/Object.h: Do not include objc/deprecated/hash.h * Object.m: Include string.h. * objc/objc-api.h: Do not include objc/deprecated/hash.h. * objc-private/common.h (GNU_LIBOBJC_COMPILING_LIBOBJC_ITSELF): Removed. In gcc/testsuite/: 2011-06-03 Nicola Pero * objc.dg/headers.m: Do not include sarray.h and hash.h. From-SVN: r174610 --- gcc/testsuite/ChangeLog | 4 + gcc/testsuite/objc.dg/headers.m | 2 - libobjc/ChangeLog | 20 +++ libobjc/Makefile.in | 7 +- libobjc/Object.m | 1 + libobjc/libobjc.def | 21 --- libobjc/objc-private/common.h | 5 - libobjc/objc/Object.h | 1 - libobjc/objc/deprecated/hash.h | 211 --------------------------- libobjc/objc/deprecated/sarray.h | 240 ------------------------------- libobjc/objc/hash.h | 3 - libobjc/objc/objc-api.h | 3 - libobjc/objc/sarray.h | 2 - 13 files changed, 26 insertions(+), 494 deletions(-) delete mode 100644 libobjc/objc/deprecated/hash.h delete mode 100644 libobjc/objc/deprecated/sarray.h delete mode 100644 libobjc/objc/hash.h delete mode 100644 libobjc/objc/sarray.h diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4eeb347aca7..91bed17a4c7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-06-03 Nicola Pero + + * objc.dg/headers.m: Do not include sarray.h and hash.h. + 2011-06-03 Richard Henderson Rainer Orth diff --git a/gcc/testsuite/objc.dg/headers.m b/gcc/testsuite/objc.dg/headers.m index 93cfcaf9369..c20b36ac111 100644 --- a/gcc/testsuite/objc.dg/headers.m +++ b/gcc/testsuite/objc.dg/headers.m @@ -14,13 +14,11 @@ #include #else #include -#include #endif #include #include #ifndef __NEXT_RUNTIME__ -#include #include #endif diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index bef84e74d34..4de6621eea5 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,23 @@ +2011-06-03 Nicola Pero + + * Makefile.in (OBJC_H): Removed hash.h and sarray.h. + (OBJC_DEPRECATED_H): Likewise. + * libobjc.def (objc_hash_new, objc_hash_delete, objc_hash_add, + objc_hash_remove, objc_hash_next, objc_hash_value_for_key, + objc_hash_is_key_in_hash, hash_add, hash_delete, hash_new, + hash_next, hash_remove, hash_value_for_key, hash_is_key_in_hash, + sarray_at_put, sarray_at_put_safe, sarray_free, sarray_lazy_copy, + sarray_new, sarray_realloc, sarray_remove_garbage): Removed. + * objc/sarray.h: Removed. + * objc/hash.h: Removed. + * objc/deprecated/sarray.h: Removed. + * objc/deprecated/hash.h: Removed. + * objc/Object.h: Do not include objc/deprecated/hash.h + * Object.m: Include string.h. + * objc/objc-api.h: Do not include objc/deprecated/hash.h. + * objc-private/common.h (GNU_LIBOBJC_COMPILING_LIBOBJC_ITSELF): + Removed. + 2011-06-03 Nicola Pero * Object.m ([-forward::]): Removed. diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in index 424cb1a9059..a9658061a8f 100644 --- a/libobjc/Makefile.in +++ b/libobjc/Makefile.in @@ -122,10 +122,7 @@ OBJC_H = \ objc-api.h \ objc-decls.h \ runtime.h \ - thr.h \ - \ - hash.h \ - sarray.h + thr.h # User-visible header files containing deprecated APIs, from the # objc/deprecated directory @@ -135,14 +132,12 @@ OBJC_DEPRECATED_H = \ Object.h \ Protocol.h \ STR.h \ - hash.h \ objc_get_uninstalled_dtable.h \ objc_malloc.h \ objc_msg_sendv.h \ objc_object_alloc.h \ objc_unexpected_exception.h \ objc_valloc.h \ - sarray.h \ struct_objc_category.h \ struct_objc_class.h \ struct_objc_ivar.h \ diff --git a/libobjc/Object.m b/libobjc/Object.m index 281be832005..9781fad1d7f 100644 --- a/libobjc/Object.m +++ b/libobjc/Object.m @@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "objc-private/common.h" #include +#include /* For strcmp. */ #include #include "objc/Object.h" #include "objc/Protocol.h" diff --git a/libobjc/libobjc.def b/libobjc/libobjc.def index f66d366b156..a478f76665f 100644 --- a/libobjc/libobjc.def +++ b/libobjc/libobjc.def @@ -23,8 +23,6 @@ LIBRARY libobjc EXPORTS search_for_method_in_list objc_get_uninstalled_dtable -objc_hash_is_key_in_hash -hash_is_key_in_hash _objc_load_callback objc_malloc objc_atomic_malloc @@ -106,22 +104,3 @@ objc_get_class objc_get_meta_class objc_lookup_class objc_next_class -sarray_at_put -sarray_at_put_safe -sarray_free -sarray_lazy_copy -sarray_new -sarray_realloc -sarray_remove_garbage -objc_hash_add -hash_add -objc_hash_delete -hash_delete -objc_hash_new -hash_new -objc_hash_next -hash_next -objc_hash_remove -hash_remove -objc_hash_value_for_key -hash_value_for_key diff --git a/libobjc/objc-private/common.h b/libobjc/objc-private/common.h index 4f4ec5cd077..d1f071114ec 100644 --- a/libobjc/objc-private/common.h +++ b/libobjc/objc-private/common.h @@ -28,11 +28,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* This file contains definitions that should be included by all .c and .m files in libobjc. */ -/* This variable allows the public headers to determine when they are - being included by a file inside libobjc itself, or when they are - being included by an external file. */ -#define GNU_LIBOBJC_COMPILING_LIBOBJC_ITSELF 1 - /* When debugging libobjc, add #define DEBUG 1 diff --git a/libobjc/objc/Object.h b/libobjc/objc/Object.h index 684a008643d..11c4617a98c 100644 --- a/libobjc/objc/Object.h +++ b/libobjc/objc/Object.h @@ -57,7 +57,6 @@ extern "C" { /* All of the following includes were deprecated in GCC 4.6 and will be removed in the next release. */ -#include "deprecated/hash.h" #include "deprecated/Object.h" #ifdef __cplusplus diff --git a/libobjc/objc/deprecated/hash.h b/libobjc/objc/deprecated/hash.h deleted file mode 100644 index 8b718a4417d..00000000000 --- a/libobjc/objc/deprecated/hash.h +++ /dev/null @@ -1,211 +0,0 @@ -/* Hash tables for Objective C method dispatch. - Copyright (C) 1993, 1995, 1996, 2004, 2009 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -. */ - - - -#ifndef __hash_INCLUDE_GNU -#define __hash_INCLUDE_GNU - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* - * This data structure is used to hold items - * stored in a hash table. Each node holds - * a key/value pair. - * - * Items in the cache are really of type void *. - */ -typedef struct cache_node -{ - struct cache_node *next; /* Pointer to next entry on the list. - NULL indicates end of list. */ - const void *key; /* Key used to locate the value. Used - to locate value when more than one - key computes the same hash - value. */ - void *value; /* Value stored for the key. */ -} *node_ptr; - - -/* - * This data type is the function that computes a hash code given a key. - * Therefore, the key can be a pointer to anything and the function specific - * to the key type. - * - * Unfortunately there is a mutual data structure reference problem with this - * typedef. Therefore, to remove compiler warnings the functions passed to - * objc_hash_new will have to be casted to this type. - */ -typedef unsigned int (*hash_func_type) (void *, const void *); - -/* - * This data type is the function that compares two hash keys and returns an - * integer greater than, equal to, or less than 0, according as the first - * parameter is lexicographically greater than, equal to, or less than the - * second. - */ - -typedef int (*compare_func_type) (const void *, const void *); - - -/* - * This data structure is the cache. - * - * It must be passed to all of the hashing routines - * (except for new). - */ -typedef struct cache -{ - /* Variables used to implement the hash itself. */ - node_ptr *node_table; /* Pointer to an array of hash nodes. */ - /* Variables used to track the size of the hash table so to determine - when to resize it. */ - unsigned int size; /* Number of buckets allocated for the hash table - (number of array entries allocated for - "node_table"). Must be a power of two. */ - unsigned int used; /* Current number of entries in the hash table. */ - unsigned int mask; /* Precomputed mask. */ - - /* Variables used to implement indexing through the hash table. */ - - unsigned int last_bucket; /* Tracks which entry in the array where - the last value was returned. */ - /* Function used to compute a hash code given a key. - This function is specified when the hash table is created. */ - hash_func_type hash_func; - /* Function used to compare two hash keys to see if they are equal. */ - compare_func_type compare_func; -} *cache_ptr; - - -/* Allocate and initialize a hash table. */ - -cache_ptr objc_hash_new (unsigned int size, - hash_func_type hash_func, - compare_func_type compare_func); - -/* Deallocate all of the hash nodes and the cache itself. */ - -void objc_hash_delete (cache_ptr cache); - -/* Add the key/value pair to the hash table. If the - hash table reaches a level of fullness then it will be resized. - - assert if the key is already in the hash. */ - -void objc_hash_add (cache_ptr *cachep, const void *key, void *value); - -/* Remove the key/value pair from the hash table. - assert if the key isn't in the table. */ - -void objc_hash_remove (cache_ptr cache, const void *key); - -/* Used to index through the hash table. Start with NULL - to get the first entry. - - Successive calls pass the value returned previously. - ** Don't modify the hash during this operation *** - - Cache nodes are returned such that key or value can - be extracted. */ - -node_ptr objc_hash_next (cache_ptr cache, node_ptr node); - -/* Used to return a value from a hash table using a given key. */ - -void *objc_hash_value_for_key (cache_ptr cache, const void *key); - -/* Used to determine if the given key exists in the hash table */ - -BOOL objc_hash_is_key_in_hash (cache_ptr cache, const void *key); - -/************************************************ - - Useful hashing functions. - - Declared inline for your pleasure. - -************************************************/ - -/* Calculate a hash code by performing some - manipulation of the key pointer. (Use the lowest bits - except for those likely to be 0 due to alignment.) */ - -static inline unsigned int -objc_hash_ptr (cache_ptr cache, const void *key) -{ - return ((size_t)key / sizeof (void *)) & cache->mask; -} - - -/* Calculate a hash code by iterating over a NULL - terminate string. */ -static inline unsigned int -objc_hash_string (cache_ptr cache, const void *key) -{ - unsigned int ret = 0; - unsigned int ctr = 0; - const char *ckey = (const char *) key; - - while (*ckey) { - ret ^= *ckey++ << ctr; - ctr = (ctr + 1) % sizeof (void *); - } - - return ret & cache->mask; -} - - -/* Compare two pointers for equality. */ -static inline int -objc_compare_ptrs (const void *k1, const void *k2) -{ - return (k1 == k2); -} - - -/* Compare two strings. */ -static inline int -objc_compare_strings (const void *k1, const void *k2) -{ - if (k1 == k2) - return 1; - else if (k1 == 0 || k2 == 0) - return 0; - else - return ! strcmp ((const char *) k1, (const char *) k2); -} - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* not __hash_INCLUDE_GNU */ diff --git a/libobjc/objc/deprecated/sarray.h b/libobjc/objc/deprecated/sarray.h deleted file mode 100644 index aa2f3350a45..00000000000 --- a/libobjc/objc/deprecated/sarray.h +++ /dev/null @@ -1,240 +0,0 @@ -/* Sparse Arrays for Objective C dispatch tables - Copyright (C) 1993, 1995, 1996, 2004, 2009 Free Software Foundation, Inc. - Contributed by Kresten Krab Thorup. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -. */ - - -#ifndef __sarray_INCLUDE_GNU -#define __sarray_INCLUDE_GNU - -#define OBJC_SPARSE2 /* 2-level sparse array */ -/* #define OBJC_SPARSE3 */ /* 3-level sparse array */ - -#ifdef OBJC_SPARSE2 -extern const char* __objc_sparse2_id; -#endif - -#ifdef OBJC_SPARSE3 -extern const char* __objc_sparse3_id; -#endif - -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -extern int nbuckets; /* for stats */ -extern int nindices; -extern int narrays; -extern int idxsize; - -/* An unsigned integer of same size as a pointer */ -#define SIZET_BITS (sizeof(size_t)*8) - -#if defined(__sparc__) || defined(OBJC_SPARSE2) -#define PRECOMPUTE_SELECTORS -#endif - -#ifdef OBJC_SPARSE3 - -/* Buckets are 8 words each */ -#define BUCKET_BITS 3 -#define BUCKET_SIZE (1< - indices[x.off.ioffset]-> - buckets[x.off.boffset]-> - elems[x.off.eoffset]; -#else /* OBJC_SPARSE2 */ - return array->buckets[x.off.boffset]->elems[x.off.eoffset]; -#endif /* OBJC_SPARSE2 */ -#else /* not PRECOMPUTE_SELECTORS */ -#ifdef OBJC_SPARSE3 - return array-> - indices[indx/INDEX_CAPACITY]-> - buckets[(indx/BUCKET_SIZE)%INDEX_SIZE]-> - elems[indx%BUCKET_SIZE]; -#else /* OBJC_SPARSE2 */ - return array->buckets[indx/BUCKET_SIZE]->elems[indx%BUCKET_SIZE]; -#endif /* not OBJC_SPARSE3 */ -#endif /* not PRECOMPUTE_SELECTORS */ -} - -static inline void* sarray_get_safe(struct sarray* array, sidx indx) -{ - if(soffset_decode(indx) < array->capacity) - return sarray_get(array, indx); - else - return (array->empty_bucket->elems[0]); -} - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __sarray_INCLUDE_GNU */ diff --git a/libobjc/objc/hash.h b/libobjc/objc/hash.h deleted file mode 100644 index 8225a0992e4..00000000000 --- a/libobjc/objc/hash.h +++ /dev/null @@ -1,3 +0,0 @@ -#include "objc.h" -#include "deprecated/hash.h" - diff --git a/libobjc/objc/objc-api.h b/libobjc/objc/objc-api.h index 42bec77770f..411f4b2aaea 100644 --- a/libobjc/objc/objc-api.h +++ b/libobjc/objc/objc-api.h @@ -49,9 +49,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* TODO: A deprecation warning any time the file is included ? */ #include "objc.h" -#ifndef GNU_LIBOBJC_COMPILING_LIBOBJC_ITSELF -# include "deprecated/hash.h" -#endif #include "thr.h" #include "objc-decls.h" #include diff --git a/libobjc/objc/sarray.h b/libobjc/objc/sarray.h deleted file mode 100644 index ff51e47f918..00000000000 --- a/libobjc/objc/sarray.h +++ /dev/null @@ -1,2 +0,0 @@ -#include "deprecated/sarray.h" - -- 2.30.2