merge from gcc

This commit is contained in:
DJ Delorie 2005-03-28 05:07:01 +00:00
parent 25c47304a3
commit eda51d1610
4 changed files with 38 additions and 122 deletions

View File

@ -64,12 +64,12 @@ struct objalloc_align { char x; double d; };
/* Create an objalloc structure. Returns NULL if malloc fails. */ /* Create an objalloc structure. Returns NULL if malloc fails. */
extern struct objalloc *objalloc_create PARAMS ((void)); extern struct objalloc *objalloc_create (void);
/* Allocate space from an objalloc structure. Returns NULL if malloc /* Allocate space from an objalloc structure. Returns NULL if malloc
fails. */ fails. */
extern PTR _objalloc_alloc PARAMS ((struct objalloc *, unsigned long)); extern PTR _objalloc_alloc (struct objalloc *, unsigned long);
/* The macro version of objalloc_alloc. We only define this if using /* The macro version of objalloc_alloc. We only define this if using
gcc, because otherwise we would have to evaluate the arguments gcc, because otherwise we would have to evaluate the arguments
@ -105,11 +105,11 @@ extern PTR _objalloc_alloc PARAMS ((struct objalloc *, unsigned long));
/* Free an entire objalloc structure. */ /* Free an entire objalloc structure. */
extern void objalloc_free PARAMS ((struct objalloc *)); extern void objalloc_free (struct objalloc *);
/* Free a block allocated by objalloc_alloc. This also frees all more /* Free a block allocated by objalloc_alloc. This also frees all more
recently allocated blocks. */ recently allocated blocks. */
extern void objalloc_free_block PARAMS ((struct objalloc *, PTR)); extern void objalloc_free_block (struct objalloc *, PTR);
#endif /* OBJALLOC_H */ #endif /* OBJALLOC_H */

View File

@ -1,6 +1,6 @@
/* obstack.h - object stack macros /* obstack.h - object stack macros
Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998,
1999, 2000 1999, 2000, 2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc. Free Software Foundation, Inc.
@ -145,11 +145,7 @@ extern "C" {
#if defined _LIBC || defined HAVE_STRING_H #if defined _LIBC || defined HAVE_STRING_H
# include <string.h> # include <string.h>
# if defined __STDC__ && __STDC__ # define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
# else
# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N))
# endif
#else #else
# ifdef memcpy # ifdef memcpy
# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N)) # define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N))
@ -174,18 +170,12 @@ struct obstack /* control current object in current chunk */
char *chunk_limit; /* address of char after current chunk */ char *chunk_limit; /* address of char after current chunk */
PTR_INT_TYPE temp; /* Temporary for some macros. */ PTR_INT_TYPE temp; /* Temporary for some macros. */
int alignment_mask; /* Mask of alignment for each object. */ int alignment_mask; /* Mask of alignment for each object. */
#if defined __STDC__ && __STDC__
/* These prototypes vary based on `use_extra_arg', and we use /* These prototypes vary based on `use_extra_arg', and we use
casts to the prototypeless function type in all assignments, casts to the prototypeless function type in all assignments,
but having prototypes here quiets -Wstrict-prototypes. */ but having prototypes here quiets -Wstrict-prototypes. */
struct _obstack_chunk *(*chunkfun) (void *, long); struct _obstack_chunk *(*chunkfun) (void *, long);
void (*freefun) (void *, struct _obstack_chunk *); void (*freefun) (void *, struct _obstack_chunk *);
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
#else
struct _obstack_chunk *(*chunkfun) (); /* User's fcn to allocate a chunk. */
void (*freefun) (); /* User's function to free a chunk. */
char *extra_arg; /* first arg for chunk alloc/dealloc funcs */
#endif
unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */
unsigned maybe_empty_object:1;/* There is a possibility that the current unsigned maybe_empty_object:1;/* There is a possibility that the current
chunk contains a zero-length object. This chunk contains a zero-length object. This
@ -198,7 +188,6 @@ struct obstack /* control current object in current chunk */
/* Declare the external functions we use; they are in obstack.c. */ /* Declare the external functions we use; they are in obstack.c. */
#if defined __STDC__ && __STDC__
extern void _obstack_newchunk (struct obstack *, int); extern void _obstack_newchunk (struct obstack *, int);
extern void _obstack_free (struct obstack *, void *); extern void _obstack_free (struct obstack *, void *);
extern int _obstack_begin (struct obstack *, int, int, extern int _obstack_begin (struct obstack *, int, int,
@ -207,16 +196,7 @@ extern int _obstack_begin_1 (struct obstack *, int, int,
void *(*) (void *, long), void *(*) (void *, long),
void (*) (void *, void *), void *); void (*) (void *, void *), void *);
extern int _obstack_memory_used (struct obstack *); extern int _obstack_memory_used (struct obstack *);
#else
extern void _obstack_newchunk ();
extern void _obstack_free ();
extern int _obstack_begin ();
extern int _obstack_begin_1 ();
extern int _obstack_memory_used ();
#endif
#if defined __STDC__ && __STDC__
/* Do the function-declarations after the structs /* Do the function-declarations after the structs
but before defining the macros. */ but before defining the macros. */
@ -255,19 +235,10 @@ int obstack_alignment_mask (struct obstack *obstack);
int obstack_chunk_size (struct obstack *obstack); int obstack_chunk_size (struct obstack *obstack);
int obstack_memory_used (struct obstack *obstack); int obstack_memory_used (struct obstack *obstack);
#endif /* __STDC__ */
/* Non-ANSI C cannot really support alternative functions for these macros,
so we do not declare them. */
/* Error handler called when `obstack_chunk_alloc' failed to allocate /* Error handler called when `obstack_chunk_alloc' failed to allocate
more memory. This can be set to a user defined function. The more memory. This can be set to a user defined function. The
default action is to print a message and abort. */ default action is to print a message and abort. */
#if defined __STDC__ && __STDC__
extern void (*obstack_alloc_failed_handler) (void); extern void (*obstack_alloc_failed_handler) (void);
#else
extern void (*obstack_alloc_failed_handler) ();
#endif
/* Exit value used when `print_and_abort' is used. */ /* Exit value used when `print_and_abort' is used. */
extern int obstack_exit_failure; extern int obstack_exit_failure;
@ -292,8 +263,6 @@ extern int obstack_exit_failure;
/* To prevent prototype warnings provide complete argument list in /* To prevent prototype warnings provide complete argument list in
standard C version. */ standard C version. */
#if defined __STDC__ && __STDC__
# define obstack_init(h) \ # define obstack_init(h) \
_obstack_begin ((h), 0, 0, \ _obstack_begin ((h), 0, 0, \
(void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free) (void *(*) (long)) obstack_chunk_alloc, (void (*) (void *)) obstack_chunk_free)
@ -317,32 +286,6 @@ extern int obstack_exit_failure;
# define obstack_freefun(h, newfreefun) \ # define obstack_freefun(h, newfreefun) \
((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun)) ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
#else
# define obstack_init(h) \
_obstack_begin ((h), 0, 0, \
(void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)
# define obstack_begin(h, size) \
_obstack_begin ((h), (size), 0, \
(void *(*) ()) obstack_chunk_alloc, (void (*) ()) obstack_chunk_free)
# define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
_obstack_begin ((h), (size), (alignment), \
(void *(*) ()) (chunkfun), (void (*) ()) (freefun))
# define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
_obstack_begin_1 ((h), (size), (alignment), \
(void *(*) ()) (chunkfun), (void (*) ()) (freefun), (arg))
# define obstack_chunkfun(h, newchunkfun) \
((h) -> chunkfun = (struct _obstack_chunk *(*)()) (newchunkfun))
# define obstack_freefun(h, newfreefun) \
((h) -> freefun = (void (*)()) (newfreefun))
#endif
#define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar)) #define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar))
#define obstack_blank_fast(h,n) ((h)->next_free += (n)) #define obstack_blank_fast(h,n) ((h)->next_free += (n))
@ -586,21 +529,12 @@ __extension__ \
(h)->object_base = (h)->next_free, \ (h)->object_base = (h)->next_free, \
__INT_TO_PTR ((h)->temp)) __INT_TO_PTR ((h)->temp))
# if defined __STDC__ && __STDC__ # define obstack_free(h,obj) \
# define obstack_free(h,obj) \
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \ ( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\ (((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \ ? (int) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \ = (h)->temp + (char *) (h)->chunk) \
: (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0))) : (((obstack_free) ((h), (h)->temp + (char *) (h)->chunk), 0), 0)))
# else
# define obstack_free(h,obj) \
( (h)->temp = (char *) (obj) - (char *) (h)->chunk, \
(((h)->temp > 0 && (h)->temp < (h)->chunk_limit - (char *) (h)->chunk)\
? (int) ((h)->next_free = (h)->object_base \
= (h)->temp + (char *) (h)->chunk) \
: (_obstack_free ((h), (h)->temp + (char *) (h)->chunk), 0)))
# endif
#endif /* not __GNUC__ or not __STDC__ */ #endif /* not __GNUC__ or not __STDC__ */

View File

@ -64,13 +64,10 @@ typedef struct partition_def
struct partition_elem elements[1]; struct partition_elem elements[1];
} *partition; } *partition;
extern partition partition_new PARAMS((int)); extern partition partition_new (int);
extern void partition_delete PARAMS((partition)); extern void partition_delete (partition);
extern int partition_union PARAMS((partition, extern int partition_union (partition, int, int);
int, extern void partition_print (partition, FILE*);
int));
extern void partition_print PARAMS((partition,
FILE*));
/* Returns the canonical element corresponding to the class containing /* Returns the canonical element corresponding to the class containing
ELEMENT__ in PARTITION__. */ ELEMENT__ in PARTITION__. */

View File

@ -52,30 +52,30 @@ typedef struct splay_tree_node_s *splay_tree_node;
/* The type of a function which compares two splay-tree keys. The /* The type of a function which compares two splay-tree keys. The
function should return values as for qsort. */ function should return values as for qsort. */
typedef int (*splay_tree_compare_fn) PARAMS((splay_tree_key, splay_tree_key)); typedef int (*splay_tree_compare_fn) (splay_tree_key, splay_tree_key);
/* The type of a function used to deallocate any resources associated /* The type of a function used to deallocate any resources associated
with the key. */ with the key. */
typedef void (*splay_tree_delete_key_fn) PARAMS((splay_tree_key)); typedef void (*splay_tree_delete_key_fn) (splay_tree_key);
/* The type of a function used to deallocate any resources associated /* The type of a function used to deallocate any resources associated
with the value. */ with the value. */
typedef void (*splay_tree_delete_value_fn) PARAMS((splay_tree_value)); typedef void (*splay_tree_delete_value_fn) (splay_tree_value);
/* The type of a function used to iterate over the tree. */ /* The type of a function used to iterate over the tree. */
typedef int (*splay_tree_foreach_fn) PARAMS((splay_tree_node, void*)); typedef int (*splay_tree_foreach_fn) (splay_tree_node, void*);
/* The type of a function used to allocate memory for tree root and /* The type of a function used to allocate memory for tree root and
node structures. The first argument is the number of bytes needed; node structures. The first argument is the number of bytes needed;
the second is a data pointer the splay tree functions pass through the second is a data pointer the splay tree functions pass through
to the allocator. This function must never return zero. */ to the allocator. This function must never return zero. */
typedef PTR (*splay_tree_allocate_fn) PARAMS((int, void *)); typedef PTR (*splay_tree_allocate_fn) (int, void *);
/* The type of a function used to free memory allocated using the /* The type of a function used to free memory allocated using the
corresponding splay_tree_allocate_fn. The first argument is the corresponding splay_tree_allocate_fn. The first argument is the
memory to be freed; the latter is a data pointer the splay tree memory to be freed; the latter is a data pointer the splay tree
functions pass through to the freer. */ functions pass through to the freer. */
typedef void (*splay_tree_deallocate_fn) PARAMS((void *, void *)); typedef void (*splay_tree_deallocate_fn) (void *, void *);
/* The nodes in the splay tree. */ /* The nodes in the splay tree. */
struct splay_tree_node_s GTY(()) struct splay_tree_node_s GTY(())
@ -114,43 +114,28 @@ struct splay_tree_s GTY(())
}; };
typedef struct splay_tree_s *splay_tree; typedef struct splay_tree_s *splay_tree;
extern splay_tree splay_tree_new PARAMS((splay_tree_compare_fn, extern splay_tree splay_tree_new (splay_tree_compare_fn,
splay_tree_delete_key_fn, splay_tree_delete_key_fn,
splay_tree_delete_value_fn)); splay_tree_delete_value_fn);
extern splay_tree splay_tree_new_with_allocator extern splay_tree splay_tree_new_with_allocator (splay_tree_compare_fn,
PARAMS((splay_tree_compare_fn, splay_tree_delete_key_fn,
splay_tree_delete_key_fn,
splay_tree_delete_value_fn, splay_tree_delete_value_fn,
splay_tree_allocate_fn, splay_tree_allocate_fn,
splay_tree_deallocate_fn, splay_tree_deallocate_fn,
void *)); void *);
extern void splay_tree_delete PARAMS((splay_tree)); extern void splay_tree_delete (splay_tree);
extern splay_tree_node splay_tree_insert extern splay_tree_node splay_tree_insert (splay_tree,
PARAMS((splay_tree, splay_tree_key,
splay_tree_key, splay_tree_value);
splay_tree_value)); extern void splay_tree_remove (splay_tree, splay_tree_key);
extern void splay_tree_remove PARAMS((splay_tree, extern splay_tree_node splay_tree_lookup (splay_tree, splay_tree_key);
splay_tree_key)); extern splay_tree_node splay_tree_predecessor (splay_tree, splay_tree_key);
extern splay_tree_node splay_tree_lookup extern splay_tree_node splay_tree_successor (splay_tree, splay_tree_key);
PARAMS((splay_tree, extern splay_tree_node splay_tree_max (splay_tree);
splay_tree_key)); extern splay_tree_node splay_tree_min (splay_tree);
extern splay_tree_node splay_tree_predecessor extern int splay_tree_foreach (splay_tree, splay_tree_foreach_fn, void*);
PARAMS((splay_tree, extern int splay_tree_compare_ints (splay_tree_key, splay_tree_key);
splay_tree_key)); extern int splay_tree_compare_pointers (splay_tree_key, splay_tree_key);
extern splay_tree_node splay_tree_successor
PARAMS((splay_tree,
splay_tree_key));
extern splay_tree_node splay_tree_max
PARAMS((splay_tree));
extern splay_tree_node splay_tree_min
PARAMS((splay_tree));
extern int splay_tree_foreach PARAMS((splay_tree,
splay_tree_foreach_fn,
void*));
extern int splay_tree_compare_ints PARAMS((splay_tree_key,
splay_tree_key));
extern int splay_tree_compare_pointers PARAMS((splay_tree_key,
splay_tree_key));
#ifdef __cplusplus #ifdef __cplusplus
} }