summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2000-02-22 16:18:13 +0000
committerIan Lance Taylor <ian@airs.com>2000-02-22 16:18:13 +0000
commit418d8e2e61a27d428f363b110a52dd88361ff6d7 (patch)
tree127bb8131028d910c46c4bc1dad76e61d61deeab
parentf6c8c15da5d981359982edd95f49dda9d3a66a35 (diff)
downloadgdb-418d8e2e61a27d428f363b110a52dd88361ff6d7.tar.gz
import libiberty from egcs
-rw-r--r--include/ChangeLog132
-rw-r--r--include/ansidecl.h64
-rw-r--r--include/hashtab.h181
-rw-r--r--include/libiberty.h55
-rw-r--r--include/obstack.h18
-rw-r--r--include/splay-tree.h9
-rw-r--r--include/symcat.h4
7 files changed, 234 insertions, 229 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index fbadf92fdf4..04f9f02a393 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,45 +1,95 @@
-1999-04-11 Richard Henderson <rth@cygnus.com>
+Sat Jan 1 19:06:52 2000 Hans-Peter Nilsson <hp@bitrange.com>
- * bfdlink.h (bfd_elf_version_expr): Rename `match' to `pattern'.
- Add `match' callback function.
+ * symcat.h (STRINGX) [!__STDC__ || ALMOST_STDC]: Change "?" to "s"
+ to stringify argument s.
-1999-04-10 Richard Henderson <rth@cygnus.com>
+1999-12-05 Mark Mitchell <mark@codesourcery.com>
- * bfdlink.h (bfd_link_info): Add no_undefined.
+ * splay-tree.h (struct splay_tree_node): Rename to ...
+ (struct splay_tree_node_s): ... this.
+ (struct splay_tree): Rename to ...
+ (struct splay_tree_s): ... this.
-1999-04-08 Nick Clifton <nickc@cygnus.com>
+1999-11-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
- * dis-asm.h: Add prototype for print_insn_mcore.
+ * ansidecl.h (ATTRIBUTE_MALLOC): New macro.
-1999-04-02 Mark Mitchell <mark@codesourcery.com>
+ * libiberty.h (buildargv, dupargv, concat, choose_temp_base,
+ make_temp_file, xmalloc, xcalloc, xstrdup, xmemdup): Add
+ ATTRIBUTE_MALLOC.
+ (xatexit): Remove __GNUC__ check, add ATTRIBUTE_NORETURN.
- * splay-tree.h (splay_tree_compare_pointers): Declare.
+1999-11-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-1999-03-30 Mark Mitchell <mark@codesourcery.com>
+ * libiberty.h: Include stdarg.h when ANSI_PROTOTYPES is defined.
+ (asprintf, vasprintf): Provide declarations.
- * splay-tree.h (splay_tree_compare_ints): Declare.
+Wed Nov 10 12:43:21 1999 Philippe De Muyter <phdm@macqel.be>
+ Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
-Wed Mar 24 12:46:29 1999 Andrew Cagney <cagney@amy.cygnus.com>
+ * ansidecl.h: Define and test `GCC_VERSION', not `HAVE_GCC_VERSION'.
+
+1999-10-23 08:51 -0700 Zack Weinberg <zack@bitmover.com>
- * libiberty.h (basename): Cygwin{,32} should have the prototype.
+ * hashtab.h: Give hash_table_t a struct tag. Add prototypes
+ for clear_hash_table_slot and traverse_hash_table. Correct
+ prototype of all_hash_table_collisions.
+
+Fri Oct 15 01:47:51 1999 Vladimir Makarov <vmakarov@loony.cygnus.com>
+
+ * hashtab.h: New file.
+
+1999-10-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * ansidecl.h (HAVE_GCC_VERSION): New macro. Use it instead of
+ explicitly testing __GNUC__ and __GNUC_MINOR__.
+
+ (ATTRIBUTE_PRINTF): Use `__format__', not `format'.
+
+1999-09-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * libiberty.h (make_temp_file): Add a prototype.
+
+Tue Sep 14 00:35:02 1999 Marc Espie <espie@cvs.openbsd.org>
+
+ * libiberty.h (basename): OpenBSD has a correct prototype.
+ (xrealloc): Remove outdated comment.
+
+1999-09-07 Jeff Garzik <jgarzik@pobox.com>
+
+ * libiberty.h (xmemdup): Add prototype for new function.
+
+1999-09-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * obstack.h (obstack_grow, obstack_grow0): Move (char*) casts
+ in calls to `_obstack_memcpy' from here ...
+
+ (_obstack_memcpy): ... to here, except in the __STDC__ case which
+ doesn't need it.
+
+1999-08-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * libiberty.h (getpwd): Prototype.
-1999-02-22 Jim Lemke <jlemke@cygnus.com>
+1999-08-01 Mark Mitchell <mark@codesourcery.com>
- * bfdlink.h (bfd_link_info): add field "mpc860c0".
+ * splay-tree.h (splay_tree_insert): Return the new node.
-Mon Feb 1 21:05:46 1999 Catherine Moore <clm@cygnus.com>
+1999-07-11 Ian Lance Taylor <ian@zembu.com>
- * dis-asm.h (print_insn_i386_att): Declare.
- (print_insn_i386_intel): Declare.
+ * ansidecl.h: Copy attribute support macros from egcs.
-998-12-30 Michael Meissner <meissner@cygnus.com>
+1999-04-02 Mark Mitchell <mark@codesourcery.com>
+
+ * splay-tree.h (splay_tree_compare_pointers): Declare.
- * dis-asm.h (INIT_DISASSEMBLE_INFO_NO_ARCH): Cast STREAM and
- FPRINTF_FUNC to avoid compiler warnings.
+1999-03-30 Mark Mitchell <mark@codesourcery.com>
-Wed Dec 30 16:07:14 1998 David Taylor <taylor@texas.cygnus.com>
+ * splay-tree.h (splay_tree_compare_ints): Declare.
- * dis-asm.h: change void * to PTR (two places).
+Wed Mar 24 12:46:29 1999 Andrew Cagney <cagney@amy.cygnus.com>
+
+ * libiberty.h (basename): Cygwin{,32} should have the prototype.
Mon Dec 14 09:53:31 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
@@ -48,15 +98,6 @@ Mon Dec 14 09:53:31 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
Tue Dec 8 00:30:31 1998 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
- The following changes were made by Elena Zannoni
- <ezannoni@kwikemart.cygnus.com> and Edith Epstein
- <eepstein@sophia.cygnus.com> as part of a project to merge in
- changes made by HP; HP did not create ChangeLog entries.
-
- * dis-asm.h (struct disassemble_info): change the type of stream
- from FILE* to void*, for use with gdb's new type GDB_FILE.
- (fprintf_ftype): change FILE* parameter type to void*.
-
* demangle.h: (DMGL_EDG): new macro for Kuck and Associates
(DMGL_STYLE_MASK): modify to include Kuck and Assoc style
(demangling_styles): add new edg_demangling style
@@ -70,17 +111,6 @@ Tue Dec 8 00:30:31 1998 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
(ARM_DEMANGLING): coerce to int.
(HP_DEMANGLING): new macro.
- * hp-symtab.h: rewritten, from HP.
- (quick_procedure): change type of language field to unsigned int
- (quick_module): change type of language field to unsigned int
- (struct dntt_type_svar): add field thread_specific.
- (hp_language): add languages modcal and dmpascal.
-
-Mon Nov 30 15:25:58 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
-
- * elf/sh.h (elf_sh_reloc_type): Add R_SH_FIRST_INVALID_RELOC,
- R_SH_LAST_INVALID_RELOC, R_SH_SWITCH8 and R_SH_max.
-
Fri Nov 20 13:14:00 1998 Andrew Cagney <cagney@b1.cygnus.com>
* libiberty.h (basename): Add prototype for FreeBSD.
@@ -96,19 +126,11 @@ Sun Nov 8 17:42:25 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* demangle.h: Never define PARAMS().
* splay-tree.h: Likewise.
-Sat Nov 7 18:30:20 1998 Peter Schauer <peter.schauer@regent.e-technik.tu-muenchen.de>
-
- * dis-asm.h (print_insn_vax): Declare.
-
Sat Nov 7 16:04:03 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* demangle.h: Don't include gansidecl.h.
* splay-tree.h: Likewise.
-1998-10-26 16:03 Ulrich Drepper <drepper@cygnus.com>
-
- * bfdlink.h (struct bfd_link_info): Add new field optimize.
-
Thu Oct 22 19:58:00 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* splay-tree.h: Wrap function pointer parameter declarations in
@@ -135,10 +157,6 @@ Mon Jun 1 13:48:32 1998 Jason Molenda (crash@bugshack.cygnus.com)
* obstack.h: Update to latest FSF version.
-Tue May 26 20:57:43 1998 Stan Cox <scox@equinox.cygnus.com>
-
- * elf/sparc.h (EF_SPARC_LEDATA, R_SPARC_32LE): Added.
-
Tue Feb 24 13:05:02 1998 Doug Evans <devans@canuck.cygnus.com>
* dis-asm.h (disassemble_info): Member `symbol' renamed to `symbols'
@@ -411,10 +429,6 @@ Thu Feb 6 14:20:01 1997 Martin M. Hunt <hunt@pizza.cygnus.com>
bytes_per_chunk and display_endian to control the
display of raw instructions.
-Fri Dec 27 22:17:37 1996 Fred Fish <fnf@cygnus.com>
-
- * dis-asm.h (print_insn_tic80): Declare.
-
Sun Dec 8 17:11:12 1996 Doug Evans <dje@canuck.cygnus.com>
* callback.h (host_callback): New member `error'.
diff --git a/include/ansidecl.h b/include/ansidecl.h
index cdb9fb71961..9e8a457c2e0 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -1,5 +1,5 @@
/* ANSI and traditional C compatability macros
- Copyright 1991, 1992, 1996 Free Software Foundation, Inc.
+ Copyright 1991, 1992, 1996, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
@@ -160,4 +160,66 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#endif /* ANSI C. */
+
+/* Using MACRO(x,y) in cpp #if conditionals does not work with some
+ older preprocessors. Thus we can't define something like this:
+
+#define HAVE_GCC_VERSION(MAJOR, MINOR) \
+ (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
+
+and then test "#if HAVE_GCC_VERSION(2,7)".
+
+So instead we use the macro below and test it against specific values. */
+
+/* This macro simplifies testing whether we are using gcc, and if it
+ is of a particular minimum version. (Both major & minor numbers are
+ significant.) This macro will evaluate to 0 if we are not using
+ gcc at all. */
+#ifndef GCC_VERSION
+#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
+#endif /* GCC_VERSION */
+
+/* Define macros for some gcc attributes. This permits us to use the
+ macros freely, and know that they will come into play for the
+ version of gcc in which they are supported. */
+
+#if (GCC_VERSION < 2007)
+# define __attribute__(x)
+#endif
+
+/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
+#ifndef ATTRIBUTE_MALLOC
+# if (GCC_VERSION >= 2096)
+# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+# define ATTRIBUTE_MALLOC
+# endif /* GNUC >= 2.96 */
+#endif /* ATTRIBUTE_MALLOC */
+
+/* Attributes on labels were valid as of gcc 2.93. */
+#ifndef ATTRIBUTE_UNUSED_LABEL
+# if (GCC_VERSION >= 2093)
+# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
+# else
+# define ATTRIBUTE_UNUSED_LABEL
+# endif /* GNUC >= 2.93 */
+#endif /* ATTRIBUTE_UNUSED_LABEL */
+
+#ifndef ATTRIBUTE_UNUSED
+#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif /* ATTRIBUTE_UNUSED */
+
+#ifndef ATTRIBUTE_NORETURN
+#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
+#endif /* ATTRIBUTE_NORETURN */
+
+#ifndef ATTRIBUTE_PRINTF
+#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
+#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
+#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
+#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
+#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5)
+#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
+#endif /* ATTRIBUTE_PRINTF */
+
#endif /* ansidecl.h */
diff --git a/include/hashtab.h b/include/hashtab.h
index 77eee14e94f..3990c14cbca 100644
--- a/include/hashtab.h
+++ b/include/hashtab.h
@@ -1,5 +1,5 @@
/* An expandable hash tables datatype.
- Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999 Free Software Foundation, Inc.
Contributed by Vladimir Makarov (vmakarov@cygnus.com).
This program is free software; you can redistribute it and/or modify
@@ -14,7 +14,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* This package implements basic hash table functionality. It is possible
to search for an entry, create an entry and destroy an entry.
@@ -36,168 +36,71 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
extern "C" {
#endif /* __cplusplus */
-#include "ansidecl.h"
+#include <ansidecl.h>
-#ifndef GTY
-#define GTY(X)
-#endif
+/* The hash table element is represented by the following type. */
-/* The type for a hash code. */
-typedef unsigned int hashval_t;
-
-/* Callback function pointer types. */
-
-/* Calculate hash of a table entry. */
-typedef hashval_t (*htab_hash) (const void *);
-
-/* Compare a table entry with a possible entry. The entry already in
- the table always comes first, so the second element can be of a
- different type (but in this case htab_find and htab_find_slot
- cannot be used; instead the variants that accept a hash value
- must be used). */
-typedef int (*htab_eq) (const void *, const void *);
-
-/* Cleanup function called whenever a live element is removed from
- the hash table. */
-typedef void (*htab_del) (void *);
-
-/* Function called by htab_traverse for each live element. The first
- arg is the slot of the element (which can be passed to htab_clear_slot
- if desired), the second arg is the auxiliary pointer handed to
- htab_traverse. Return 1 to continue scan, 0 to stop. */
-typedef int (*htab_trav) (void **, void *);
-
-/* Memory-allocation function, with the same functionality as calloc().
- 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 void *(*htab_alloc) (size_t, size_t);
-
-/* We also need a free() routine. */
-typedef void (*htab_free) (void *);
-
-/* Memory allocation and deallocation; variants which take an extra
- argument. */
-typedef void *(*htab_alloc_with_arg) (void *, size_t, size_t);
-typedef void (*htab_free_with_arg) (void *, void *);
-
-/* This macro defines reserved value for empty table entry. */
-
-#define HTAB_EMPTY_ENTRY ((PTR) 0)
-
-/* This macro defines reserved value for table entry which contained
- a deleted element. */
-
-#define HTAB_DELETED_ENTRY ((PTR) 1)
+typedef const void *hash_table_entry_t;
/* Hash tables are of the following type. The structure
(implementation) of this type is not needed for using the hash
tables. All work with hash table should be executed only through
- functions mentioned below. The size of this structure is subject to
- change. */
+ functions mentioned below. */
-struct htab GTY(())
+typedef struct hash_table
{
- /* Pointer to hash function. */
- htab_hash hash_f;
-
- /* Pointer to comparison function. */
- htab_eq eq_f;
-
- /* Pointer to cleanup function. */
- htab_del del_f;
-
- /* Table itself. */
- void ** GTY ((use_param, length ("%h.size"))) entries;
-
- /* Current size (in entries) of the hash table. */
+ /* Current size (in entries) of the hash table */
size_t size;
-
- /* Current number of elements including also deleted elements. */
- size_t n_elements;
-
- /* Current number of deleted elements in the table. */
- size_t n_deleted;
-
+ /* Current number of elements including also deleted elements */
+ size_t number_of_elements;
+ /* Current number of deleted elements in the table */
+ size_t number_of_deleted_elements;
/* The following member is used for debugging. Its value is number
- of all calls of `htab_find_slot' for the hash table. */
- unsigned int searches;
-
+ of all calls of `find_hash_table_entry' for the hash table. */
+ int searches;
/* The following member is used for debugging. Its value is number
of collisions fixed for time of work with the hash table. */
- unsigned int collisions;
+ int collisions;
+ /* Pointer to function for evaluation of hash value (any unsigned value).
+ This function has one parameter of type hash_table_entry_t. */
+ unsigned (*hash_function) PARAMS ((hash_table_entry_t));
+ /* Pointer to function for test on equality of hash table elements (two
+ parameter of type hash_table_entry_t. */
+ int (*eq_function) PARAMS ((hash_table_entry_t, hash_table_entry_t));
+ /* Table itself */
+ hash_table_entry_t *entries;
+} *hash_table_t;
- /* Pointers to allocate/free functions. */
- htab_alloc alloc_f;
- htab_free free_f;
-
- /* Alternate allocate/free functions, which take an extra argument. */
- void * GTY((skip)) alloc_arg;
- htab_alloc_with_arg alloc_with_arg_f;
- htab_free_with_arg free_with_arg_f;
-
- /* Current size (in entries) of the hash table, as an index into the
- table of primes. */
- unsigned int size_prime_index;
-};
-
-typedef struct htab *htab_t;
-
-/* An enum saying whether we insert into the hash table or not. */
-enum insert_option {NO_INSERT, INSERT};
/* The prototypes of the package functions. */
-extern htab_t htab_create_alloc (size_t, htab_hash,
- htab_eq, htab_del,
- htab_alloc, htab_free);
-
-extern htab_t htab_create_alloc_ex (size_t, htab_hash,
- htab_eq, htab_del,
- void *, htab_alloc_with_arg,
- htab_free_with_arg);
-
-/* Backward-compatibility functions. */
-extern htab_t htab_create (size_t, htab_hash, htab_eq, htab_del);
-extern htab_t htab_try_create (size_t, htab_hash, htab_eq, htab_del);
+extern hash_table_t create_hash_table
+ PARAMS ((size_t, unsigned (*) (hash_table_entry_t),
+ int (*) (hash_table_entry_t, hash_table_entry_t)));
-extern void htab_set_functions_ex (htab_t, htab_hash,
- htab_eq, htab_del,
- void *, htab_alloc_with_arg,
- htab_free_with_arg);
+extern void delete_hash_table PARAMS ((hash_table_t));
-extern void htab_delete (htab_t);
-extern void htab_empty (htab_t);
+extern void empty_hash_table PARAMS ((hash_table_t));
-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);
+extern hash_table_entry_t *find_hash_table_entry
+ PARAMS ((hash_table_t, hash_table_entry_t, int));
-extern void htab_traverse (htab_t, htab_trav, void *);
-extern void htab_traverse_noresize (htab_t, htab_trav, void *);
+extern void remove_element_from_hash_table_entry PARAMS ((hash_table_t,
+ hash_table_entry_t));
-extern size_t htab_size (htab_t);
-extern size_t htab_elements (htab_t);
-extern double htab_collisions (htab_t);
+extern void clear_hash_table_slot PARAMS ((hash_table_t, hash_table_entry_t *));
-/* A hash function for pointers. */
-extern htab_hash htab_hash_pointer;
+extern void traverse_hash_table PARAMS ((hash_table_t,
+ int (*) (hash_table_entry_t, void *),
+ void *));
+
+extern size_t hash_table_size PARAMS ((hash_table_t));
-/* An equality function for pointers. */
-extern htab_eq htab_eq_pointer;
+extern size_t hash_table_elements_number PARAMS ((hash_table_t));
-/* A hash function for null-terminated strings. */
-extern hashval_t htab_hash_string (const void *);
+extern int hash_table_collisions PARAMS ((hash_table_t));
-/* An iterative hash function for arbitrary data. */
-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)
+extern int all_hash_table_collisions PARAMS ((void));
#ifdef __cplusplus
}
diff --git a/include/libiberty.h b/include/libiberty.h
index cf313662ef4..9a536a4a194 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -19,7 +19,7 @@ extern "C" {
/* Build an argument vector from a string. Allocates memory using
malloc. Use freeargv to free the vector. */
-extern char **buildargv PARAMS ((char *));
+extern char **buildargv PARAMS ((char *)) ATTRIBUTE_MALLOC;
/* Free a vector returned by buildargv. */
@@ -28,7 +28,7 @@ extern void freeargv PARAMS ((char **));
/* Duplicate an argument vector. Allocates memory using malloc. Use
freeargv to free the vector. */
-extern char **dupargv PARAMS ((char **));
+extern char **dupargv PARAMS ((char **)) ATTRIBUTE_MALLOC;
/* Return the last component of a path name. Note that we can't use a
@@ -36,7 +36,7 @@ extern char **dupargv PARAMS ((char **));
across different systems, sometimes as "char *" and sometimes as
"const char *" */
-#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__)
+#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__)
extern char *basename PARAMS ((const char *));
#else
extern char *basename ();
@@ -45,19 +45,28 @@ extern char *basename ();
/* Concatenate an arbitrary number of strings, up to (char *) NULL.
Allocates memory using xmalloc. */
-extern char *concat PARAMS ((const char *, ...));
+extern char *concat PARAMS ((const char *, ...)) ATTRIBUTE_MALLOC;
/* Check whether two file descriptors refer to the same file. */
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));
/* Choose a temporary directory to use for scratch files. */
-extern char *choose_temp_base PARAMS ((void));
+extern char *choose_temp_base PARAMS ((void)) ATTRIBUTE_MALLOC;
+
+/* Return a temporary file name or NULL if unable to create one. */
+
+extern char *make_temp_file PARAMS ((const char *)) ATTRIBUTE_MALLOC;
/* Allocate memory filled with spaces. Allocates using malloc. */
@@ -108,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
+extern void xexit PARAMS ((int status)) ATTRIBUTE_NORETURN;
/* Set the program name used by xmalloc. */
@@ -125,24 +130,29 @@ 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.
+extern PTR xmalloc PARAMS ((size_t)) ATTRIBUTE_MALLOC;
- 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));
/* Allocate memory without fail and set it to zero. This works like
xmalloc. */
-extern PTR xcalloc PARAMS ((size_t, size_t));
+extern PTR xcalloc PARAMS ((size_t, size_t)) ATTRIBUTE_MALLOC;
/* Copy a string into a memory buffer without fail. */
-extern char *xstrdup PARAMS ((const char *));
+extern char *xstrdup PARAMS ((const char *)) ATTRIBUTE_MALLOC;
+
+/* Copy an existing memory buffer to a new memory buffer without fail. */
+
+extern PTR xmemdup PARAMS ((const PTR, size_t, size_t)) ATTRIBUTE_MALLOC;
/* hex character manipulation routines */
@@ -172,6 +182,17 @@ 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 *, ...)) ATTRIBUTE_PRINTF_2;
+
+/* 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))
+ ATTRIBUTE_PRINTF(2,0);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/obstack.h b/include/obstack.h
index 38e96777660..a20ab55967a 100644
--- a/include/obstack.h
+++ b/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/include/splay-tree.h b/include/splay-tree.h
index e828fe7e907..6d70c8d9075 100644
--- a/include/splay-tree.h
+++ b/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/include/symcat.h b/include/symcat.h
index 01efada2618..3e27162b264 100644
--- a/include/symcat.h
+++ b/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)