From a288642de0bfb10e98697ba33f51de1b1b0a0b1d Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Tue, 19 Apr 2005 19:09:30 +0000 Subject: [PATCH] merge from gcc --- include/ChangeLog | 7 +++++++ include/hashtab.h | 29 ++++++++++++++--------------- include/libiberty.h | 10 +++++----- include/objalloc.h | 8 ++++---- include/sort.h | 2 +- include/splay-tree.h | 4 ++-- include/ternary.h | 6 +++--- 7 files changed, 36 insertions(+), 30 deletions(-) diff --git a/include/ChangeLog b/include/ChangeLog index 08a124a855d..97a67de0ccd 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,10 @@ +2005-04-19 Kaveh R. Ghazi + + * hashtab.h, libiberty.h, objalloc.h, splay-tree.h, ternary.h: + Don't use the PTR macro. + + * sort.h: Don't use the PARAMS macro. + 2005-04-16 Kaveh R. Ghazi * libiberty.h (unlock_stream): New. diff --git a/include/hashtab.h b/include/hashtab.h index c75b23c8f05..65765225015 100644 --- a/include/hashtab.h +++ b/include/hashtab.h @@ -71,14 +71,14 @@ typedef int (*htab_trav) (void **, void *); Iff it returns NULL, the hash table implementation will pass an error code back to the user, so if your code doesn't handle errors, best if you use xcalloc instead. */ -typedef PTR (*htab_alloc) (size_t, size_t); +typedef void *(*htab_alloc) (size_t, size_t); /* We also need a free() routine. */ -typedef void (*htab_free) (PTR); +typedef void (*htab_free) (void *); /* Memory allocation and deallocation; variants which take an extra argument. */ -typedef PTR (*htab_alloc_with_arg) (void *, size_t, size_t); +typedef void *(*htab_alloc_with_arg) (void *, size_t, size_t); typedef void (*htab_free_with_arg) (void *, void *); /* Hash tables are of the following type. The structure @@ -99,7 +99,7 @@ struct htab GTY(()) htab_del del_f; /* Table itself. */ - PTR * GTY ((use_param, length ("%h.size"))) entries; + void ** GTY ((use_param, length ("%h.size"))) entries; /* Current size (in entries) of the hash table. */ size_t size; @@ -123,7 +123,7 @@ struct htab GTY(()) htab_free free_f; /* Alternate allocate/free functions, which take an extra argument. */ - PTR GTY((skip)) alloc_arg; + void * GTY((skip)) alloc_arg; htab_alloc_with_arg alloc_with_arg_f; htab_free_with_arg free_with_arg_f; @@ -145,7 +145,7 @@ extern htab_t htab_create_alloc (size_t, htab_hash, extern htab_t htab_create_alloc_ex (size_t, htab_hash, htab_eq, htab_del, - PTR, htab_alloc_with_arg, + void *, htab_alloc_with_arg, htab_free_with_arg); /* Backward-compatibility functions. */ @@ -154,18 +154,17 @@ extern htab_t htab_try_create (size_t, htab_hash, htab_eq, htab_del); extern void htab_set_functions_ex (htab_t, htab_hash, htab_eq, htab_del, - PTR, htab_alloc_with_arg, + void *, htab_alloc_with_arg, htab_free_with_arg); extern void htab_delete (htab_t); extern void htab_empty (htab_t); -extern PTR htab_find (htab_t, const void *); -extern PTR *htab_find_slot (htab_t, const void *, enum insert_option); -extern PTR htab_find_with_hash (htab_t, const void *, hashval_t); -extern PTR *htab_find_slot_with_hash (htab_t, const void *, - hashval_t, - enum insert_option); +extern void * htab_find (htab_t, const void *); +extern void ** htab_find_slot (htab_t, const void *, enum insert_option); +extern void * htab_find_with_hash (htab_t, const void *, hashval_t); +extern void ** htab_find_slot_with_hash (htab_t, const void *, + hashval_t, enum insert_option); extern void htab_clear_slot (htab_t, void **); extern void htab_remove_elt (htab_t, void *); extern void htab_remove_elt_with_hash (htab_t, void *, hashval_t); @@ -184,10 +183,10 @@ extern htab_hash htab_hash_pointer; extern htab_eq htab_eq_pointer; /* A hash function for null-terminated strings. */ -extern hashval_t htab_hash_string (const PTR); +extern hashval_t htab_hash_string (const void *); /* An iterative hash function for arbitrary data. */ -extern hashval_t iterative_hash (const PTR, size_t, hashval_t); +extern hashval_t iterative_hash (const void *, size_t, hashval_t); /* Shorthand for hashing something with an intrinsic size. */ #define iterative_hash_object(OB,INIT) iterative_hash (&OB, sizeof (OB), INIT) diff --git a/include/libiberty.h b/include/libiberty.h index 8254aafab0f..df36cdc8ab3 100644 --- a/include/libiberty.h +++ b/include/libiberty.h @@ -259,18 +259,18 @@ extern void xmalloc_failed (size_t) ATTRIBUTE_NORETURN; message to stderr (using the name set by xmalloc_set_program_name, if any) and then call xexit. */ -extern PTR xmalloc (size_t) ATTRIBUTE_MALLOC; +extern void *xmalloc (size_t) ATTRIBUTE_MALLOC; /* Reallocate memory without fail. This works like xmalloc. Note, realloc type functions are not suitable for attribute malloc since they may return the same address across multiple calls. */ -extern PTR xrealloc (PTR, size_t); +extern void *xrealloc (void *, size_t); /* Allocate memory without fail and set it to zero. This works like xmalloc. */ -extern PTR xcalloc (size_t, size_t) ATTRIBUTE_MALLOC; +extern void *xcalloc (size_t, size_t) ATTRIBUTE_MALLOC; /* Copy a string into a memory buffer without fail. */ @@ -282,7 +282,7 @@ extern char *xstrndup (const char *, size_t) ATTRIBUTE_MALLOC; /* Copy an existing memory buffer to a new memory buffer without fail. */ -extern PTR xmemdup (const PTR, size_t, size_t) ATTRIBUTE_MALLOC; +extern void *xmemdup (const void *, size_t, size_t) ATTRIBUTE_MALLOC; /* Physical memory routines. Return values are in BYTES. */ extern double physmem_total (void); @@ -530,7 +530,7 @@ extern int vasprintf (char **, const char *, va_list) USE_C_ALLOCA yourself. The canonical autoconf macro C_ALLOCA is also set/unset as it is often used to indicate whether code needs to call alloca(0). */ -extern PTR C_alloca (size_t) ATTRIBUTE_MALLOC; +extern void *C_alloca (size_t) ATTRIBUTE_MALLOC; #undef alloca #if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA # define alloca(x) __builtin_alloca(x) diff --git a/include/objalloc.h b/include/objalloc.h index 67e8f00f4e6..bb4cbb14a6b 100644 --- a/include/objalloc.h +++ b/include/objalloc.h @@ -45,7 +45,7 @@ struct objalloc { char *current_ptr; unsigned int current_space; - PTR chunks; + void *chunks; }; /* Work out the required alignment. */ @@ -69,7 +69,7 @@ extern struct objalloc *objalloc_create (void); /* Allocate space from an objalloc structure. Returns NULL if malloc fails. */ -extern PTR _objalloc_alloc (struct objalloc *, unsigned long); +extern void *_objalloc_alloc (struct objalloc *, unsigned long); /* The macro version of objalloc_alloc. We only define this if using gcc, because otherwise we would have to evaluate the arguments @@ -94,7 +94,7 @@ extern PTR _objalloc_alloc (struct objalloc *, unsigned long); (__len <= __o->current_space \ ? (__o->current_ptr += __len, \ __o->current_space -= __len, \ - (PTR) (__o->current_ptr - __len)) \ + (void *) (__o->current_ptr - __len)) \ : _objalloc_alloc (__o, __len)); }) #else /* ! __GNUC__ */ @@ -110,6 +110,6 @@ extern void objalloc_free (struct objalloc *); /* Free a block allocated by objalloc_alloc. This also frees all more recently allocated blocks. */ -extern void objalloc_free_block (struct objalloc *, PTR); +extern void objalloc_free_block (struct objalloc *, void *); #endif /* OBJALLOC_H */ diff --git a/include/sort.h b/include/sort.h index 3f3a92f18f0..10aafb08556 100644 --- a/include/sort.h +++ b/include/sort.h @@ -35,7 +35,7 @@ extern "C" { /* Sort an array of pointers. */ -extern void sort_pointers PARAMS ((size_t, void **, void **)); +extern void sort_pointers (size_t, void **, void **); #ifdef __cplusplus } diff --git a/include/splay-tree.h b/include/splay-tree.h index bcd2a3d4425..ca11711ea11 100644 --- a/include/splay-tree.h +++ b/include/splay-tree.h @@ -69,7 +69,7 @@ typedef int (*splay_tree_foreach_fn) (splay_tree_node, void*); node structures. The first argument is the number of bytes needed; the second is a data pointer the splay tree functions pass through to the allocator. This function must never return zero. */ -typedef PTR (*splay_tree_allocate_fn) (int, void *); +typedef void *(*splay_tree_allocate_fn) (int, void *); /* The type of a function used to free memory allocated using the corresponding splay_tree_allocate_fn. The first argument is the @@ -109,7 +109,7 @@ struct splay_tree_s GTY(()) /* Allocate/free functions, and a data pointer to pass to them. */ splay_tree_allocate_fn allocate; splay_tree_deallocate_fn deallocate; - PTR GTY((skip)) allocate_data; + void * GTY((skip)) allocate_data; }; typedef struct splay_tree_s *splay_tree; diff --git a/include/ternary.h b/include/ternary.h index c8de76ac0c8..b346ac8b8e0 100644 --- a/include/ternary.h +++ b/include/ternary.h @@ -38,8 +38,8 @@ ternary_node; already there, and replace is 0. Otherwise, replaces if it it exists, inserts if it doesn't, and returns the data you passed in. */ -PTR ternary_insert (ternary_tree *p, const char *s, - PTR data, int replace); +void *ternary_insert (ternary_tree *p, const char *s, + void *data, int replace); /* Delete the ternary search tree rooted at P. Does NOT delete the data you associated with the strings. */ @@ -47,5 +47,5 @@ void ternary_cleanup (ternary_tree p); /* Search the ternary tree for string S, returning the data associated with it if found. */ -PTR ternary_search (const ternary_node *p, const char *s); +void *ternary_search (const ternary_node *p, const char *s); #endif -- 2.30.2