diff options
Diffstat (limited to 'gnu/egcs')
-rw-r--r-- | gnu/egcs/include/libiberty.h | 36 | ||||
-rw-r--r-- | gnu/egcs/include/obstack.h | 18 | ||||
-rw-r--r-- | gnu/egcs/include/splay-tree.h | 9 | ||||
-rw-r--r-- | gnu/egcs/include/symcat.h | 4 |
4 files changed, 44 insertions, 23 deletions
diff --git a/gnu/egcs/include/libiberty.h b/gnu/egcs/include/libiberty.h index 316f52a72b6..05114a27b6c 100644 --- a/gnu/egcs/include/libiberty.h +++ b/gnu/egcs/include/libiberty.h @@ -51,6 +51,11 @@ extern char *concat PARAMS ((const char *, ...)); extern int fdmatch PARAMS ((int fd1, int fd2)); +/* Get the working directory. The result is cached, so don't call + chdir() between calls to getpwd(). */ + +extern char * getpwd PARAMS ((void)); + /* Get the amount of time the process has run, in microseconds. */ extern long get_run_time PARAMS ((void)); @@ -59,9 +64,9 @@ extern long get_run_time PARAMS ((void)); extern char *choose_temp_base PARAMS ((void)); -/* Create a temporary file with a given suffix (optional) */ +/* Return a temporary file name or NULL if unable to create one. */ -extern char *make_temp_file PARAMS ((char *)); +extern char *make_temp_file PARAMS ((const char *)); /* Allocate memory filled with spaces. Allocates using malloc. */ @@ -112,11 +117,7 @@ extern int xatexit PARAMS ((void (*fn) (void))); /* Exit, calling all the functions registered with xatexit. */ -#ifndef __GNUC__ extern void xexit PARAMS ((int status)); -#else -void xexit PARAMS ((int status)) __attribute__ ((noreturn)); -#endif /* Set the program name used by xmalloc. */ @@ -129,13 +130,14 @@ extern void xmalloc_set_program_name PARAMS ((const char *)); #ifdef ANSI_PROTOTYPES /* Get a definition for size_t. */ #include <stddef.h> +/* Get a definition for va_list. */ +#include <stdarg.h> #endif extern PTR xmalloc PARAMS ((size_t)); -/* Reallocate memory without fail. This works like xmalloc. - - FIXME: We do not declare the parameter types for the same reason as - xmalloc. */ +/* 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 PARAMS ((PTR, size_t)); @@ -148,6 +150,10 @@ extern PTR xcalloc PARAMS ((size_t, size_t)); extern char *xstrdup PARAMS ((const char *)); +/* Copy an existing memory buffer to a new memory buffer without fail. */ + +extern PTR xmemdup PARAMS ((const PTR, size_t, size_t)); + /* hex character manipulation routines */ #define _hex_array_size 256 @@ -176,6 +182,16 @@ extern int pexecute PARAMS ((const char *, char * const *, const char *, extern int pwait PARAMS ((int, int *, int)); +/* Like sprintf but provides a pointer to malloc'd storage, which must + be freed by the caller. */ + +extern int asprintf PARAMS ((char **, const char *, ...)); + +/* Like vsprintf but provides a pointer to malloc'd storage, which + must be freed by the caller. */ + +extern int vasprintf PARAMS ((char **, const char *, va_list)); + #ifdef __cplusplus } #endif diff --git a/gnu/egcs/include/obstack.h b/gnu/egcs/include/obstack.h index 38e96777660..a20ab55967a 100644 --- a/gnu/egcs/include/obstack.h +++ b/gnu/egcs/include/obstack.h @@ -143,12 +143,16 @@ extern "C" { #if defined _LIBC || defined HAVE_STRING_H # include <string.h> -# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N)) +# if defined __STDC__ && __STDC__ +# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N)) +# else +# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N)) +# endif #else # ifdef memcpy -# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N)) +# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N)) # else -# define _obstack_memcpy(To, From, N) bcopy ((From), (To), (N)) +# define _obstack_memcpy(To, From, N) bcopy ((char *)(From), (To), (N)) # endif #endif @@ -385,7 +389,7 @@ __extension__ \ int __len = (length); \ if (__o->next_free + __len > __o->chunk_limit) \ _obstack_newchunk (__o, __len); \ - _obstack_memcpy (__o->next_free, (char *) (where), __len); \ + _obstack_memcpy (__o->next_free, (where), __len); \ __o->next_free += __len; \ (void) 0; }) @@ -395,7 +399,7 @@ __extension__ \ int __len = (length); \ if (__o->next_free + __len + 1 > __o->chunk_limit) \ _obstack_newchunk (__o, __len + 1); \ - _obstack_memcpy (__o->next_free, (char *) (where), __len); \ + _obstack_memcpy (__o->next_free, (where), __len); \ __o->next_free += __len; \ *(__o->next_free)++ = 0; \ (void) 0; }) @@ -510,14 +514,14 @@ __extension__ \ ( (h)->temp = (length), \ (((h)->next_free + (h)->temp > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp), 0) : 0), \ - _obstack_memcpy ((h)->next_free, (char *) (where), (h)->temp), \ + _obstack_memcpy ((h)->next_free, (where), (h)->temp), \ (h)->next_free += (h)->temp) # define obstack_grow0(h,where,length) \ ( (h)->temp = (length), \ (((h)->next_free + (h)->temp + 1 > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp + 1), 0) : 0), \ - _obstack_memcpy ((h)->next_free, (char *) (where), (h)->temp), \ + _obstack_memcpy ((h)->next_free, (where), (h)->temp), \ (h)->next_free += (h)->temp, \ *((h)->next_free)++ = 0) diff --git a/gnu/egcs/include/splay-tree.h b/gnu/egcs/include/splay-tree.h index e828fe7e907..6d70c8d9075 100644 --- a/gnu/egcs/include/splay-tree.h +++ b/gnu/egcs/include/splay-tree.h @@ -44,7 +44,7 @@ typedef unsigned long int splay_tree_key; typedef unsigned long int splay_tree_value; /* Forward declaration for a node in the tree. */ -typedef struct splay_tree_node *splay_tree_node; +typedef struct splay_tree_node_s *splay_tree_node; /* The type of a function which compares two splay-tree keys. The function should return values as for qsort. */ @@ -62,7 +62,7 @@ typedef void (*splay_tree_delete_value_fn) PARAMS((splay_tree_value)); typedef int (*splay_tree_foreach_fn) PARAMS((splay_tree_node, void*)); /* The nodes in the splay tree. */ -struct splay_tree_node +struct splay_tree_node_s { /* The key. */ splay_tree_key key; @@ -76,7 +76,7 @@ struct splay_tree_node }; /* The splay tree itself. */ -typedef struct splay_tree +typedef struct splay_tree_s { /* The root of the tree. */ splay_tree_node root; @@ -95,7 +95,8 @@ extern splay_tree splay_tree_new PARAMS((splay_tree_compare_fn, splay_tree_delete_key_fn, splay_tree_delete_value_fn)); extern void splay_tree_delete PARAMS((splay_tree)); -extern void splay_tree_insert PARAMS((splay_tree, +extern splay_tree_node splay_tree_insert + PARAMS((splay_tree, splay_tree_key, splay_tree_value)); extern splay_tree_node splay_tree_lookup diff --git a/gnu/egcs/include/symcat.h b/gnu/egcs/include/symcat.h index 01efada2618..3e27162b264 100644 --- a/gnu/egcs/include/symcat.h +++ b/gnu/egcs/include/symcat.h @@ -1,6 +1,6 @@ /* Symbol concatenation utilities. - Copyright (C) 1998, Free Software Foundation, Inc. + Copyright (C) 1998, 2000 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ #define CONCAT2(a,b) a/**/b #define CONCAT3(a,b,c) a/**/b/**/c #define CONCAT4(a,b,c,d) a/**/b/**/c/**/d -#define STRINGX(s) "?" +#define STRINGX(s) "s" #endif #define XCONCAT2(a,b) CONCAT2(a,b) |