Compare commits

...

3 Commits

Author SHA1 Message Date
Ben Elliston
2404ea55ab Import GNU gettext 0.10.35 2001-11-29 03:23:40 +00:00
Ian Lance Taylor
cc89ffe60b import libiberty from egcs 2000-02-22 16:18:13 +00:00
Ian Lance Taylor
e2eaf47799 import libiberty from egcs 2000-02-22 15:59:20 +00:00
59 changed files with 5127 additions and 618 deletions

View File

@@ -1,15 +1,83 @@
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.
* 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.
1999-11-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* libiberty.h: Include stdarg.h when ANSI_PROTOTYPES is defined.
(asprintf, vasprintf): Provide declarations.
Wed Nov 10 12:43:21 1999 Philippe De Muyter <phdm@macqel.be>
Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* ansidecl.h: Define and test `GCC_VERSION', not `HAVE_GCC_VERSION'.
1999-10-23 08:51 -0700 Zack Weinberg <zack@bitmover.com>
* 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-08-01 Mark Mitchell <mark@codesourcery.com>
* splay-tree.h (splay_tree_insert): Return the new node.
1999-07-11 Ian Lance Taylor <ian@zembu.com>
* ansidecl.h: Copy attribute support macros from egcs.
1999-04-02 Mark Mitchell <mark@codesourcery.com>
@@ -23,24 +91,6 @@ Wed Mar 24 12:46:29 1999 Andrew Cagney <cagney@amy.cygnus.com>
* libiberty.h (basename): Cygwin{,32} should have the prototype.
1999-02-22 Jim Lemke <jlemke@cygnus.com>
* bfdlink.h (bfd_link_info): add field "mpc860c0".
Mon Feb 1 21:05:46 1999 Catherine Moore <clm@cygnus.com>
* dis-asm.h (print_insn_i386_att): Declare.
(print_insn_i386_intel): Declare.
998-12-30 Michael Meissner <meissner@cygnus.com>
* dis-asm.h (INIT_DISASSEMBLE_INFO_NO_ARCH): Cast STREAM and
FPRINTF_FUNC to avoid compiler warnings.
Wed Dec 30 16:07:14 1998 David Taylor <taylor@texas.cygnus.com>
* dis-asm.h: change void * to PTR (two places).
Mon Dec 14 09:53:31 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* demangle.h: Don't check IN_GCC anymore.
@@ -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'.

View File

@@ -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 */

109
include/hashtab.h Normal file
View File

@@ -0,0 +1,109 @@
/* An expandable hash tables datatype.
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
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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.
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., 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.
Elements in the table are generic pointers.
The size of the table is not fixed; if the occupancy of the table
grows too high the hash table will be expanded.
The abstract data implementation is based on generalized Algorithm D
from Knuth's book "The art of computer programming". Hash table is
expanded by creation of new hash table and transferring elements from
the old table to the new table. */
#ifndef __HASHTAB_H__
#define __HASHTAB_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <ansidecl.h>
/* The hash table element is represented by the following type. */
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. */
typedef struct hash_table
{
/* Current size (in entries) of the hash table */
size_t size;
/* 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 `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. */
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;
/* The prototypes of the package functions. */
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 delete_hash_table PARAMS ((hash_table_t));
extern void empty_hash_table PARAMS ((hash_table_t));
extern hash_table_entry_t *find_hash_table_entry
PARAMS ((hash_table_t, hash_table_entry_t, int));
extern void remove_element_from_hash_table_entry PARAMS ((hash_table_t,
hash_table_entry_t));
extern void clear_hash_table_slot PARAMS ((hash_table_t, hash_table_entry_t *));
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));
extern size_t hash_table_elements_number PARAMS ((hash_table_t));
extern int hash_table_collisions PARAMS ((hash_table_t));
extern int all_hash_table_collisions PARAMS ((void));
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __HASHTAB_H */

View File

@@ -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));
extern PTR xmalloc PARAMS ((size_t)) ATTRIBUTE_MALLOC;
/* 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));
/* 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

View File

@@ -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))
#else
# ifdef memcpy
# if defined __STDC__ && __STDC__
# define _obstack_memcpy(To, From, N) memcpy ((To), (From), (N))
# else
# define _obstack_memcpy(To, From, N) bcopy ((From), (To), (N))
# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N))
# endif
#else
# ifdef memcpy
# define _obstack_memcpy(To, From, N) memcpy ((To), (char *)(From), (N))
# else
# 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)

View File

@@ -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

View File

@@ -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)

View File

@@ -1,3 +1,67 @@
1998-04-29 Ulrich Drepper <drepper@cygnus.com>
* intl/localealias.c (read_alias_file): Use unsigned char for
local variables. Remove unused variable tp.
* intl/l10nflist.c (_nl_normalize_codeset): Use unsigned char *
for type of codeset. For loosing Solaris systems.
* intl/loadinfo.h: Adapt prototype of _nl_normalize_codeset.
* intl/bindtextdom.c (BINDTEXTDOMAIN): Don't define local variable
len if not needed.
Patches by Jim Meyering.
1998-04-28 Ulrich Drepper <drepper@cygnus.com>
* loadmsgcat.c (_nl_load_domain): Don't assign the element use_mmap if
mmap is not supported.
* hash-string.h: Don't include <values.h>.
1998-04-27 Ulrich Drepper <drepper@cygnus.com>
* textdomain.c: Use strdup is available.
* localealias.c: Define HAVE_MEMPCPY so that we can use this
function. Define and use semapahores to protect modfication of
global objects when compiling for glibc. Add code to allow
freeing alias table.
* l10nflist.c: Don't assume stpcpy not being a macro.
* gettextP.h: Define internal_function macri if not already done.
Use glibc byte-swap macros instead of defining SWAP when compiled
for glibc.
(struct loaded_domain): Add elements to allow unloading.
* Makefile.in (distclean): Don't remove libintl.h here.
* bindtextdomain.c: Carry over changes from glibc. Use strdup if
available.
* dcgettext.c: Don't assume stpcpy not being a macro. Mark internal
functions. Add memory freeing code for glibc.
* dgettext.c: Update copyright.
* explodename.c: Include stdlib.h and string.h only if they exist.
Use strings.h eventually.
* finddomain.c: Mark internal functions. Use strdup if available.
Add memory freeing code for glibc.
1997-10-10 20:00 Ulrich Drepper <drepper@cygnus.com>
* libgettext.h: Fix dummy textdomain and bindtextdomain macros.
They should return reasonable values.
Reported by Tom Tromey <tromey@cygnus.com>.
1997-09-16 03:33 Ulrich Drepper <drepper@cygnus.com>
* libgettext.h: Define PARAMS also to `args' if __cplusplus is defined.
* intlh.inst.in: Likewise.
Reported by Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>.
* libintl.glibc: Update from current glibc version.
1997-09-06 02:10 Ulrich Drepper <drepper@cygnus.com>
* intlh.inst.in: Reformat copyright.

View File

@@ -1,5 +1,5 @@
# Makefile for directory with message catalog handling in GNU NLS Utilities.
# Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# Copyright (C) 1995, 1996, 1997 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
@@ -79,13 +79,12 @@ DISTFILES.gettext = libintl.glibc intlh.inst.in
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) $<
INCLUDES = -I. -I$(srcdir)
INCLUDES = -I.. -I. -I$(top_srcdir)/intl -I$(top_srcdir)/lib
all: all-@USE_INCLUDED_LIBINTL@
all-yes: libintl.$la intlh.inst
all-no:
install-info:
libintl.a: $(OBJECTS)
rm -f $@
@@ -151,7 +150,7 @@ uninstall:
info dvi:
$(OBJECTS): config.h libgettext.h
$(OBJECTS): ../config.h libgettext.h
bindtextdom.$lo finddomain.$lo loadmsgcat.$lo: gettextP.h gettext.h loadinfo.h
dcgettext.$lo: gettextP.h gettext.h hash-string.h loadinfo.h
@@ -172,7 +171,7 @@ mostlyclean:
clean: mostlyclean
distclean: clean
rm -f Makefile ID TAGS po2msg.sed po2tbl.sed libintl.h config.log
rm -f Makefile ID TAGS po2msg.sed po2tbl.sed
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@@ -196,8 +195,9 @@ dist distdir: Makefile $(DISTFILES)
dist-libc:
tar zcvf intl-glibc.tar.gz $(COMSRCS) $(COMHDRS) libintl.h.glibc
Makefile: Makefile.in config.status
CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
Makefile: Makefile.in ../config.status
cd .. \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
# The dependency for intlh.inst is different in gettext and all other
# packages. Because we cannot you GNU make features we have to solve

View File

@@ -1,5 +1,5 @@
/* Implementation of the bindtextdomain(3) function
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998 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
@@ -61,7 +61,9 @@ extern struct binding *_nl_domain_bindings;
prefix. So we have to make a difference here. */
#ifdef _LIBC
# define BINDTEXTDOMAIN __bindtextdomain
# define strdup(str) __strdup (str)
# ifndef strdup
# define strdup(str) __strdup (str)
# endif
#else
# define BINDTEXTDOMAIN bindtextdomain__
#endif
@@ -133,7 +135,9 @@ BINDTEXTDOMAIN (domainname, dirname)
else
{
/* We have to create a new binding. */
#if !defined _LIBC && !defined HAVE_STRDUP
size_t len;
#endif
struct binding *new_binding =
(struct binding *) malloc (sizeof (*new_binding));

View File

@@ -1,5 +1,5 @@
/* Implementation of the dcgettext(3) function
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
/* Implementation of the dcgettext(3) function.
Copyright (C) 1995, 1996, 1997, 1998 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
@@ -91,7 +91,9 @@ void free ();
because some ANSI C functions will require linking with this object
file and the name space must not be polluted. */
# define getcwd __getcwd
# define stpcpy __stpcpy
# ifndef stpcpy
# define stpcpy __stpcpy
# endif
#else
# if !defined HAVE_GETCWD
char *getwd ();
@@ -162,10 +164,11 @@ struct binding *_nl_domain_bindings;
/* Prototypes for local functions. */
static char *find_msg PARAMS ((struct loaded_l10nfile *domain_file,
const char *msgid));
static const char *category_to_name PARAMS ((int category));
const char *msgid)) internal_function;
static const char *category_to_name PARAMS ((int category)) internal_function;
static const char *guess_category_value PARAMS ((int category,
const char *categoryname));
const char *categoryname))
internal_function;
/* For those loosing systems which don't have `alloca' we have to add
@@ -388,6 +391,7 @@ weak_alias (__dcgettext, dcgettext);
static char *
internal_function
find_msg (domain_file, msgid)
struct loaded_l10nfile *domain_file;
const char *msgid;
@@ -476,6 +480,7 @@ find_msg (domain_file, msgid)
/* Return string representation of locale CATEGORY. */
static const char *
internal_function
category_to_name (category)
int category;
{
@@ -535,6 +540,7 @@ category_to_name (category)
/* Guess value of current locale from value of the environment variables. */
static const char *
internal_function
guess_category_value (category, categoryname)
int category;
const char *categoryname;
@@ -591,3 +597,28 @@ stpcpy (dest, src)
return dest - 1;
}
#endif
#ifdef _LIBC
/* If we want to free all resources we have to do some work at
program's end. */
static void __attribute__ ((unused))
free_mem (void)
{
struct binding *runp;
for (runp = _nl_domain_bindings; runp != NULL; runp = runp->next)
{
free (runp->domainname);
if (runp->dirname != _nl_default_dirname)
/* Yes, this is a pointer comparison. */
free (runp->dirname);
}
if (_nl_current_default_domain != _nl_default_default_domain)
/* Yes, again a pointer comparison. */
free ((char *) _nl_current_default_domain);
}
text_set_element (__libc_subfreeres, free_mem);
#endif

View File

@@ -1,19 +1,19 @@
/* dgettext.c -- implementation of the dgettext(3) function
Copyright (C) 1995 Software Foundation, Inc.
/* Implementation of the dgettext(3) function
Copyright (C) 1995, 1996, 1997 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
the Free Software Foundation; either version 2, or (at your option)
any later version.
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
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program 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.
This program 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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify
@@ -19,8 +19,15 @@
# include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
#if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h>
#endif
#if defined HAVE_STRING_H || defined _LIBC
# include <string.h>
#else
# include <strings.h>
#endif
#include <sys/types.h>
#include "loadinfo.h"

View File

@@ -1,5 +1,5 @@
/* Handle list of needed message catalogs
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify
@@ -70,6 +70,7 @@ static struct loaded_l10nfile *_nl_loaded_domains;
the DOMAINNAME and CATEGORY parameters with respect to the currently
established bindings. */
struct loaded_l10nfile *
internal_function
_nl_find_domain (dirname, locale, domainname)
const char *dirname;
char *locale;
@@ -95,9 +96,9 @@ _nl_find_domain (dirname, locale, domainname)
language[_territory][+audience][+special][,[sponsor][_revision]]
Beside the first all of them are allowed to be missing. If the
full specified locale is not found, the less specific one are
looked for. The various part will be stripped of according to
Beside the first part all of them are allowed to be missing. If
the full specified locale is not found, the less specific one are
looked for. The various parts will be stripped off according to
the following order:
(1) revision
(2) sponsor
@@ -142,12 +143,18 @@ _nl_find_domain (dirname, locale, domainname)
alias_value = _nl_expand_alias (locale);
if (alias_value != NULL)
{
#if defined _LIBC || defined HAVE_STRDUP
locale = strdup (alias_value);
if (locale == NULL)
return NULL;
#else
size_t len = strlen (alias_value) + 1;
locale = (char *) malloc (len);
if (locale == NULL)
return NULL;
memcpy (locale, alias_value, len);
#endif
}
/* Now we determine the single parts of the locale name. First
@@ -187,3 +194,23 @@ _nl_find_domain (dirname, locale, domainname)
return retval;
}
#ifdef _LIBC
static void __attribute__ ((unused))
free_mem (void)
{
struct loaded_l10nfile *runp = _nl_loaded_domains;
while (runp != NULL)
{
struct loaded_l10nfile *here = runp;
if (runp->data != NULL)
_nl_unload_domain ((struct loaded_domain *) runp->data);
runp = runp->next;
free (here);
}
}
text_set_element (__libc_subfreeres, free_mem);
#endif

View File

@@ -1,4 +1,4 @@
/* Implementation of gettext(3) function
/* Implementation of gettext(3) function.
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
/* Internal header for GNU gettext internationalization functions
/* Internal header for GNU gettext internationalization functions.
Copyright (C) 1995, 1997 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify

View File

@@ -1,5 +1,6 @@
/* Header describing internals of gettext library
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
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
@@ -30,11 +31,19 @@
# endif
#endif
#ifndef internal_function
# define internal_function
#endif
#ifndef W
# define W(flag, data) ((flag) ? SWAP (data) : (data))
#endif
#ifdef _LIBC
# include <byteswap.h>
# define SWAP(i) bswap_32 (i)
#else
static nls_uint32 SWAP PARAMS ((nls_uint32 i));
static inline nls_uint32
@@ -43,11 +52,14 @@ SWAP (i)
{
return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
}
#endif
struct loaded_domain
{
const char *data;
int use_mmap;
size_t mmap_size;
int must_swap;
nls_uint32 nstrings;
struct string_desc *orig_tab;
@@ -65,8 +77,12 @@ struct binding
struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
char *__locale,
const char *__domainname));
void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain));
const char *__domainname))
internal_function;
void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain))
internal_function;
void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
internal_function;
/* @@ begin of epilog @@ */

View File

@@ -16,10 +16,6 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef HAVE_VALUES_H
# include <values.h>
#endif
/* @@ end of prolog @@ */
#ifndef PARAMS

View File

@@ -26,7 +26,7 @@
#define __USE_GNU_GETTEXT 1
#ifndef PARAMS
# if __STDC__
# if __STDC__ || defined __cplusplus
# define PARAMS(args) args
# else
# define PARAMS(args) ()

View File

@@ -1,6 +1,6 @@
/* Handle list of needed message catalogs
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
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
@@ -65,7 +65,9 @@
/* Rename the non ANSI C functions. This is required by the standard
because some ANSI C functions will require linking with this object
file and the name space must not be polluted. */
# define stpcpy(dest, src) __stpcpy(dest, src)
# ifndef stpcpy
# define stpcpy(dest, src) __stpcpy(dest, src)
# endif
#else
# ifndef HAVE_STPCPY
static char *stpcpy PARAMS ((char *dest, const char *src));
@@ -350,7 +352,7 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
names. */
const char *
_nl_normalize_codeset (codeset, name_len)
const char *codeset;
const unsigned char *codeset;
size_t name_len;
{
int len = 0;

View File

@@ -1,5 +1,5 @@
/* Message catalogs for internationalization.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998 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
@@ -20,8 +20,8 @@
include protection above. But the systems header might perhaps also
define _LIBINTL_H and therefore we have to protect the definition here. */
#if !defined (_LIBINTL_H) || !defined (_LIBGETTEXT_H)
#if !defined (_LIBINTL_H)
#if !defined _LIBINTL_H || !defined _LIBGETTEXT_H
#ifndef _LIBINTL_H
# define _LIBINTL_H 1
#endif
#define _LIBGETTEXT_H 1
@@ -44,7 +44,7 @@ extern "C" {
/* @@ end of prolog @@ */
#ifndef PARAMS
# if __STDC__
# if __STDC__ || defined __cplusplus
# define PARAMS(args) args
# else
# define PARAMS(args) ()
@@ -168,8 +168,8 @@ extern int _nl_msg_cat_cntr;
# define gettext(Msgid) (Msgid)
# define dgettext(Domainname, Msgid) (Msgid)
# define dcgettext(Domainname, Msgid, Category) (Msgid)
# define textdomain(Domainname) while (0) /* nothing */
# define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
# define textdomain(Domainname) ((char *) Domainname)
# define bindtextdomain(Domainname, Dirname) ((char *) Dirname)
#endif

View File

@@ -1,33 +1,31 @@
/* libgettext.h -- Message catalogs for internationalization.
Copyright (C) 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper.
This file is derived from the file libgettext.h in the GNU gettext package.
/* Message catalogs for internationalization.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This file is derived from the file libgettext.h in the GNU gettext package.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however.
The GNU C Library 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
Library General Public License for more details.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _LIBINTL_H
#define _LIBINTL_H 1
#include <features.h>
#include <locale.h>
#define __need_NULL
#include <stddef.h>
/* We define an additional symbol to signal that we use the GNU
implementation of gettext. */
#define __USE_GNU_GETTEXT 1
@@ -70,8 +68,16 @@ extern char *__bindtextdomain __P ((__const char *__domainname,
/* Optimized version of the function above. */
#if defined __OPTIMIZED
/* These must be a macro. Inlined functions are useless because the
#if defined __OPTIMIZE__
/* We need NULL for `gettext'. */
# define __need_NULL
# include <stddef.h>
/* We need LC_MESSAGES for `dgettext'. */
# include <locale.h>
/* These must be macros. Inlined functions are useless because the
`__builtin_constant_p' predicate in dcgettext would always return
false. */
@@ -81,13 +87,16 @@ extern char *__bindtextdomain __P ((__const char *__domainname,
dcgettext (domainname, msgid, LC_MESSAGES)
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
/* Variable defined in loadmsgcat.c which gets incremented every time a
new catalog is loaded. */
extern int _nl_msg_cat_cntr;
# define dcgettext(domainname, msgid, category) \
(__extension__ \
({ \
char *result; \
char *__result; \
if (__builtin_constant_p (msgid)) \
{ \
extern int _nl_msg_cat_cntr; \
static char *__translation__; \
static int __catalog_counter__; \
if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
@@ -96,11 +105,11 @@ extern char *__bindtextdomain __P ((__const char *__domainname,
__dcgettext ((domainname), (msgid), (category)); \
__catalog_counter__ = _nl_msg_cat_cntr; \
} \
result = __translation__; \
__result = __translation__; \
} \
else \
result = __dcgettext ((domainname), (msgid), (category)); \
result; \
__result = __dcgettext ((domainname), (msgid), (category)); \
__result; \
}))
# endif
#endif /* Optimizing. */

View File

@@ -1,3 +1,21 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
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
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program 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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef PARAMS
# if __STDC__
# define PARAMS(args) args
@@ -32,7 +50,7 @@ struct loaded_l10nfile
};
extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
extern const char *_nl_normalize_codeset PARAMS ((const unsigned char *codeset,
size_t name_len));
extern struct loaded_l10nfile *

View File

@@ -1,5 +1,5 @@
/* Load needed message catalogs
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
/* Load needed message catalogs.
Copyright (C) 1995, 1996, 1997, 1998 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
@@ -44,7 +44,6 @@
/* Rename the non ISO C functions. This is required by the standard
because some ISO C functions will require linking with this object
file and the name space must not be polluted. */
# define fstat __fstat
# define open __open
# define close __close
# define read __read
@@ -61,10 +60,12 @@ int _nl_msg_cat_cntr = 0;
/* Load the message catalogs specified by FILENAME. If it is no valid
message catalog do nothing. */
void
internal_function
_nl_load_domain (domain_file)
struct loaded_l10nfile *domain_file;
{
int fd;
size_t size;
struct stat st;
struct mo_file_header *data = (struct mo_file_header *) -1;
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
@@ -90,7 +91,8 @@ _nl_load_domain (domain_file)
/* We must know about the size of the file. */
if (fstat (fd, &st) != 0
&& st.st_size < (off_t) sizeof (struct mo_file_header))
|| (size = (size_t) st.st_size) != st.st_size
|| size < sizeof (struct mo_file_header))
{
/* Something went wrong. */
close (fd);
@@ -101,7 +103,7 @@ _nl_load_domain (domain_file)
|| defined _LIBC
/* Now we are ready to load the file. If mmap() is available we try
this first. If not available or it failed we try to load it. */
data = (struct mo_file_header *) mmap (NULL, st.st_size, PROT_READ,
data = (struct mo_file_header *) mmap (NULL, size, PROT_READ,
MAP_PRIVATE, fd, 0);
if (data != (struct mo_file_header *) -1)
@@ -116,14 +118,14 @@ _nl_load_domain (domain_file)
it manually. */
if (data == (struct mo_file_header *) -1)
{
off_t to_read;
size_t to_read;
char *read_ptr;
data = (struct mo_file_header *) malloc (st.st_size);
data = (struct mo_file_header *) malloc (size);
if (data == NULL)
return;
to_read = st.st_size;
to_read = size;
read_ptr = (char *) data;
do
{
@@ -150,7 +152,7 @@ _nl_load_domain (domain_file)
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|| defined _LIBC
if (use_mmap)
munmap ((caddr_t) data, st.st_size);
munmap ((caddr_t) data, size);
else
#endif
free (data);
@@ -164,6 +166,11 @@ _nl_load_domain (domain_file)
domain = (struct loaded_domain *) domain_file->data;
domain->data = (char *) data;
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|| defined _LIBC
domain->use_mmap = use_mmap;
#endif
domain->mmap_size = size;
domain->must_swap = data->magic != _MAGIC;
/* Fill in the information about the available tables. */
@@ -184,7 +191,7 @@ _nl_load_domain (domain_file)
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|| defined _LIBC
if (use_mmap)
munmap ((caddr_t) data, st.st_size);
munmap ((caddr_t) data, size);
else
#endif
free (data);
@@ -197,3 +204,19 @@ _nl_load_domain (domain_file)
translations invalid. */
++_nl_msg_cat_cntr;
}
#ifdef _LIBC
void
internal_function
_nl_unload_domain (domain)
struct loaded_domain *domain;
{
if (domain->use_mmap)
munmap ((caddr_t) domain->data, domain->mmap_size);
else
free ((void *) domain->data);
free (domain);
}
#endif

View File

@@ -1,5 +1,5 @@
/* Handle aliases for locale names
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
/* Handle aliases for locale names.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify
@@ -79,6 +79,14 @@ void free ();
because some ANSI C functions will require linking with this object
file and the name space must not be polluted. */
# define strcasecmp __strcasecmp
# define mempcpy __mempcpy
# define HAVE_MEMPCPY 1
/* We need locking here since we can be called from different places. */
# include <bits/libc-lock.h>
__libc_lock_define_initialized (static, lock);
#endif
@@ -125,13 +133,17 @@ struct alias_map
};
static char *string_space = NULL;
static size_t string_space_act = 0;
static size_t string_space_max = 0;
static struct alias_map *map;
static size_t nmap = 0;
static size_t maxmap = 0;
/* Prototypes for local functions. */
static size_t read_alias_file PARAMS ((const char *fname, int fname_len));
static size_t read_alias_file PARAMS ((const char *fname, int fname_len))
internal_function;
static void extend_alias_table PARAMS ((void));
static int alias_compare PARAMS ((const struct alias_map *map1,
const struct alias_map *map2));
@@ -143,8 +155,13 @@ _nl_expand_alias (name)
{
static const char *locale_alias_path = LOCALE_ALIAS_PATH;
struct alias_map *retval;
const char *result = NULL;
size_t added;
#ifdef _LIBC
__libc_lock_lock (lock);
#endif
do
{
struct alias_map item;
@@ -162,7 +179,10 @@ _nl_expand_alias (name)
/* We really found an alias. Return the value. */
if (retval != NULL)
return retval->value;
{
result = retval->value;
break;
}
/* Perhaps we can find another alias file. */
added = 0;
@@ -183,11 +203,16 @@ _nl_expand_alias (name)
}
while (added != 0);
return NULL;
#ifdef _LIBC
__libc_lock_unlock (lock);
#endif
return result;
}
static size_t
internal_function
read_alias_file (fname, fname_len)
const char *fname;
int fname_len;
@@ -202,8 +227,13 @@ read_alias_file (fname, fname_len)
full_fname = (char *) alloca (fname_len + sizeof aliasfile);
ADD_BLOCK (block_list, full_fname);
#ifdef HAVE_MEMPCPY
mempcpy (mempcpy (full_fname, fname, fname_len),
aliasfile, sizeof aliasfile);
#else
memcpy (full_fname, fname, fname_len);
memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
#endif
fp = fopen (full_fname, "r");
if (fp == NULL)
@@ -220,15 +250,28 @@ read_alias_file (fname, fname_len)
b) these fields must be usable as file names and so must not
be that long
*/
char buf[BUFSIZ];
char *alias;
char *value;
char *cp;
unsigned char buf[BUFSIZ];
unsigned char *alias;
unsigned char *value;
unsigned char *cp;
if (fgets (buf, BUFSIZ, fp) == NULL)
if (fgets (buf, sizeof buf, fp) == NULL)
/* EOF reached. */
break;
/* Possibly not the whole line fits into the buffer. Ignore
the rest of the line. */
if (strchr (buf, '\n') == NULL)
{
char altbuf[BUFSIZ];
do
if (fgets (altbuf, sizeof altbuf, fp) == NULL)
/* Make sure the inner loop will be left. The outer loop
will exit at the `feof' test. */
break;
while (strchr (altbuf, '\n') == NULL);
}
cp = buf;
/* Ignore leading white space. */
while (isspace (cp[0]))
@@ -250,8 +293,8 @@ read_alias_file (fname, fname_len)
if (cp[0] != '\0')
{
char *tp;
size_t len;
size_t alias_len;
size_t value_len;
value = cp++;
while (cp[0] != '\0' && !isspace (cp[0]))
@@ -271,42 +314,37 @@ read_alias_file (fname, fname_len)
if (nmap >= maxmap)
extend_alias_table ();
/* We cannot depend on strdup available in the libc. Sigh! */
len = strlen (alias) + 1;
tp = (char *) malloc (len);
if (tp == NULL)
{
FREE_BLOCKS (block_list);
return added;
}
memcpy (tp, alias, len);
map[nmap].alias = tp;
alias_len = strlen (alias) + 1;
value_len = strlen (value) + 1;
len = strlen (value) + 1;
tp = (char *) malloc (len);
if (tp == NULL)
if (string_space_act + alias_len + value_len > string_space_max)
{
FREE_BLOCKS (block_list);
return added;
/* Increase size of memory pool. */
size_t new_size = (string_space_max
+ (alias_len + value_len > 1024
? alias_len + value_len : 1024));
char *new_pool = (char *) realloc (string_space, new_size);
if (new_pool == NULL)
{
FREE_BLOCKS (block_list);
return added;
}
string_space = new_pool;
string_space_max = new_size;
}
memcpy (tp, value, len);
map[nmap].value = tp;
map[nmap].alias = memcpy (&string_space[string_space_act],
alias, alias_len);
string_space_act += alias_len;
map[nmap].value = memcpy (&string_space[string_space_act],
value, value_len);
string_space_act += value_len;
++nmap;
++added;
}
}
/* Possibly not the whole line fits into the buffer. Ignore
the rest of the line. */
while (strchr (cp, '\n') == NULL)
{
cp = buf;
if (fgets (buf, BUFSIZ, fp) == NULL)
/* Make sure the inner loop will be left. The outer loop
will exit at the `feof' test. */
*cp = '\n';
}
}
/* Should we test for ferror()? I think we have to silently ignore
@@ -329,22 +367,30 @@ extend_alias_table ()
struct alias_map *new_map;
new_size = maxmap == 0 ? 100 : 2 * maxmap;
new_map = (struct alias_map *) malloc (new_size
* sizeof (struct alias_map));
new_map = (struct alias_map *) realloc (map, (new_size
* sizeof (struct alias_map)));
if (new_map == NULL)
/* Simply don't extend: we don't have any more core. */
return;
memcpy (new_map, map, nmap * sizeof (struct alias_map));
if (maxmap != 0)
free (map);
map = new_map;
maxmap = new_size;
}
#ifdef _LIBC
static void __attribute__ ((unused))
free_mem (void)
{
if (string_space != NULL)
free (string_space);
if (map != NULL)
free (map);
}
text_set_element (__libc_subfreeres, free_mem);
#endif
static int
alias_compare (map1, map2)
const struct alias_map *map1;

View File

@@ -1,5 +1,5 @@
/* Implementation of the textdomain(3) function
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
/* Implementation of the textdomain(3) function.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify
@@ -54,7 +54,9 @@ extern const char *_nl_current_default_domain;
prefix. So we have to make a difference here. */
#ifdef _LIBC
# define TEXTDOMAIN __textdomain
# define strdup(str) __strdup (str)
# ifndef strdup
# define strdup(str) __strdup (str)
# endif
#else
# define TEXTDOMAIN textdomain__
#endif

View File

@@ -1,3 +1,286 @@
2000-01-04 Mumit Khan <khan@xraylith.wisc.edu>
* pexecute.c: Conditionally include string.h.
(fix_argv): Handle embedded whitespace in args for Mingw32.
2000-01-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* configure.in (ac_libiberty_warn_cflags): Turn on warnings if
we're using gcc.
* Makefile.in (COMPILE.c): Add @ac_libiberty_warn_cflags@
1999-12-27 Geoff Keating <geoffk@cygnus.com>
* vasprintf.c (int_vasprintf): Don't re-read the format character
as this mishandles strings like '%%s'.
1999-12-05 Mark Mitchell <mark@codesourcery.com>
* splay-tree.c (splay_tree_new): Use struct splay_tree_node_s
rather than struct splay_tree_node.
(splay_tree_insert): Use struct splay_tree_s rather than struct
splay_tree.
Sun Nov 28 00:59:39 1999 Philippe De Muyter <phdm@macqel.be>
* hashtab.c (sys/types.h): File included.
1999-11-22 Jason Merrill <jason@casey.cygnus.com>
* strtoul.c, strtol.c, random.c: Remove advertising clause from
BSD license, pursuant with
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
Wed Nov 10 09:42:39 1999 Jeffrey A Law (law@cygnus.com)
* hashtab.c: Include stdio.h.
Mon Nov 8 09:23:41 1999 Jeffrey A Law (law@cygnus.com)
* hashtab.c (traverse_hash_table): Protect prototype with PARAMS.
Tue Nov 2 03:23:13 1999 Philippe De Muyter <phdm@macqel.be>
* xstrdup (sys/types.h): Include this file.
1999-10-28 Nathan Sidwell <nathan@acm.org>
* Makefile.in (SUBDIRS): New macro.
(mostlyclean, clean, distclean, maintainer-clean): Adjust to
avoid multiple subdirectory cleaning.
(*-subdir): Use SUBDIRS.
1999-10-25 Jim Kingdon <http://developer.redhat.com/>
* cplus-dem.c: Move declarations of standard_symbol_characters and
hp_symbol_characters inside #ifdef MAIN to avoid compiler
warnings.
1999-10-23 08:51 -0700 Zack Weinberg <zack@bitmover.com>
* hashtab.c (find_hash_table_entry): When returning a
DELETED_ENTRY slot, change it to EMPTY_ENTRY first.
(clear_hash_table_slot): New function which deletes an entry
by its position in the table, not its value.
(traverse_hash_table): New function which calls a hook
function for every live entry in the table.
1999-10-19 Mark Mitchell <mark@codesourcery.com>
* cplus-dem.c (INTBUF_SIZE): New macro.
(string_append_template_idx): New function.
(demangle_expression): Likewise.
(demangle_integral_value): Use it.
(demangle_real_value): New function, split out from ...
(demangle_template_value_parm): ... here. Use
string_append_template_idx. Use demangle_real_value.
(demangle_template): Use string_append_template_idx.
(demangle_qualified): Use consume_count_with_underscores.
(get_count): Tweak formatting.
(do_type): Use string_append_template_idx.
1999-10-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* calloc.c: Add a public domain notice.
Mon Oct 18 02:30:47 1999 Philippe De Muyter <phdm@macqel.be>
* setenv.c (sys/types.h, stdio.h): Include those files unconditionaly.
Fri Oct 15 01:47:51 1999 Vladimir Makarov <vmakarov@loony.cygnus.com>
* Makefile.in (CFILES): Add hashtab.c
(REQUIRED_OFILES): Add hashtab.o
(hashtab.o): Add dependencies.
* hashtab.c: New file
Wed Oct 13 01:16:47 1999 Mumit Khan <khan@xraylith.wisc.edu>
* basename.c (DIR_SEPARATOR): New macro.
(DIR_SEPARATOR_2): Likewise.
(HAVE_DOS_BASED_FILESYSTEM): Likewise.
(IS_DIR_SEPARATOR): Likewise.
(main): Handle MSDOS style pathname.
1999-10-11 Mark Mitchell <mark@codesourcery.com>
* cplus-dem.c (do_type): Handle pointer to member types whose
enclosing classes have namespace scope.
Sun Oct 10 01:23:50 1999 Marc Espie <espie@cvs.openbsd.org>
* config.table: Provide a backup shell for executing move-if-change.
1999-10-02 Mark Mitchell <mark@codesourcery.com>
* xmalloc.c (xmalloc): Fix spelling error.
(xcalloc, xrealloc): Likewise.
1999-10-02 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cplus-dem.c (fancy_abort, demangle_integral_value,
demangle_arm_hp_template, recursively_demangle,
standard_symbol_characters, hp_symbol_characters, main): Add prototype.
(program_name, program_version, fatal): Constify a char*.
(usage, fatal): Mark with ATTRIBUTE_NORETURN.
(main): Call return, not exit.
1999-09-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* choose-temp.c: Remove obsolete comment about gcc.
(make_temp_file): Constify a char*.
Wed Sep 8 20:03:28 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* xmemdup.c: Include sys/types.h.
1999-09-07 Jeff Garzik <jgarzik@pobox.com>
* xmemdup.c: New xmemdup function.
* Makefile.in, makefile.vms, vmsbuild.com: Use xmemdup.[co].
Tue Sep 7 23:32:18 1999 Linas Vepstas <linas@linas.org>
* config.table: Add openedition target.
* config/mh-openedition: New file.
Thu Sep 2 01:36:12 1999 Marc Espie <espie@cvs.openbsd.org>
* pexecute.c (pexecute): Fill in temp_base when needed.
1999-08-31 Richard Henderson <rth@cygnus.com>
* getpwd.c: Check HAVE_GETCWD before defining it away.
1999-08-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (CFILES): Add calloc.c and getpwd.c.
(REQUIRED_OFILES): Add getpwd.o.
(getpwd.o): Add target.
* configure.in (AC_PREREQ): Bump to 2.13.
(AC_CHECK_HEADERS): Add check for <sys/stat.h>.
* getpwd.c: New file, moved here from gcc.
1999-08-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cplus-dem.c (gnu_special): Cast a `size_t' to `long' when
comparing against a signed quantity.
(arm_special): Likewise.
(demangle_fund_type): Likewise.
(do_hpacc_template_const_value): Mark parameter `work' with
ATTRIBUTE_UNUSED.
(main): Constify variable `valid_symbols'.
Tue Aug 24 02:50:45 1999 Philippe De Muyter <phdm@macqel.be>
* strtoul.c (strtoul): Add parentheses around && within ||.
Fri Aug 6 23:32:29 1999 Daniel Jacobowitz <drow@drow.them.org>
* Makefile.in (FLAGS_TO_PASS): Include prefix, exec_prefix,
libdir, libsubdir and tooldir.
1999-08-01 Mark Mitchell <mark@codesourcery.com>
* splay-tree.c (splay_tree_insert): Return the new node.
1999-07-14 Richard Henderson <rth@cygnus.com>
* argv.c: Include stdlib.h and string.h instead of
prototyping directly.
* choose-temp.c: Conditionally include string.h.
1999-07-12 Jason Merrill <jason@yorick.cygnus.com>
* Makefile.in (NEEDED): Add bcmp, bcopy, bzero.
1999-07-11 Ian Lance Taylor <ian@zembu.com>
* splay-tree.c (splay_tree_insert): Add initialization to avoid
warning.
1999-07-07 Jason Merrill <jason@yorick.cygnus.com>
* Makefile.in (needed-list): Only include stuff we actually need
for libstdc++.
1999-06-21 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* configure.in (checkfuncs): Add gettimeofday.
* config.in, configure: Regenerated.
Mon Jun 21 05:56:01 1999 Mumit Khan <khan@xraylith.wisc.edu>
* configure.in (*-*-uwin*): UWIN has sys_{errlist,nerr} even if
the test fails.
* configure: Regenerate.
1999-06-10 Mike Stump <mrs@wrs.com>
* Makefile.in (setenv.o): Add config.h dep for setenv.o to fix
parallel builds.
1999-05-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* putenv.c: Include ansidecl.h to define `const'.
* setenv.c: Likewise.
Wed May 26 03:58:20 1999 "Melissa O'Neill" <oneill@cs.sfu.ca>
* Makefile.in (CFILES): Add putenv.c and setenv.c.
* configure.in (funcs): Add putenv and setenv.
(AC_CHECK_FUNCS): Check for putenv and setenv.
* configure: Rebuilt.
* putenv.c setenv.c: New files.
* getcwd.c (getcwd): If pathname is NULL, then obtain SIZE
bytes of space using malloc.
Mon May 17 01:42:34 1999 Stu Grossman <grossman@babylon-5.cygnus.com>
* cplus-dem.c (demangle_fund_type (near 'I' case)): Don't advance
the *mangled pointer beyond the end of the string. Clean up code to
match prevailing coding style.
1999-05-13 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* tmpnam.c (L_tmpnam): Fix typo.
Thu May 13 01:14:46 1999 Marc Espie <espie@cvs.openbsd.org>
* cplus-dem.c (standard_symbol_characters): Renamed from
standard_symbol_alphabet. No longer modify TABLE.
(hp_symbol_characters): Renamed from hp_symbol_alphabet. No longer
modify TABLE.
(main): Corresponding changes. Use strchr to determine if a
character is valid.
1999-05-11 Jim Blandy <jimb@zwingli.cygnus.com>
* cplus-dem.c (main): Use table lookup to distinguish identifier
characters from non-identifier characters.
(standard_symbol_alphabet, hp_symbol_alphabet): New functions.
Thu May 6 20:34:42 1999 Fred Fish <fnf@be.com>
* configure.in (sys/resource.h): Add to AC_CHECK_HEADERS list.
* getruntime.c: Only attempt to include sys/resource.h and
use getrusage if both HAVE_GETRUSAGE and HAVE_SYS_RESOURCE_H
are defined.
Mon Apr 26 01:36:06 1999 Donn Terry (donn@interix.com)
* configure.in (alloca detection): Handle alloca directly for interix.
* configure: Rebuilt.
Sun Apr 25 01:18:21 1999 Mumit Khan <khan@xraylith.wisc.edu>
* choose-temp.c (DIR_SEPARATOR): Use '\\' only for native windows32.
1999-04-20 Jim Blandy <jimb@zwingli.cygnus.com>
Fix from Dale Hawkins:
@@ -7,10 +290,26 @@
* cplus-dem.c (demangle_fund_type): Check for buffer overrun. Be
stricter about syntax. Always null-terminate string.
Thu Apr 15 23:00:55 1999 Mumit Khan <khan@xraylith.wisc.edu>
* configure.in (checkfuncs): Check for sbrk.
* config.in: Rebuilt.
* configure: Likewise.
* xmalloc.c: Use HAVE_SBRK instead of the host specific definitions.
1999-04-12 Jim Blandy <jimb@zwingli.cygnus.com>
Fix from Marcus Daniels:
* cplus-dem.c (demangle_fund_type): Don't run off the end of the
identifier looking for another underscore.
Sun Apr 11 23:20:59 1999 Mumit Khan <khan@xraylith.wisc.edu>
* pexecute.c: Change all references to __UWIN__ to _UWIN.
* xmalloc.c: Likewise.
(xcalloc): UWIN has sbrk.
(xrealloc): Fix guard macro.
1999-04-11 Richard Henderson <rth@cygnus.com>
* alloca-conf.h (alloca) [C_ALLOCA]: Don't use Gcc builtin
@@ -22,6 +321,12 @@
* config.table: Use mh-beos.
* config/mh-beos: New file.
1999-04-11 Mark Mitchell <mark@codesourcery.com>
* cplus-dem.c (demangle_template_value_parm): Handle
pointers-to-members.
(do_type): Handle template parameters as qualifiers.
1999-04-01 Jim Blandy <jimb@zwingli.cygnus.com>
* cplus-dem.c: Attempt to handle overflows in counts with some
@@ -31,10 +336,22 @@
(demangle_template_value_parm, demangle_template): Handle change
to consume_count's return convention.
Thu Apr 8 14:43:28 1999 Andrew Cagney <cagney@b1.cygnus.com>
1999-04-05 Tom Tromey <tromey@cygnus.com>
* xmalloc.c, pexecute.c: Define __CYGWIN__ when being compiled
with old __CYGWIN32__ compiler.
* testsuite/regress-demangle: New file.
* testsuite/demangle-expected: New file.
* Makefile.in (all, check, installcheck, info, install-info,
clean-info, dvi, install, etags, tags, mostlyclean, clean,
distclean, maintainer-clean, realclean): Depend on corresponding
`-subdir' target.
(all-subdir check-subdir installcheck-subdir info-subdir
install-info-subdir clean-info-subdir dvi-subdir
install-info-subdir etags-subdir mostlyclean-subdir clean-subdir
distclean-subdir maintainer-clean-subdir): New target.
* testsuite/Makefile.in: New file.
* configure: Rebuilt.
* configure.in: Create testsuite/Makefile.
1999-04-02 Mark Mitchell <mark@codesourcery.com>

View File

@@ -1,6 +1,6 @@
#
# Makefile
# Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
# Copyright (C) 1990, 91 - 99, 2000
# Free Software Foundation
#
# This file is part of the libiberty library.
@@ -85,25 +85,37 @@ FLAGS_TO_PASS = \
"LDFLAGS=$(LDFLAGS)" \
"LOADLIBES=$(LOADLIBES)" \
"RANLIB=$(RANLIB)" \
"SHELL=$(SHELL)"
"SHELL=$(SHELL)" \
"prefix=$(prefix)" \
"exec_prefix=$(exec_prefix)" \
"libdir=$(libdir)" \
"libsubdir=$(libsubdir)" \
"tooldir=$(tooldir)"
all: stamp-picdir $(TARGETLIB) needed-list required-list
# Subdirectories to recurse into. We need to override this during cleaning
SUBDIRS = testsuite
all: stamp-picdir $(TARGETLIB) needed-list required-list all-subdir
@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
.PHONY: check installcheck
check installcheck:
check: check-subdir
installcheck: installcheck-subdir
@host_makefile_frag@
INCDIR=$(srcdir)/$(MULTISRCTOP)../include
COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES)
COMPILE.c = $(CC) -c @DEFS@ $(LIBCFLAGS) -I. -I$(INCDIR) $(HDEFINES) @ac_libiberty_warn_cflags@
.c.o:
test x"$(enable_shared)" != xyes || \
$(COMPILE.c) $(PICFLAG) $< -o pic/$@
$(COMPILE.c) $<
info install-info clean-info dvi:
info: info-subdir
install-info: install-info-subdir
clean-info: clean-info-subdir
dvi: dvi-subdir
# Include files that are in this directory.
HFILES = alloca-conf.h
@@ -112,22 +124,22 @@ HFILES = alloca-conf.h
# (alphabetical), and add them to REQUIRED_OFILES or funcs in
# configure.in.
CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c \
bzero.c choose-temp.c clock.c concat.c cplus-dem.c fdmatch.c \
fnmatch.c getcwd.c getopt.c getopt1.c getpagesize.c \
getruntime.c floatformat.c hex.c index.c insque.c memchr.c \
bzero.c calloc.c choose-temp.c clock.c concat.c cplus-dem.c fdmatch.c \
fnmatch.c getcwd.c getpwd.c getopt.c getopt1.c getpagesize.c \
getruntime.c floatformat.c hashtab.c hex.c index.c insque.c memchr.c \
memcmp.c memcpy.c memmove.c memset.c mkstemps.c objalloc.c obstack.c \
pexecute.c random.c rename.c rindex.c sigsetmask.c spaces.c \
splay-tree.c strcasecmp.c strncasecmp.c strchr.c strdup.c strerror.c \
strrchr.c strsignal.c strstr.c strtod.c strtol.c strtoul.c \
pexecute.c putenv.c random.c rename.c rindex.c setenv.c sigsetmask.c \
spaces.c splay-tree.c strcasecmp.c strncasecmp.c strchr.c strdup.c \
strerror.c strrchr.c strsignal.c strstr.c strtod.c strtol.c strtoul.c \
tmpnam.c vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c \
waitpid.c xatexit.c xexit.c xmalloc.c xstrdup.c xstrerror.c
waitpid.c xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c
# These are always included in the library.
REQUIRED_OFILES = argv.o choose-temp.o concat.o cplus-dem.o \
fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o \
floatformat.o objalloc.o obstack.o pexecute.o spaces.o \
fdmatch.o fnmatch.o getopt.o getopt1.o getpwd.o getruntime.o hashtab.o \
hex.o floatformat.o objalloc.o obstack.o pexecute.o spaces.o \
splay-tree.o strerror.o strsignal.o xatexit.o xexit.o xmalloc.o \
xstrdup.o xstrerror.o
xmemdup.o xstrdup.o xstrerror.o
$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA)
rm -f $(TARGETLIB)
@@ -136,7 +148,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA)
$(RANLIB) $(TARGETLIB)
INSTALL_DEST = @INSTALL_DEST@
install: install_to_$(INSTALL_DEST)
install: install_to_$(INSTALL_DEST) install-subdir
install_to_libdir: all
$(INSTALL_DATA) $(TARGETLIB) $(libdir)$(MULTISUBDIR)/$(TARGETLIB).n
@@ -150,13 +162,21 @@ install_to_tooldir: all
mv -f $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB).n $(tooldir)/lib$(MULTISUBDIR)/$(TARGETLIB)
@$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
# needed-list is used by libstdc++.
# needed-list is used by libstdc++. NEEDED is the list of functions
# to include there. Do not add anything LGPL to this list; libstdc++
# can't use anything encumbering.
NEEDED = atexit calloc memchr memcmp memcpy memmove memset rename strchr \
strerror strrchr strstr strtol strtoul tmpnam vfprintf vprintf \
vfork waitpid bcmp bcopy bzero
needed-list: Makefile
f="$(LIBOBJS) $(ALLOCA) $(EXTRA_OFILES)"; \
case $$f in \
*alloca.o*) f="$$f xmalloc.o xexit.o" ;; \
esac; \
echo $$f > needed-list
rm -f needed-list; touch needed-list; \
for f in $(NEEDED); do \
for g in $(LIBOBJS) $(EXTRA_OFILES); do \
case "$$g" in \
*$$f*) echo $$g >> needed-list ;; \
esac; \
done; \
done
# required-list was used when building a shared bfd/opcodes/libiberty
# library. I don't know if it used by anything currently.
@@ -171,7 +191,7 @@ stamp-picdir:
.PHONY: all etags tags ls clean stage1 stage2
etags tags: TAGS
etags tags: TAGS etags-subdir
TAGS: $(CFILES) $(HFILES)
etags `for i in $(HFILES) $(CFILES); do echo $(srcdir)/$$i ; done`
@@ -187,19 +207,24 @@ ls:
# Need to deal with profiled libraries, too.
mostlyclean:
# Cleaning has to be done carefully to ensure that we don't clean our SUBDIRS
# multiple times, hence our explicit recursion with an empty SUBDIRS.
mostlyclean: mostlyclean-subdir
rm -rf *.o pic core errs \#* *.E a.out
rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
rm -f $(CONFIG_H) $(NEEDED_LIST) stamp-picdir
@$(MULTICLEAN) multi-clean DO=mostlyclean
clean: mostlyclean
clean: clean-subdir
$(MAKE) SUBDIRS="" mostlyclean
rm -f *.a required-list tmpmulti.out
@$(MULTICLEAN) multi-clean DO=clean
distclean: clean
distclean: distclean-subdir
$(MAKE) SUBDIRS="" clean
@$(MULTICLEAN) multi-clean DO=distclean
rm -f *~ Makefile config.status xhost-mkfrag TAGS multilib.out
rm -f config.log
maintainer-clean realclean: distclean
maintainer-clean realclean: maintainer-clean-subdir
$(MAKE) SUBDIRS="" distclean
force:
@@ -213,6 +238,16 @@ stamp-h: config.in config.status
config.status: $(srcdir)/configure $(srcdir)/config.table
$(SHELL) ./config.status --recheck
all-subdir check-subdir installcheck-subdir info-subdir \
install-info-subdir clean-info-subdir dvi-subdir install-subdir \
etags-subdir mostlyclean-subdir clean-subdir distclean-subdir \
maintainer-clean-subdir:
@target=`echo $@ | sed -e 's/-subdir//'`; \
for dir in . $(SUBDIRS) ; do \
test $$dir = . || (cd $$dir && $(MAKE) $$target) || exit 1; \
done
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA): stamp-picdir
alloca.o: config.h
@@ -229,6 +264,7 @@ getcwd.o: config.h
getopt.o: config.h $(INCDIR)/getopt.h
getopt1.o: config.h $(INCDIR)/getopt.h
getpagesize.o: config.h
getpwd.o: config.h $(INCDIR)/libiberty.h
getruntime.o: config.h $(INCDIR)/libiberty.h
hex.o: $(INCDIR)/libiberty.h
floatformat.o: $(INCDIR)/floatformat.h
@@ -236,6 +272,7 @@ mkstemps.o: config.h
objalloc.o: $(INCDIR)/objalloc.h
obstack.o: config.h $(INCDIR)/obstack.h
pexecute.o: config.h $(INCDIR)/libiberty.h
setenv.o: config.h
spaces.o: $(INCDIR)/libiberty.h
splay-tree.o: config.h $(INCDIR)/libiberty.h $(INCDIR)/splay-tree.h $(INCDIR)/ansidecl.h
strerror.o: config.h $(INCDIR)/libiberty.h
@@ -243,5 +280,7 @@ strsignal.o: config.h $(INCDIR)/libiberty.h
xatexit.o: $(INCDIR)/libiberty.h
xexit.o: $(INCDIR)/libiberty.h
xmalloc.o: $(INCDIR)/libiberty.h
xmemdup.o: config.h $(INCDIR)/libiberty.h
xstrdup.o: config.h $(INCDIR)/libiberty.h
xstrerror.o: config.h $(INCDIR)/libiberty.h
hashtab.o: config.h $(INCDIR)/libiberty.h $(INCDIR)/hashtab.h $(INCDIR)/ansidecl.h

View File

@@ -35,12 +35,8 @@ Boston, MA 02111-1307, USA. */
#ifdef __STDC__
#include <stddef.h>
extern void *memcpy (void *s1, const void *s2, size_t n); /* 4.11.2.1 */
extern size_t strlen (const char *s); /* 4.11.6.3 */
extern void *malloc (size_t size); /* 4.10.3.3 */
extern void *realloc (void *ptr, size_t size); /* 4.10.3.4 */
extern void free (void *ptr); /* 4.10.3.2 */
extern char *strdup (const char *s); /* Non-ANSI */
#include <string.h>
#include <stdlib.h>
#else /* !__STDC__ */

View File

@@ -14,24 +14,53 @@ DESCRIPTION
last component of the pathname ("ls.c" in this case).
BUGS
Presumes a UNIX style path with UNIX style separators.
Presumes a UNIX or DOS/Windows style path with UNIX or DOS/Windows
style separators.
*/
#include "ansidecl.h"
#include "libiberty.h"
#include <ctype.h>
#ifndef DIR_SEPARATOR
#define DIR_SEPARATOR '/'
#endif
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
defined (__OS2__)
#define HAVE_DOS_BASED_FILE_SYSTEM
#ifndef DIR_SEPARATOR_2
#define DIR_SEPARATOR_2 '\\'
#endif
#endif
/* Define IS_DIR_SEPARATOR. */
#ifndef DIR_SEPARATOR_2
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
#else /* DIR_SEPARATOR_2 */
# define IS_DIR_SEPARATOR(ch) \
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
#endif /* DIR_SEPARATOR_2 */
char *
basename (name)
const char *name;
{
const char *base = name;
const char *base;
while (*name)
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
/* Skip over the disk name in MSDOS pathnames. */
if (isalpha (name[0]) && name[1] == ':')
name += 2;
#endif
for (base = name; *name; name++)
{
if (*name++ == '/')
if (IS_DIR_SEPARATOR (*name))
{
base = name;
base = name + 1;
}
}
return (char *) base;
}

View File

@@ -1,3 +1,6 @@
/* calloc -- allocate memory which has been initialized to zero.
This function is in the public domain. */
#include "ansidecl.h"
#include "libiberty.h"

View File

@@ -19,9 +19,6 @@ Boston, MA 02111-1307, USA. */
/* This file exports two functions: choose_temp_base and make_temp_file. */
/* This file lives in at least two places: libiberty and gcc.
Don't change one without the other. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -34,6 +31,9 @@ Boston, MA 02111-1307, USA. */
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h> /* May get R_OK, etc. on some systems. */
#endif
@@ -48,7 +48,7 @@ Boston, MA 02111-1307, USA. */
extern int mkstemps ();
#ifndef IN_GCC
#if defined (__MSDOS__) || defined (_WIN32)
#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN))
#define DIR_SEPARATOR '\\'
#endif
#endif
@@ -145,7 +145,7 @@ choose_temp_base ()
char *
make_temp_file (suffix)
char *suffix;
const char *suffix;
{
char *base = 0;
char *temp_filename;

View File

@@ -85,6 +85,9 @@
/* Define if you have the getrusage function. */
#undef HAVE_GETRUSAGE
/* Define if you have the gettimeofday function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the index function. */
#undef HAVE_INDEX
@@ -106,12 +109,18 @@
/* Define if you have the memset function. */
#undef HAVE_MEMSET
/* Define if you have the mkstemps function. */
#undef HAVE_MKSTEMPS
/* Define if you have the on_exit function. */
#undef HAVE_ON_EXIT
/* Define if you have the psignal function. */
#undef HAVE_PSIGNAL
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the random function. */
#undef HAVE_RANDOM
@@ -121,6 +130,12 @@
/* Define if you have the rindex function. */
#undef HAVE_RINDEX
/* Define if you have the sbrk function. */
#undef HAVE_SBRK
/* Define if you have the setenv function. */
#undef HAVE_SETENV
/* Define if you have the sigsetmask function. */
#undef HAVE_SIGSETMASK
@@ -196,6 +211,12 @@
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H

View File

@@ -4,6 +4,7 @@ case "${host}" in
*-*-cxux7*) frag=mh-cxux7 ;;
*-*-freebsd2.1.*) frag=mh-fbsd21 ;;
*-*-freebsd2.2.[012]) frag=mh-fbsd21 ;;
i370-*-opened*) frag=mh-openedition ;;
i[345]86-*-windows*) frag=mh-windows ;;
*-*-beos*) frag=mh-beos ;;
esac
@@ -57,4 +58,4 @@ else
fi
frag=xhost-mkfrag
${CONFIG_SHELL} ${libiberty_topdir}/move-if-change temp-frag xhost-mkfrag
${CONFIG_SHELL-/bin/sh} ${libiberty_topdir}/move-if-change temp-frag xhost-mkfrag

View File

@@ -0,0 +1,3 @@
HDEFINES = -D_ALL_SOURCE
CC=c89

283
libiberty/configure vendored
View File

@@ -742,10 +742,11 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:749: checking for $ac_word" >&5
echo "configure:750: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -775,7 +776,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:779: checking for $ac_word" >&5
echo "configure:780: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -824,7 +825,7 @@ fi
fi
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:828: checking whether we are using GNU C" >&5
echo "configure:829: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -833,7 +834,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:837: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:838: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -844,11 +845,12 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6
if test $ac_cv_prog_gcc = yes; then
GCC=yes
ac_libiberty_warn_cflags='-W -Wall -Wtraditional'
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:852: checking whether ${CC-cc} accepts -g" >&5
echo "configure:854: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -872,12 +874,13 @@ echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
fi
else
GCC=
ac_libiberty_warn_cflags=
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
echo "configure:881: checking for POSIXized ISC" >&5
echo "configure:884: checking for POSIXized ISC" >&5
if test -d /etc/conf/kconfig.d &&
grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
then
@@ -915,7 +918,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:919: checking for a BSD compatible install" >&5
echo "configure:922: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -976,7 +979,7 @@ host_makefile_frag=${frag}
# able to link anything, it had better be able to at least compile
# something.
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:980: checking how to run the C preprocessor" >&5
echo "configure:983: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -991,13 +994,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 995 "configure"
#line 998 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1001: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1004: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1008,13 +1011,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1012 "configure"
#line 1015 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1018: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1021: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1025,13 +1028,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 1029 "configure"
#line 1032 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1035: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1038: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -1055,21 +1058,21 @@ else
fi
echo "$ac_t""$CPP" 1>&6
for ac_hdr in sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h
for ac_hdr in sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h sys/resource.h sys/stat.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1063: checking for $ac_hdr" >&5
echo "configure:1066: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1068 "configure"
#line 1071 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1073: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1076: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1096,12 +1099,12 @@ fi
done
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
echo "configure:1100: checking for sys/wait.h that is POSIX.1 compatible" >&5
echo "configure:1103: checking for sys/wait.h that is POSIX.1 compatible" >&5
if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1105 "configure"
#line 1108 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -1117,7 +1120,7 @@ wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
if { (eval echo configure:1121: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
@@ -1159,9 +1162,11 @@ funcs="$funcs memcpy"
funcs="$funcs memmove"
funcs="$funcs memset"
funcs="$funcs mkstemps"
funcs="$funcs putenv"
funcs="$funcs random"
funcs="$funcs rename"
funcs="$funcs rindex"
funcs="$funcs setenv"
funcs="$funcs sigsetmask"
funcs="$funcs strcasecmp"
funcs="$funcs strchr"
@@ -1183,7 +1188,7 @@ funcs="$funcs waitpid"
vars="sys_errlist sys_nerr sys_siglist"
checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times"
checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
# These are neither executed nor required, but they help keep
# autoheader happy without adding a bunch of text to acconfig.h.
@@ -1191,12 +1196,12 @@ if test "x" = "y"; then
for ac_func in asprintf atexit basename bcmp bcopy bzero calloc clock getcwd
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1195: checking for $ac_func" >&5
echo "configure:1200: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1200 "configure"
#line 1205 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1219,7 +1224,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1246,12 +1251,12 @@ done
for ac_func in getpagesize index insque mkstemps memchr memcmp memcpy memmove
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1250: checking for $ac_func" >&5
echo "configure:1255: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1255 "configure"
#line 1260 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1274,7 +1279,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1298,15 +1303,15 @@ else
fi
done
for ac_func in memset random rename rindex sigsetmask strcasecmp
for ac_func in memset putenv random rename rindex sigsetmask strcasecmp
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1305: checking for $ac_func" >&5
echo "configure:1310: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1310 "configure"
#line 1315 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1329,7 +1334,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1353,15 +1358,15 @@ else
fi
done
for ac_func in strchr strdup strncasecmp strrchr strstr strtod strtol
for ac_func in setenv strchr strdup strncasecmp strrchr strstr strtod strtol
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1360: checking for $ac_func" >&5
echo "configure:1365: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1365 "configure"
#line 1370 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1384,7 +1389,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1411,12 +1416,12 @@ done
for ac_func in strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1415: checking for $ac_func" >&5
echo "configure:1420: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1420 "configure"
#line 1425 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1439,7 +1444,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1478,12 +1483,12 @@ EOF
for ac_func in getrusage on_exit psignal strerror strsignal sysconf times
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1482: checking for $ac_func" >&5
echo "configure:1487: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1487 "configure"
#line 1492 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1506,7 +1511,62 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <<EOF
#define $ac_tr_func 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
for ac_func in sbrk gettimeofday
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1542: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1547 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
if { (eval echo configure:1570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1538,6 +1598,7 @@ fi
# if the host does not provide alloca, we set ALLOCA to alloca.o
setobjs=
CHECK=
if test -n "${with_target_subdir}"; then
# We are being configured as a target library. AC_REPLACE_FUNCS
@@ -1578,8 +1639,16 @@ EOF
setobjs=yes
fi
else
# Not a target library, so we set things up to run the test suite.
CHECK=check-cplus-dem
fi
if test -z "${setobjs}"; then
case "${host}" in
@@ -1661,6 +1730,17 @@ EOF
# can hang configure; on other versions, vfork exists just as a stub.
# FIXME: This should be removed once vfork in uwin's runtime is fixed.
ac_cv_func_vfork_works=no
# Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
# macros (actually, these are imported from a DLL, but the end effect
# is the same), so the test below won't find them.
cat >> confdefs.h <<\EOF
#define HAVE_SYS_NERR 1
EOF
cat >> confdefs.h <<\EOF
#define HAVE_SYS_ERRLIST 1
EOF
;;
esac
@@ -1668,7 +1748,7 @@ EOF
# We haven't set the list of objects yet. Use the standard autoconf
# tests. This will only work if the compiler works.
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:1672: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:1752: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1679,12 +1759,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
#line 1683 "configure"
#line 1763 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:1688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -1710,19 +1790,19 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:1714: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:1794: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
for ac_func in $funcs
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1721: checking for $ac_func" >&5
echo "configure:1801: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1726 "configure"
#line 1806 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1745,7 +1825,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1771,22 +1851,40 @@ fi
done
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
case "${host}" in
*-*-interix)
# On Interix, it wrongly concludes that the MSVC compiler supports alloca.
# (MSVC does on Win32, not on Interix.)
# This should be temporary.
ac_cv_header_alloca_h=no
ac_cv_func_alloca_works=no
ALLOCA=alloca.o
cat >> confdefs.h <<\EOF
#define C_ALLOCA 1
EOF
cat >> confdefs.h <<EOF
#define STACK_DIRECTION -1
EOF
;;
*)
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
echo "configure:1778: checking for working alloca.h" >&5
echo "configure:1876: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1783 "configure"
#line 1881 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
if { (eval echo configure:1790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_header_alloca_h=yes
else
@@ -1807,12 +1905,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
echo "configure:1811: checking for alloca" >&5
echo "configure:1909: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1816 "configure"
#line 1914 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -1840,7 +1938,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
if { (eval echo configure:1844: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1942: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_alloca_works=yes
else
@@ -1872,12 +1970,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
echo "configure:1876: checking whether alloca needs Cray hooks" >&5
echo "configure:1974: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1881 "configure"
#line 1979 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -1902,12 +2000,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1906: checking for $ac_func" >&5
echo "configure:2004: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1911 "configure"
#line 2009 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1930,7 +2028,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1957,7 +2055,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
echo "configure:1961: checking stack direction for C alloca" >&5
echo "configure:2059: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1965,7 +2063,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
#line 1969 "configure"
#line 2067 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -1984,7 +2082,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
if { (eval echo configure:1988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@@ -2005,13 +2103,16 @@ EOF
fi
;;
esac
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:2010: checking for ANSI C header files" >&5
echo "configure:2111: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2015 "configure"
#line 2116 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -2019,7 +2120,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2124: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2036,7 +2137,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 2040 "configure"
#line 2141 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -2054,7 +2155,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 2058 "configure"
#line 2159 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -2075,7 +2176,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 2079 "configure"
#line 2180 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2086,7 +2187,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if { (eval echo configure:2090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -2110,12 +2211,12 @@ EOF
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
echo "configure:2114: checking for pid_t" >&5
echo "configure:2215: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2119 "configure"
#line 2220 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -2144,17 +2245,17 @@ fi
ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
echo "configure:2148: checking for vfork.h" >&5
echo "configure:2249: checking for vfork.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2153 "configure"
#line 2254 "configure"
#include "confdefs.h"
#include <vfork.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2158: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2259: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2179,18 +2280,18 @@ else
fi
echo $ac_n "checking for working vfork""... $ac_c" 1>&6
echo "configure:2183: checking for working vfork" >&5
echo "configure:2284: checking for working vfork" >&5
if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
echo $ac_n "checking for vfork""... $ac_c" 1>&6
echo "configure:2189: checking for vfork" >&5
echo "configure:2290: checking for vfork" >&5
if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2194 "configure"
#line 2295 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vfork(); below. */
@@ -2213,7 +2314,7 @@ vfork();
; return 0; }
EOF
if { (eval echo configure:2217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vfork=yes"
else
@@ -2235,7 +2336,7 @@ fi
ac_cv_func_vfork_works=$ac_cv_func_vfork
else
cat > conftest.$ac_ext <<EOF
#line 2239 "configure"
#line 2340 "configure"
#include "confdefs.h"
/* Thanks to Paul Eggert for this test. */
#include <stdio.h>
@@ -2330,7 +2431,7 @@ main() {
}
}
EOF
if { (eval echo configure:2334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_vfork_works=yes
else
@@ -2357,19 +2458,19 @@ fi
fi
for v in $vars; do
echo $ac_n "checking for $v""... $ac_c" 1>&6
echo "configure:2361: checking for $v" >&5
echo "configure:2462: checking for $v" >&5
if eval "test \"`echo '$''{'libiberty_cv_var_$v'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2366 "configure"
#line 2467 "configure"
#include "confdefs.h"
int *p;
int main() {
extern int $v; p = &$v;
; return 0; }
EOF
if { (eval echo configure:2373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "libiberty_cv_var_$v=yes"
else
@@ -2395,12 +2496,12 @@ EOF
for ac_func in $checkfuncs
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2399: checking for $ac_func" >&5
echo "configure:2500: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2404 "configure"
#line 2505 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2423,7 +2524,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:2427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2560,7 +2661,7 @@ done
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
trap 'rm -fr `echo "Makefile testsuite/Makefile config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -2604,6 +2705,7 @@ s%@build_vendor@%$build_vendor%g
s%@build_os@%$build_os%g
s%@AR@%$AR%g
s%@RANLIB@%$RANLIB%g
s%@ac_libiberty_warn_cflags@%$ac_libiberty_warn_cflags%g
s%@CC@%$CC%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
@@ -2611,6 +2713,7 @@ s%@INSTALL_DATA@%$INSTALL_DATA%g
/@host_makefile_frag@/r $host_makefile_frag
s%@host_makefile_frag@%%g
s%@CPP@%$CPP%g
s%@CHECK@%$CHECK%g
s%@LIBOBJS@%$LIBOBJS%g
s%@ALLOCA@%$ALLOCA%g
s%@INSTALL_DEST@%$INSTALL_DEST%g
@@ -2655,7 +2758,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
CONFIG_FILES=\${CONFIG_FILES-"Makefile testsuite/Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then

View File

@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script
AC_PREREQ(2.12.1)
AC_PREREQ(2.13)
AC_INIT(pexecute.c)
dnl We use these options to decide which functions to include.
@@ -55,6 +55,7 @@ AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
ac_libiberty_warn_cflags='-W -Wall -Wtraditional'
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
@@ -71,9 +72,11 @@ dnl normal versions of a library), tasteless as that idea is.
fi
else
GCC=
ac_libiberty_warn_cflags=
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
])
AC_SUBST(ac_libiberty_warn_cflags)
LIB_AC_PROG_CC
@@ -106,7 +109,7 @@ AC_SUBST_FILE(host_makefile_frag)
# It's OK to check for header files. Although the compiler may not be
# able to link anything, it had better be able to at least compile
# something.
AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h)
AC_CHECK_HEADERS(sys/file.h sys/param.h stdlib.h string.h unistd.h strings.h sys/time.h sys/resource.h sys/stat.h)
AC_HEADER_SYS_WAIT
# This is the list of functions which libiberty will provide if they
@@ -130,9 +133,11 @@ funcs="$funcs memcpy"
funcs="$funcs memmove"
funcs="$funcs memset"
funcs="$funcs mkstemps"
funcs="$funcs putenv"
funcs="$funcs random"
funcs="$funcs rename"
funcs="$funcs rindex"
funcs="$funcs setenv"
funcs="$funcs sigsetmask"
funcs="$funcs strcasecmp"
funcs="$funcs strchr"
@@ -154,20 +159,21 @@ funcs="$funcs waitpid"
vars="sys_errlist sys_nerr sys_siglist"
checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times"
checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
# These are neither executed nor required, but they help keep
# autoheader happy without adding a bunch of text to acconfig.h.
if test "x" = "y"; then
AC_CHECK_FUNCS(asprintf atexit basename bcmp bcopy bzero calloc clock getcwd)
AC_CHECK_FUNCS(getpagesize index insque mkstemps memchr memcmp memcpy memmove)
AC_CHECK_FUNCS(memset random rename rindex sigsetmask strcasecmp)
AC_CHECK_FUNCS(strchr strdup strncasecmp strrchr strstr strtod strtol)
AC_CHECK_FUNCS(memset putenv random rename rindex sigsetmask strcasecmp)
AC_CHECK_FUNCS(setenv strchr strdup strncasecmp strrchr strstr strtod strtol)
AC_CHECK_FUNCS(strtoul tmpnam vasprintf vfprintf vprintf vsprintf waitpid)
AC_DEFINE(HAVE_SYS_ERRLIST)
AC_DEFINE(HAVE_SYS_NERR)
AC_DEFINE(HAVE_SYS_SIGLIST)
AC_CHECK_FUNCS(getrusage on_exit psignal strerror strsignal sysconf times)
AC_CHECK_FUNCS(sbrk gettimeofday)
fi
# For each of these functions, if the host does not provide the
@@ -176,6 +182,7 @@ fi
# if the host does not provide alloca, we set ALLOCA to alloca.o
setobjs=
CHECK=
if test -n "${with_target_subdir}"; then
# We are being configured as a target library. AC_REPLACE_FUNCS
@@ -210,8 +217,16 @@ if test -n "${with_target_subdir}"; then
setobjs=yes
fi
else
# Not a target library, so we set things up to run the test suite.
CHECK=check-cplus-dem
fi
AC_SUBST(CHECK)
if test -z "${setobjs}"; then
case "${host}" in
@@ -281,6 +296,11 @@ if test -z "${setobjs}"; then
# can hang configure; on other versions, vfork exists just as a stub.
# FIXME: This should be removed once vfork in uwin's runtime is fixed.
ac_cv_func_vfork_works=no
# Under uwin 2.0+, sys_nerr and sys_errlist exist, but they are
# macros (actually, these are imported from a DLL, but the end effect
# is the same), so the test below won't find them.
AC_DEFINE(HAVE_SYS_NERR)
AC_DEFINE(HAVE_SYS_ERRLIST)
;;
esac
@@ -289,7 +309,28 @@ if test -z "${setobjs}"; then
# tests. This will only work if the compiler works.
AC_PROG_CC_WORKS
AC_REPLACE_FUNCS($funcs)
AC_FUNC_ALLOCA
case "${host}" in
*-*-interix)
# On Interix, it wrongly concludes that the MSVC compiler supports alloca.
# (MSVC does on Win32, not on Interix.)
# This should be temporary.
ac_cv_header_alloca_h=no
ac_cv_func_alloca_works=no
ALLOCA=alloca.o
cat >> confdefs.h <<\EOF
#define C_ALLOCA 1
EOF
cat >> confdefs.h <<EOF
#define STACK_DIRECTION -1
EOF
;;
*)
AC_FUNC_ALLOCA
;;
esac
AC_FUNC_VFORK
if test $ac_cv_func_vfork_works = no; then
LIBOBJS="$LIBOBJS vfork.o"
@@ -321,7 +362,7 @@ fi
AC_SUBST(INSTALL_DEST)
# We need multilib support, but only if configuring for the target.
AC_OUTPUT(Makefile,
AC_OUTPUT(Makefile testsuite/Makefile,
[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h
if test -n "$CONFIG_FILES"; then
if test -n "${with_target_subdir}"; then

View File

@@ -51,6 +51,14 @@ char * realloc ();
#include "libiberty.h"
#define min(X,Y) (((X) < (Y)) ? (X) : (Y))
/* A value at least one greater than the maximum number of characters
that will be output when using the `%d' format with `printf'. */
#define INTBUF_SIZE 32
extern void fancy_abort PARAMS ((void)) ATTRIBUTE_NORETURN;
static const char *mystrstr PARAMS ((const char *, const char *));
static const char *
@@ -343,6 +351,9 @@ string_prepend PARAMS ((string *, const char *));
static void
string_prependn PARAMS ((string *, const char *, int));
static void
string_append_template_idx PARAMS ((string *, int));
static int
get_count PARAMS ((const char **, int *));
@@ -420,6 +431,25 @@ qualifier_string PARAMS ((int));
static const char*
demangle_qualifier PARAMS ((int));
static int
demangle_expression PARAMS ((struct work_stuff *, const char **, string *,
type_kind_t));
static int
demangle_integral_value PARAMS ((struct work_stuff *, const char **,
string *));
static int
demangle_real_value PARAMS ((struct work_stuff *, const char **, string *));
static void
demangle_arm_hp_template PARAMS ((struct work_stuff *, const char **, int,
string *));
static void
recursively_demangle PARAMS ((struct work_stuff *, const char **, string *,
int));
/* Translate count to integer, consuming tokens in the process.
Conversion terminates on the first non-digit character.
@@ -1325,6 +1355,68 @@ demangle_template_template_parm (work, mangled, tname)
return (success);
}
static int
demangle_expression (work, mangled, s, tk)
struct work_stuff *work;
const char** mangled;
string* s;
type_kind_t tk;
{
int need_operator = 0;
int success;
success = 1;
string_appendn (s, "(", 1);
(*mangled)++;
while (success && **mangled != 'W' && **mangled != '\0')
{
if (need_operator)
{
size_t i;
size_t len;
success = 0;
len = strlen (*mangled);
for (i = 0;
i < sizeof (optable) / sizeof (optable [0]);
++i)
{
size_t l = strlen (optable[i].in);
if (l <= len
&& memcmp (optable[i].in, *mangled, l) == 0)
{
string_appendn (s, " ", 1);
string_append (s, optable[i].out);
string_appendn (s, " ", 1);
success = 1;
(*mangled) += l;
break;
}
}
if (!success)
break;
}
else
need_operator = 1;
success = demangle_template_value_parm (work, mangled, s, tk);
}
if (**mangled != 'W')
success = 0;
else
{
string_appendn (s, ")", 1);
(*mangled)++;
}
return success;
}
static int
demangle_integral_value (work, mangled, s)
struct work_stuff *work;
@@ -1334,74 +1426,35 @@ demangle_integral_value (work, mangled, s)
int success;
if (**mangled == 'E')
{
int need_operator = 0;
success = 1;
string_appendn (s, "(", 1);
(*mangled)++;
while (success && **mangled != 'W' && **mangled != '\0')
{
if (need_operator)
{
size_t i;
size_t len;
success = 0;
len = strlen (*mangled);
for (i = 0;
i < sizeof (optable) / sizeof (optable [0]);
++i)
{
size_t l = strlen (optable[i].in);
if (l <= len
&& memcmp (optable[i].in, *mangled, l) == 0)
{
string_appendn (s, " ", 1);
string_append (s, optable[i].out);
string_appendn (s, " ", 1);
success = 1;
(*mangled) += l;
break;
}
}
if (!success)
break;
}
else
need_operator = 1;
success = demangle_template_value_parm (work, mangled, s,
tk_integral);
}
if (**mangled != 'W')
success = 0;
else
{
string_appendn (s, ")", 1);
(*mangled)++;
}
}
success = demangle_expression (work, mangled, s, tk_integral);
else if (**mangled == 'Q' || **mangled == 'K')
success = demangle_qualified (work, mangled, s, 0, 1);
else
{
int value;
success = 0;
/* Negative numbers are indicated with a leading `m'. */
if (**mangled == 'm')
{
string_appendn (s, "-", 1);
(*mangled)++;
}
while (isdigit ((unsigned char)**mangled))
/* Read the rest of the number. */
value = consume_count_with_underscores (mangled);
if (value != -1)
{
string_appendn (s, *mangled, 1);
(*mangled)++;
char buf[INTBUF_SIZE];
sprintf (buf, "%d", value);
string_append (s, buf);
/* If the next character is an underscore, skip it. */
if (**mangled == '_')
(*mangled)++;
/* All is well. */
success = 1;
}
}
@@ -1409,6 +1462,51 @@ demangle_integral_value (work, mangled, s)
return success;
}
/* Demangle the real value in MANGLED. */
static int
demangle_real_value (work, mangled, s)
struct work_stuff *work;
const char **mangled;
string* s;
{
if (**mangled == 'E')
return demangle_expression (work, mangled, s, tk_real);
if (**mangled == 'm')
{
string_appendn (s, "-", 1);
(*mangled)++;
}
while (isdigit ((unsigned char)**mangled))
{
string_appendn (s, *mangled, 1);
(*mangled)++;
}
if (**mangled == '.') /* fraction */
{
string_appendn (s, ".", 1);
(*mangled)++;
while (isdigit ((unsigned char)**mangled))
{
string_appendn (s, *mangled, 1);
(*mangled)++;
}
}
if (**mangled == 'e') /* exponent */
{
string_appendn (s, "e", 1);
(*mangled)++;
while (isdigit ((unsigned char)**mangled))
{
string_appendn (s, *mangled, 1);
(*mangled)++;
}
}
return 1;
}
static int
demangle_template_value_parm (work, mangled, s, tk)
struct work_stuff *work;
@@ -1432,11 +1530,7 @@ demangle_template_value_parm (work, mangled, s, tk)
if (work->tmpl_argvec)
string_append (s, work->tmpl_argvec[idx]);
else
{
char buf[10];
sprintf(buf, "T%d", idx);
string_append (s, buf);
}
string_append_template_idx (s, idx);
}
else if (tk == tk_integral)
success = demangle_integral_value (work, mangled, s);
@@ -1472,70 +1566,46 @@ demangle_template_value_parm (work, mangled, s, tk)
success = 0;
}
else if (tk == tk_real)
{
if (**mangled == 'm')
{
string_appendn (s, "-", 1);
(*mangled)++;
}
while (isdigit ((unsigned char)**mangled))
{
string_appendn (s, *mangled, 1);
(*mangled)++;
}
if (**mangled == '.') /* fraction */
{
string_appendn (s, ".", 1);
(*mangled)++;
while (isdigit ((unsigned char)**mangled))
{
string_appendn (s, *mangled, 1);
(*mangled)++;
}
}
if (**mangled == 'e') /* exponent */
{
string_appendn (s, "e", 1);
(*mangled)++;
while (isdigit ((unsigned char)**mangled))
{
string_appendn (s, *mangled, 1);
(*mangled)++;
}
}
}
success = demangle_real_value (work, mangled, s);
else if (tk == tk_pointer || tk == tk_reference)
{
int symbol_len = consume_count (mangled);
if (symbol_len == -1)
return -1;
if (symbol_len == 0)
string_appendn (s, "0", 1);
if (**mangled == 'Q')
success = demangle_qualified (work, mangled, s,
/*isfuncname=*/0,
/*append=*/1);
else
{
char *p = xmalloc (symbol_len + 1), *q;
strncpy (p, *mangled, symbol_len);
p [symbol_len] = '\0';
/* We use cplus_demangle here, rather than
internal_cplus_demangle, because the name of the entity
mangled here does not make use of any of the squangling
or type-code information we have built up thus far; it is
mangled independently. */
q = cplus_demangle (p, work->options);
if (tk == tk_pointer)
string_appendn (s, "&", 1);
/* FIXME: Pointer-to-member constants should get a
qualifying class name here. */
if (q)
{
string_append (s, q);
free (q);
}
int symbol_len = consume_count (mangled);
if (symbol_len == -1)
return -1;
if (symbol_len == 0)
string_appendn (s, "0", 1);
else
string_append (s, p);
free (p);
{
char *p = xmalloc (symbol_len + 1), *q;
strncpy (p, *mangled, symbol_len);
p [symbol_len] = '\0';
/* We use cplus_demangle here, rather than
internal_cplus_demangle, because the name of the entity
mangled here does not make use of any of the squangling
or type-code information we have built up thus far; it is
mangled independently. */
q = cplus_demangle (p, work->options);
if (tk == tk_pointer)
string_appendn (s, "&", 1);
/* FIXME: Pointer-to-member constants should get a
qualifying class name here. */
if (q)
{
string_append (s, q);
free (q);
}
else
string_append (s, p);
free (p);
}
*mangled += symbol_len;
}
*mangled += symbol_len;
}
return success;
@@ -1594,11 +1664,9 @@ demangle_template (work, mangled, tname, trawname, is_type, remember)
}
else
{
char buf[10];
sprintf(buf, "T%d", idx);
string_append (tname, buf);
string_append_template_idx (tname, idx);
if (trawname)
string_append (trawname, buf);
string_append_template_idx (trawname, idx);
}
}
else
@@ -2439,7 +2507,7 @@ gnu_special (work, mangled, declp)
break;
default:
n = consume_count (mangled);
if (n < 0 || n > strlen (*mangled))
if (n < 0 || n > (long) strlen (*mangled))
{
success = 0;
break;
@@ -2606,7 +2674,7 @@ arm_special (mangled, declp)
{
n = consume_count (mangled);
if (n == -1
|| n > strlen (*mangled))
|| n > (long) strlen (*mangled))
return 0;
string_prependn (declp, *mangled, n);
(*mangled) += n;
@@ -2667,7 +2735,6 @@ demangle_qualified (work, mangled, result, isfuncname, append)
{
int qualifiers = 0;
int success = 1;
const char *p;
char num[2];
string temp;
string last_name;
@@ -2699,19 +2766,10 @@ demangle_qualified (work, mangled, result, isfuncname, append)
/* GNU mangled name with more than 9 classes. The count is preceded
by an underscore (to distinguish it from the <= 9 case) and followed
by an underscore. */
p = *mangled + 2;
qualifiers = atoi (p);
if (!isdigit ((unsigned char)*p) || *p == '0')
(*mangled)++;
qualifiers = consume_count_with_underscores (mangled);
if (qualifiers == -1)
success = 0;
/* Skip the digits. */
while (isdigit ((unsigned char)*p))
++p;
if (*p != '_')
success = 0;
*mangled = p + 1;
break;
case '1':
@@ -2902,9 +2960,7 @@ get_count (type, count)
int n;
if (!isdigit ((unsigned char)**type))
{
return (0);
}
return (0);
else
{
*count = **type - '0';
@@ -3041,14 +3097,14 @@ do_type (work, mangled, result)
member = **mangled == 'M';
(*mangled)++;
if (!isdigit ((unsigned char)**mangled) && **mangled != 't')
{
success = 0;
break;
}
string_append (&decl, ")");
string_prepend (&decl, SCOPE_STRING (work));
/* We don't need to prepend `::' for a qualified name;
demangle_qualified will do that for us. */
if (**mangled != 'Q')
string_prepend (&decl, SCOPE_STRING (work));
if (isdigit ((unsigned char)**mangled))
{
n = consume_count (mangled);
@@ -3061,7 +3117,13 @@ do_type (work, mangled, result)
string_prependn (&decl, *mangled, n);
*mangled += n;
}
else
else if (**mangled == 'X' || **mangled == 'Y')
{
string temp;
do_type (work, mangled, &temp);
string_prepends (&decl, &temp);
}
else if (**mangled == 't')
{
string temp;
string_init (&temp);
@@ -3075,6 +3137,20 @@ do_type (work, mangled, result)
else
break;
}
else if (**mangled == 'Q')
{
success = demangle_qualified (work, mangled, &decl,
/*isfuncnam=*/0,
/*append=*/0);
if (!success)
break;
}
else
{
success = 0;
break;
}
string_prepend (&decl, "(");
if (member)
{
@@ -3181,11 +3257,7 @@ do_type (work, mangled, result)
if (work->tmpl_argvec)
string_append (result, work->tmpl_argvec[idx]);
else
{
char buf[10];
sprintf(buf, "T%d", idx);
string_append (result, buf);
}
string_append_template_idx (result, idx);
success = 1;
}
@@ -3359,14 +3431,14 @@ demangle_fund_type (work, mangled, result)
break;
}
case 'I':
++(*mangled);
(*mangled)++;
if (**mangled == '_')
{
int i;
++(*mangled);
(*mangled)++;
for (i = 0;
(i < sizeof (buf) - 1 && **mangled && **mangled != '_');
++(*mangled), ++i)
i < (long) sizeof (buf) - 1 && **mangled && **mangled != '_';
(*mangled)++, i++)
buf[i] = **mangled;
if (**mangled != '_')
{
@@ -3374,13 +3446,13 @@ demangle_fund_type (work, mangled, result)
break;
}
buf[i] = '\0';
++(*mangled);
(*mangled)++;
}
else
{
strncpy (buf, *mangled, 2);
buf[2] = '\0';
*mangled += 2;
*mangled += min (strlen (*mangled), 2);
}
sscanf (buf, "%x", &dec);
sprintf (buf, "int%i_t", dec);
@@ -3434,7 +3506,7 @@ demangle_fund_type (work, mangled, result)
static int
do_hpacc_template_const_value (work, mangled, result)
struct work_stuff *work;
struct work_stuff *work ATTRIBUTE_UNUSED;
const char **mangled;
string *result;
{
@@ -4304,6 +4376,16 @@ string_prependn (p, s, n)
}
}
static void
string_append_template_idx (s, idx)
string *s;
int idx;
{
char buf[INTBUF_SIZE + 1 /* 'T' */];
sprintf(buf, "T%d", idx);
string_append (s, buf);
}
/* To generate a standalone demangler program for testing purposes,
just compile and link this file with -DMAIN and libiberty.a. When
run, it demangles each command line arg, or each stdin string, and
@@ -4313,13 +4395,13 @@ string_prependn (p, s, n)
#include "getopt.h"
static char *program_name;
static char *program_version = VERSION;
static const char *program_name;
static const char *program_version = VERSION;
static int flags = DMGL_PARAMS | DMGL_ANSI;
static void demangle_it PARAMS ((char *));
static void usage PARAMS ((FILE *, int));
static void fatal PARAMS ((char *));
static void usage PARAMS ((FILE *, int)) ATTRIBUTE_NORETURN;
static void fatal PARAMS ((const char *)) ATTRIBUTE_NORETURN;
static void
demangle_it (mangled_name)
@@ -4379,6 +4461,63 @@ fancy_abort ()
fatal ("Internal gcc abort.");
}
static const char *
standard_symbol_characters PARAMS ((void));
static const char *
hp_symbol_characters PARAMS ((void));
/* Return the string of non-alnum characters that may occur
as a valid symbol component, in the standard assembler symbol
syntax. */
static const char *
standard_symbol_characters ()
{
return "_$.";
}
/* Return the string of non-alnum characters that may occur
as a valid symbol name component in an HP object file.
Note that, since HP's compiler generates object code straight from
C++ source, without going through an assembler, its mangled
identifiers can use all sorts of characters that no assembler would
tolerate, so the alphabet this function creates is a little odd.
Here are some sample mangled identifiers offered by HP:
typeid*__XT24AddressIndExpClassMember_
[Vftptr]key:__dt__32OrdinaryCompareIndExpClassMemberFv
__ct__Q2_9Elf64_Dyn18{unnamed.union.#1}Fv
This still seems really weird to me, since nowhere else in this
file is there anything to recognize curly brackets, parens, etc.
I've talked with Srikanth <srikanth@cup.hp.com>, and he assures me
this is right, but I still strongly suspect that there's a
misunderstanding here.
If we decide it's better for c++filt to use HP's assembler syntax
to scrape identifiers out of its input, here's the definition of
the symbol name syntax from the HP assembler manual:
Symbols are composed of uppercase and lowercase letters, decimal
digits, dollar symbol, period (.), ampersand (&), pound sign(#) and
underscore (_). A symbol can begin with a letter, digit underscore or
dollar sign. If a symbol begins with a digit, it must contain a
non-digit character.
So have fun. */
static const char *
hp_symbol_characters ()
{
return "_$.<>#,*&[]:(){}";
}
extern int main PARAMS ((int, char **));
int
main (argc, argv)
int argc;
@@ -4386,6 +4525,7 @@ main (argc, argv)
{
char *result;
int c;
const char *valid_symbols;
program_name = argv[0];
@@ -4405,7 +4545,7 @@ main (argc, argv)
break;
case 'v':
printf ("GNU %s (C++ demangler), version %s\n", program_name, program_version);
exit (0);
return (0);
case '_':
strip_underscore = 1;
break;
@@ -4437,7 +4577,7 @@ main (argc, argv)
{
fprintf (stderr, "%s: unknown demangling style `%s'\n",
program_name, optarg);
exit (1);
return (1);
}
break;
}
@@ -4452,16 +4592,30 @@ main (argc, argv)
}
else
{
switch (current_demangling_style)
{
case gnu_demangling:
case lucid_demangling:
case arm_demangling:
case edg_demangling:
valid_symbols = standard_symbol_characters ();
break;
case hp_demangling:
valid_symbols = hp_symbol_characters ();
break;
default:
/* Folks should explicitly indicate the appropriate alphabet for
each demangling. Providing a default would allow the
question to go unconsidered. */
abort ();
}
for (;;)
{
int i = 0;
c = getchar ();
/* Try to read a label. */
while (c != EOF && (isalnum(c) || c == '_' || c == '$' || c == '.' ||
c == '<' || c == '>' || c == '#' || c == ',' || c == '*' || c == '&' ||
c == '[' || c == ']' || c == ':' || c == '(' || c == ')'))
/* the ones in the 2nd & 3rd lines were added to handle
HP aCC template specialization manglings */
while (c != EOF && (isalnum (c) || strchr (valid_symbols, c)))
{
if (i >= MBUF_SIZE-1)
break;
@@ -4501,12 +4655,12 @@ main (argc, argv)
}
}
exit (0);
return (0);
}
static void
fatal (str)
char *str;
const char *str;
{
fprintf (stderr, "%s: %s\n", program_name, str);
exit (1);

View File

@@ -14,6 +14,9 @@ DESCRIPTION
current directory's path doesn't fit in LEN characters, the result
is NULL and errno is set.
If pathname is a null pointer, getcwd() will obtain size bytes of
space using malloc.
BUGS
Emulated via the getwd() call, which is reasonable for most
systems that do not have getcwd().
@@ -48,6 +51,13 @@ getcwd (buf, len)
errno = ERANGE;
return 0;
}
if (!buf) {
buf = (char*)malloc(len);
if (!buf) {
errno = ENOMEM;
return 0;
}
}
strcpy (buf, ourbuf);
}
return buf;

115
libiberty/getpwd.c Normal file
View File

@@ -0,0 +1,115 @@
/* getpwd.c - get the working directory */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/types.h>
#include <errno.h>
#ifndef errno
extern int errno;
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
/* Prototype these in case the system headers don't provide them. */
extern char *getpwd ();
extern char *getwd ();
#include "libiberty.h"
/* Virtually every UN*X system now in common use (except for pre-4.3-tahoe
BSD systems) now provides getcwd as called for by POSIX. Allow for
the few exceptions to the general rule here. */
#if !defined(HAVE_GETCWD) && defined(HAVE_GETWD)
#define getcwd(buf,len) getwd(buf)
#endif
#ifdef MAXPATHLEN
#define GUESSPATHLEN (MAXPATHLEN + 1)
#else
#define GUESSPATHLEN 100
#endif
#if !(defined (VMS) || (defined(_WIN32) && !defined(__CYGWIN__)))
/* Get the working directory. Use the PWD environment variable if it's
set correctly, since this is faster and gives more uniform answers
to the user. Yield the working directory if successful; otherwise,
yield 0 and set errno. */
char *
getpwd ()
{
static char *pwd;
static int failure_errno;
char *p = pwd;
size_t s;
struct stat dotstat, pwdstat;
if (!p && !(errno = failure_errno))
{
if (! ((p = getenv ("PWD")) != 0
&& *p == '/'
&& stat (p, &pwdstat) == 0
&& stat (".", &dotstat) == 0
&& dotstat.st_ino == pwdstat.st_ino
&& dotstat.st_dev == pwdstat.st_dev))
/* The shortcut didn't work. Try the slow, ``sure'' way. */
for (s = GUESSPATHLEN; ! getcwd (p = xmalloc (s), s); s *= 2)
{
int e = errno;
free (p);
#ifdef ERANGE
if (e != ERANGE)
#endif
{
errno = failure_errno = e;
p = 0;
break;
}
}
/* Cache the result. This assumes that the program does
not invoke chdir between calls to getpwd. */
pwd = p;
}
return p;
}
#else /* VMS || _WIN32 && !__CYGWIN__ */
#ifndef MAXPATHLEN
#define MAXPATHLEN 255
#endif
char *
getpwd ()
{
static char *pwd = 0;
if (!pwd)
pwd = getcwd (xmalloc (MAXPATHLEN + 1), MAXPATHLEN + 1
#ifdef VMS
, 0
#endif
);
return pwd;
}
#endif /* VMS || _WIN32 && !__CYGWIN__ */

View File

@@ -28,7 +28,7 @@ Boston, MA 02111-1307, USA. */
#include <time.h>
#ifdef HAVE_GETRUSAGE
#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
#include <sys/time.h>
#include <sys/resource.h>
#endif
@@ -66,7 +66,7 @@ Boston, MA 02111-1307, USA. */
long
get_run_time ()
{
#ifdef HAVE_GETRUSAGE
#if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
struct rusage rusage;
getrusage (0, &rusage);

330
libiberty/hashtab.c Normal file
View File

@@ -0,0 +1,330 @@
/* An expandable hash tables datatype.
Copyright (C) 1999 Free Software Foundation, Inc.
Contributed by Vladimir Makarov (vmakarov@cygnus.com).
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
Libiberty 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If
not, write to the Free Software 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.
Elements in the table are generic pointers.
The size of the table is not fixed; if the occupancy of the table
grows too high the hash table will be expanded.
The abstract data implementation is based on generalized Algorithm D
from Knuth's book "The art of computer programming". Hash table is
expanded by creation of new hash table and transferring elements from
the old table to the new table. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/types.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <stdio.h>
#include "libiberty.h"
#include "hashtab.h"
/* The following variable is used for debugging. Its value is number
of all calls of `find_hash_table_entry' for all hash tables. */
static int all_searches = 0;
/* The following variable is used for debugging. Its value is number
of collisions fixed for time of work with all hash tables. */
static int all_collisions = 0;
/* The following variable is used for debugging. Its value is number
of all table expansions fixed for time of work with all hash
tables. */
static int all_expansions = 0;
/* This macro defines reserved value for empty table entry. */
#define EMPTY_ENTRY NULL
/* This macro defines reserved value for table entry which contained
a deleted element. */
#define DELETED_ENTRY ((void *) 1)
/* The following function returns the nearest prime number which is
greater than given source number. */
static unsigned long
higher_prime_number (number)
unsigned long number;
{
unsigned long i;
for (number = (number / 2) * 2 + 3;; number += 2)
{
for (i = 3; i * i <= number; i += 2)
if (number % i == 0)
break;
if (i * i > number)
return number;
}
}
/* This function creates table with length slightly longer than given
source length. Created hash table is initiated as empty (all the
hash table entries are EMPTY_ENTRY). The function returns the
created hash table. */
hash_table_t
create_hash_table (size, hash_function, eq_function)
size_t size;
unsigned (*hash_function) PARAMS ((hash_table_entry_t));
int (*eq_function) PARAMS ((hash_table_entry_t, hash_table_entry_t));
{
hash_table_t result;
size = higher_prime_number (size);
result = (hash_table_t) xmalloc (sizeof (*result));
result->entries
= (hash_table_entry_t *) xmalloc (size * sizeof (hash_table_entry_t));
result->size = size;
result->hash_function = hash_function;
result->eq_function = eq_function;
result->number_of_elements = 0;
result->number_of_deleted_elements = 0;
result->searches = 0;
result->collisions = 0;
memset (result->entries, 0, size * sizeof (hash_table_entry_t));
return result;
}
/* This function frees all memory allocated for given hash table.
Naturally the hash table must already exist. */
void
delete_hash_table (htab)
hash_table_t htab;
{
free (htab->entries);
free (htab);
}
/* This function clears all entries in the given hash table. */
void
empty_hash_table (htab)
hash_table_t htab;
{
memset (htab->entries, 0, htab->size * sizeof (hash_table_entry_t));
}
/* The following function changes size of memory allocated for the
entries and repeatedly inserts the table elements. The occupancy
of the table after the call will be about 50%. Naturally the hash
table must already exist. Remember also that the place of the
table entries is changed. */
static void
expand_hash_table (htab)
hash_table_t htab;
{
hash_table_t new_htab;
hash_table_entry_t *entry_ptr;
hash_table_entry_t *new_entry_ptr;
new_htab = create_hash_table (htab->number_of_elements * 2,
htab->hash_function, htab->eq_function);
for (entry_ptr = htab->entries; entry_ptr < htab->entries + htab->size;
entry_ptr++)
if (*entry_ptr != EMPTY_ENTRY && *entry_ptr != DELETED_ENTRY)
{
new_entry_ptr = find_hash_table_entry (new_htab, *entry_ptr, 1);
*new_entry_ptr = (*entry_ptr);
}
free (htab->entries);
*htab = (*new_htab);
free (new_htab);
}
/* This function searches for hash table entry which contains element
equal to given value or empty entry in which given value can be
placed (if the element with given value does not exist in the
table). The function works in two regimes. The first regime is
used only for search. The second is used for search and
reservation empty entry for given value. The table is expanded if
occupancy (taking into accout also deleted elements) is more than
75%. Naturally the hash table must already exist. If reservation
flag is TRUE then the element with given value should be inserted
into the table entry before another call of
`find_hash_table_entry'. */
hash_table_entry_t *
find_hash_table_entry (htab, element, reserve)
hash_table_t htab;
hash_table_entry_t element;
int reserve;
{
hash_table_entry_t *entry_ptr;
hash_table_entry_t *first_deleted_entry_ptr;
unsigned index, hash_value, secondary_hash_value;
if (htab->size * 3 <= htab->number_of_elements * 4)
{
all_expansions++;
expand_hash_table (htab);
}
hash_value = (*htab->hash_function) (element);
secondary_hash_value = 1 + hash_value % (htab->size - 2);
index = hash_value % htab->size;
htab->searches++;
all_searches++;
first_deleted_entry_ptr = NULL;
for (;;htab->collisions++, all_collisions++)
{
entry_ptr = htab->entries + index;
if (*entry_ptr == EMPTY_ENTRY)
{
if (reserve)
{
htab->number_of_elements++;
if (first_deleted_entry_ptr != NULL)
{
entry_ptr = first_deleted_entry_ptr;
*entry_ptr = EMPTY_ENTRY;
}
}
break;
}
else if (*entry_ptr != DELETED_ENTRY)
{
if ((*htab->eq_function) (*entry_ptr, element))
break;
}
else if (first_deleted_entry_ptr == NULL)
first_deleted_entry_ptr = entry_ptr;
index += secondary_hash_value;
if (index >= htab->size)
index -= htab->size;
}
return entry_ptr;
}
/* This function deletes element with given value from hash table.
The hash table entry value will be `DELETED_ENTRY' after the
function call. Naturally the hash table must already exist. Hash
table entry for given value should be not empty (or deleted). */
void
remove_element_from_hash_table_entry (htab, element)
hash_table_t htab;
hash_table_entry_t element;
{
hash_table_entry_t *entry_ptr;
entry_ptr = find_hash_table_entry (htab, element, 0);
*entry_ptr = DELETED_ENTRY;
htab->number_of_deleted_elements++;
}
/* This function clears a specified slot in a hash table.
It is useful when you've already done the lookup and don't want to
do it again. */
void
clear_hash_table_slot (htab, slot)
hash_table_t htab;
hash_table_entry_t *slot;
{
if (slot < htab->entries || slot >= htab->entries + htab->size
|| *slot == EMPTY_ENTRY || *slot == DELETED_ENTRY)
abort ();
*slot = DELETED_ENTRY;
htab->number_of_deleted_elements++;
}
/* This function scans over the entire hash table calling
CALLBACK for each live entry. If CALLBACK returns false,
the iteration stops. INFO is passed as CALLBACK's second
argument. */
void
traverse_hash_table (htab, callback, info)
hash_table_t htab;
int (*callback) PARAMS ((hash_table_entry_t, void *));
void *info;
{
hash_table_entry_t *entry_ptr;
for (entry_ptr = htab->entries; entry_ptr < htab->entries + htab->size;
entry_ptr++)
if (*entry_ptr != EMPTY_ENTRY && *entry_ptr != DELETED_ENTRY)
if (!callback (*entry_ptr, info))
break;
}
/* The following function returns current size of given hash table. */
size_t
hash_table_size (htab)
hash_table_t htab;
{
return htab->size;
}
/* The following function returns current number of elements in given
hash table. */
size_t
hash_table_elements_number (htab)
hash_table_t htab;
{
return htab->number_of_elements - htab->number_of_deleted_elements;
}
/* The following function returns number of percents of fixed
collisions during all work with given hash table. */
int
hash_table_collisions (htab)
hash_table_t htab;
{
int searches;
searches = htab->searches;
if (searches == 0)
searches++;
return htab->collisions * 100 / searches;
}
/* The following function returns number of percents of fixed
collisions during all work with all hash tables. */
int
all_hash_table_collisions ()
{
int searches;
searches = all_searches;
if (searches == 0)
searches++;
return all_collisions * 100 / searches;
}

View File

@@ -10,7 +10,7 @@
OBJS=bcopy.obj,bcmp.obj,getopt.obj,obstack.obj,xexit.obj,xmalloc.obj,hex.obj,\
getopt1.obj,cplus-dem.obj,strncasecmp.obj,strcasecmp.obj,strdup.obj,\
concat.obj,getruntime.obj,getpagesize.obj,alloca.obj,xstrerror.obj,\
xstrdup.obj,xatexit.obj,choose-temp.obj,fnmatch.obj,objalloc.obj
xmemdup.obj,xstrdup.obj,xatexit.obj,choose-temp.obj,fnmatch.obj,objalloc.obj
ifeq ($(CC),gcc)
CFLAGS=/include=([],[-.include])

View File

@@ -1,6 +1,6 @@
/* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it.
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1996-2000 Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
@@ -29,6 +29,9 @@ Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -52,10 +55,6 @@ Boston, MA 02111-1307, USA. */
#include "libiberty.h"
#if !defined (__CYGWIN__) && defined (__CYGWIN32__)
#define __CYGWIN__ 1
#endif
/* stdin file number. */
#define STDIN_FILE_NO 0
@@ -160,6 +159,8 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
FILE *argfile;
int i, el = flags & PEXECUTE_SEARCH ? 4 : 0;
if (temp_base == 0)
temp_base = choose_temp_base ();
scmd = (char *) xmalloc (strlen (program) + strlen (temp_base) + 6 + el);
rf = scmd + strlen(program) + 2 + el;
sprintf (scmd, "%s%s @%s.gp", program,
@@ -234,7 +235,7 @@ pwait (pid, status, flags)
#endif /* MSDOS */
#if defined (_WIN32) && ! defined (__UWIN__)
#if defined (_WIN32) && ! defined (_UWIN)
#include <process.h>
@@ -281,6 +282,45 @@ fix_argv (argvec)
argvec[i] = temp;
}
for (i = 0; argvec[i] != 0; i++)
{
if (strpbrk (argvec[i], " \t"))
{
int len, trailing_backslash;
char *temp;
len = strlen (argvec[i]);
trailing_backslash = 0;
/* There is an added complication when an arg with embedded white
space ends in a backslash (such as in the case of -iprefix arg
passed to cpp). The resulting quoted strings gets misinterpreted
by the command interpreter -- it thinks that the ending quote
is escaped by the trailing backslash and things get confused.
We handle this case by escaping the trailing backslash, provided
it was not escaped in the first place. */
if (len > 1
&& argvec[i][len-1] == '\\'
&& argvec[i][len-2] != '\\')
{
trailing_backslash = 1;
++len; /* to escape the final backslash. */
}
len += 2; /* and for the enclosing quotes. */
temp = xmalloc (len + 1);
temp[0] = '"';
strcpy (temp + 1, argvec[i]);
if (trailing_backslash)
temp[len-2] = '\\';
temp[len-1] = '"';
temp[len] = '\0';
argvec[i] = temp;
}
}
return (const char * const *) argvec;
}
#endif /* __CYGWIN__ */
@@ -423,7 +463,7 @@ pwait (pid, status, flags)
#endif /* __CYGWIN__ */
}
#endif /* _WIN32 && ! __UWIN__ */
#endif /* _WIN32 && ! _UWIN */
#ifdef OS2
@@ -606,7 +646,7 @@ pfinish ()
/* include for Unix-like environments but not for Dos-like environments */
#if ! defined (__MSDOS__) && ! defined (OS2) && ! defined (MPW) \
&& ! (defined (_WIN32) && ! defined (__UWIN__))
&& ! (defined (_WIN32) && ! defined (_UWIN))
extern int execv ();
extern int execvp ();
@@ -735,4 +775,4 @@ pwait (pid, status, flags)
return pid;
}
#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! (_WIN32 && ! __UWIN__) */
#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! (_WIN32 && ! _UWIN) */

68
libiberty/putenv.c Normal file
View File

@@ -0,0 +1,68 @@
/* Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
This file based on putenv.c in the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#if defined (_AIX) && !defined (__GNUC__)
#pragma alloca
#endif
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include "ansidecl.h"
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#if HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#else
# ifndef alloca
# ifdef __GNUC__
# define alloca __builtin_alloca
# else
extern char *alloca ();
# endif /* __GNUC__ */
# endif /* alloca */
#endif /* HAVE_ALLOCA_H */
/* Below this point, it's verbatim code from the glibc-2.0 implementation */
/* Put STRING, which is of the form "NAME=VALUE", in the environment. */
int
putenv (string)
const char *string;
{
const char *const name_end = strchr (string, '=');
if (name_end)
{
char *name = (char *) alloca (name_end - string + 1);
memcpy (name, string, name_end - string);
name[name_end - string] = '\0';
return setenv (name, name_end + 1, 1);
}
unsetenv (string);
return 0;
}

View File

@@ -2,17 +2,30 @@
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. [rescinded 22 July 1999]
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*

163
libiberty/setenv.c Normal file
View File

@@ -0,0 +1,163 @@
/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
This file based on setenv.c in the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include "ansidecl.h"
#include <sys/types.h> /* For `size_t' */
#include <stdio.h> /* For `NULL' */
#include <errno.h>
#if !defined(errno) && !defined(HAVE_ERRNO_DECL)
extern int errno;
#endif
#define __set_errno(ev) ((errno) = (ev))
#if HAVE_STDLIB_H
# include <stdlib.h>
#endif
#if HAVE_STRING_H
# include <string.h>
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#define __environ environ
#ifndef HAVE_ENVIRON_DECL
extern char **environ;
#endif
/* LOCK and UNLOCK are defined as no-ops. This makes the libiberty
* implementation MT-Unsafe. */
#define LOCK
#define UNLOCK
/* Below this point, it's verbatim code from the glibc-2.0 implementation */
/* If this variable is not a null pointer we allocated the current
environment. */
static char **last_environ;
int
setenv (name, value, replace)
const char *name;
const char *value;
int replace;
{
register char **ep;
register size_t size;
const size_t namelen = strlen (name);
const size_t vallen = strlen (value) + 1;
LOCK;
size = 0;
if (__environ != NULL)
for (ep = __environ; *ep != NULL; ++ep)
if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=')
break;
else
++size;
if (__environ == NULL || *ep == NULL)
{
char **new_environ;
if (__environ == last_environ && __environ != NULL)
/* We allocated this space; we can extend it. */
new_environ = (char **) realloc (last_environ,
(size + 2) * sizeof (char *));
else
new_environ = (char **) malloc ((size + 2) * sizeof (char *));
if (new_environ == NULL)
{
UNLOCK;
return -1;
}
new_environ[size] = malloc (namelen + 1 + vallen);
if (new_environ[size] == NULL)
{
free ((char *) new_environ);
__set_errno (ENOMEM);
UNLOCK;
return -1;
}
if (__environ != last_environ)
memcpy ((char *) new_environ, (char *) __environ,
size * sizeof (char *));
memcpy (new_environ[size], name, namelen);
new_environ[size][namelen] = '=';
memcpy (&new_environ[size][namelen + 1], value, vallen);
new_environ[size + 1] = NULL;
last_environ = __environ = new_environ;
}
else if (replace)
{
size_t len = strlen (*ep);
if (len + 1 < namelen + 1 + vallen)
{
/* The existing string is too short; malloc a new one. */
char *new = malloc (namelen + 1 + vallen);
if (new == NULL)
{
UNLOCK;
return -1;
}
*ep = new;
}
memcpy (*ep, name, namelen);
(*ep)[namelen] = '=';
memcpy (&(*ep)[namelen + 1], value, vallen);
}
UNLOCK;
return 0;
}
void
unsetenv (name)
const char *name;
{
const size_t len = strlen (name);
char **ep;
LOCK;
for (ep = __environ; *ep; ++ep)
if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
{
/* Found it. Remove this pointer by moving later ones back. */
char **dp = ep;
do
dp[0] = dp[1];
while (*dp++);
/* Continue the loop in case NAME appears again. */
}
UNLOCK;
}

View File

@@ -1,5 +1,5 @@
/* A splay-tree datatype.
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Contributed by Mark Mitchell (mark@markmitchell.com).
This file is part of GNU CC.
@@ -235,7 +235,7 @@ splay_tree_new (compare_fn, delete_key_fn, delete_value_fn)
splay_tree_delete_key_fn delete_key_fn;
splay_tree_delete_value_fn delete_value_fn;
{
splay_tree sp = (splay_tree) xmalloc (sizeof (struct splay_tree));
splay_tree sp = (splay_tree) xmalloc (sizeof (struct splay_tree_s));
sp->root = 0;
sp->comp = compare_fn;
sp->delete_key = delete_key_fn;
@@ -256,15 +256,15 @@ splay_tree_delete (sp)
/* Insert a new node (associating KEY with DATA) into SP. If a
previous node with the indicated KEY exists, its data is replaced
with the new value. */
with the new value. Returns the new node. */
void
splay_tree_node
splay_tree_insert (sp, key, value)
splay_tree sp;
splay_tree_key key;
splay_tree_value value;
{
int comparison;
int comparison = 0;
splay_tree_splay (sp, key);
@@ -284,7 +284,7 @@ splay_tree_insert (sp, key, value)
/* Create a new node, and insert it at the root. */
splay_tree_node node;
node = (splay_tree_node) xmalloc (sizeof (struct splay_tree_node));
node = (splay_tree_node) xmalloc (sizeof (struct splay_tree_node_s));
node->key = key;
node->value = value;
@@ -305,6 +305,8 @@ splay_tree_insert (sp, key, value)
sp->root = node;
}
return sp->root;
}
/* Lookup KEY in SP, returning VALUE if present, and NULL

View File

@@ -10,10 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 3. [rescinded 22 July 1999]
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.

View File

@@ -10,10 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 3. [rescinded 22 July 1999]
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -91,7 +88,7 @@ strtoul(nptr, endptr, base)
break;
if (c >= base)
break;
if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
any = -1;
else {
any = 1;

View File

@@ -0,0 +1,75 @@
#
# Makefile
# Copyright (C) 1999
# Free Software Foundation
#
# This file is part of the libiberty library.
# Libiberty is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# Libiberty 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
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with libiberty; see the file COPYING.LIB. If not,
# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
# This file was written by Tom Tromey <tromey@cygnus.com>.
#
# Makefile for libiberty/testsuite directory
#
srcdir = @srcdir@
VPATH = @srcdir@
SHELL = @SHELL@
CC = @CC@
CFLAGS = @CFLAGS@
LIBCFLAGS = $(CFLAGS)
# Multilib support variables.
MULTISRCTOP =
INCDIR=$(srcdir)/../$(MULTISRCTOP)../include
all:
check: @CHECK@
# Run some tests of the demangler.
check-cplus-dem: test-filter $(srcdir)/demangle-expected
$(SHELL) $(srcdir)/regress-demangle $(srcdir)/demangle-expected
# Note that we just hard-code prepends_underscore to 0. This doesn't
# matter since any particular test can override the default if need
# be.
TEST_COMPILE = $(CC) @DEFS@ $(LIBCFLAGS) -I.. -I$(INCDIR) $(HDEFINES)
test-filter: $(srcdir)/../cplus-dem.c
echo 'int prepends_underscore = 0;' > test-us.c
$(TEST_COMPILE) -o test-filter -DMAIN -DVERSION='"none"' @DEFS@ \
$(srcdir)/../cplus-dem.c test-us.c -L.. -liberty
# Standard (either GNU or Cygnus) rules we don't use.
info install-info clean-info dvi install etags tags installcheck:
# The standard clean rules.
mostlyclean:
rm -f test-us.c test-filter
clean: mostlyclean
distclean: clean
rm -f Makefile
maintainer-clean realclean: distclean
Makefile: $(srcdir)/Makefile.in ../config.status
CONFIG_FILES=testsuite/Makefile CONFIG_HEADERS= \
cd .. && $(SHELL) ./config.status

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
#! /bin/sh
# Run a regression test for the demangler.
# Usage: regress-demangle TEST-FILE
failures=0
count=0
sed -e '/^#/ d' "$1" | (
while read type; do
read mangled
read demangled
x="`echo $mangled | ./test-filter $type`"
count=`expr $count + 1`
if test "x$x" != "x$demangled"; then
failures=`expr $failures + 1`
echo "FAIL: $type $mangled"
fi
done
if test $failures -eq 0; then
echo "All $count tests passed"
else
echo "$failures of $count tests failed"
fi
test $failures -eq 0
)

View File

@@ -1,7 +1,7 @@
#include <stdio.h>
#ifndef L_tmpnam
#define L_tmpname 100
#define L_tmpnam 100
#endif
#ifndef P_tmpdir
#define P_tmpdir "/usr/tmp"

View File

@@ -105,6 +105,7 @@ int_vasprintf (result, format, args)
(void) va_arg (ap, char *);
break;
}
p++;
}
}
#ifdef TEST

View File

@@ -15,7 +15,7 @@ $! manually copied from Makefile.in
$ REQUIRED_OFILES = "argv.o basename.o choose-temp.o concat.o cplus-dem.o "-
+ "fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o "-
+ "floatformat.o objalloc.o obstack.o spaces.o strerror.o strsignal.o "-
+ "xatexit.o xexit.o xmalloc.o xstrdup.o xstrerror.o"
+ "xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o"
$! anything not caught by link+search of dummy.* should be added here
$ EXTRA_OFILES = ""
$!

View File

@@ -43,26 +43,22 @@ PTR sbrk PARAMS ((ptrdiff_t));
/* The program name if set. */
static const char *name = "";
#if !defined (__CYGWIN__) && defined (__CYGWIN32__)
#define __CYGWIN__ 1
#endif
#if ! defined (_WIN32) || defined (__CYGWIN__) || defined (__UWIN__)
#ifdef HAVE_SBRK
/* The initial sbrk, set when the program name is set. Not used for win32
ports other than cygwin32. */
static char *first_break = NULL;
#endif /* ! _WIN32 || __CYGWIN __ || __UWIN__ */
#endif /* HAVE_SBRK */
void
xmalloc_set_program_name (s)
const char *s;
{
name = s;
#if ! defined (_WIN32) || defined (__CYGWIN__) || defined (__UWIN__)
#ifdef HAVE_SBRK
/* Win32 ports other than cygwin32 don't have brk() */
if (first_break == NULL)
first_break = (char *) sbrk (0);
#endif /* ! _WIN32 || __CYGWIN __ || __UWIN__ */
#endif /* HAVE_SBRK */
}
PTR
@@ -76,7 +72,7 @@ xmalloc (size)
newmem = malloc (size);
if (!newmem)
{
#if ! defined (_WIN32) || defined (__CYGWIN__) || defined (__UWIN__)
#ifdef HAVE_SBRK
extern char **environ;
size_t allocated;
@@ -85,15 +81,15 @@ xmalloc (size)
else
allocated = (char *) sbrk (0) - (char *) &environ;
fprintf (stderr,
"\n%s%sCan not allocate %lu bytes after allocating %lu bytes\n",
"\n%s%sCannot allocate %lu bytes after allocating %lu bytes\n",
name, *name ? ": " : "",
(unsigned long) size, (unsigned long) allocated);
#else
#else /* HAVE_SBRK */
fprintf (stderr,
"\n%s%sCan not allocate %lu bytes\n",
"\n%s%sCannot allocate %lu bytes\n",
name, *name ? ": " : "",
(unsigned long) size);
#endif /* ! _WIN32 || __CYGWIN __ || __UWIN__ */
#endif /* HAVE_SBRK */
xexit (1);
}
return (newmem);
@@ -111,7 +107,7 @@ xcalloc (nelem, elsize)
newmem = calloc (nelem, elsize);
if (!newmem)
{
#if ! defined (_WIN32) || defined (__CYGWIN__)
#ifdef HAVE_SBRK
extern char **environ;
size_t allocated;
@@ -120,15 +116,15 @@ xcalloc (nelem, elsize)
else
allocated = (char *) sbrk (0) - (char *) &environ;
fprintf (stderr,
"\n%s%sCan not allocate %lu bytes after allocating %lu bytes\n",
"\n%s%sCannot allocate %lu bytes after allocating %lu bytes\n",
name, *name ? ": " : "",
(unsigned long) (nelem * elsize), (unsigned long) allocated);
#else
#else /* HAVE_SBRK */
fprintf (stderr,
"\n%s%sCan not allocate %lu bytes\n",
"\n%s%sCannot allocate %lu bytes\n",
name, *name ? ": " : "",
(unsigned long) (nelem * elsize));
#endif /* ! _WIN32 || __CYGWIN __ */
#endif /* HAVE_SBRK */
xexit (1);
}
return (newmem);
@@ -149,7 +145,7 @@ xrealloc (oldmem, size)
newmem = realloc (oldmem, size);
if (!newmem)
{
#ifndef __MINGW32__
#ifdef HAVE_SBRK
extern char **environ;
size_t allocated;
@@ -158,15 +154,15 @@ xrealloc (oldmem, size)
else
allocated = (char *) sbrk (0) - (char *) &environ;
fprintf (stderr,
"\n%s%sCan not reallocate %lu bytes after allocating %lu bytes\n",
"\n%s%sCannot reallocate %lu bytes after allocating %lu bytes\n",
name, *name ? ": " : "",
(unsigned long) size, (unsigned long) allocated);
#else
#else /* HAVE_SBRK */
fprintf (stderr,
"\n%s%sCan not reallocate %lu bytes\n",
"\n%s%sCannot reallocate %lu bytes\n",
name, *name ? ": " : "",
(unsigned long) size);
#endif /* __MINGW32__ */
#endif /* HAVE_SBRK */
xexit (1);
}
return (newmem);

22
libiberty/xmemdup.c Normal file
View File

@@ -0,0 +1,22 @@
/* xmemdup.c -- Duplicate a memory buffer, using xcalloc.
This trivial function is in the public domain.
Jeff Garzik, September 1999. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "ansidecl.h"
#include "libiberty.h"
#include <sys/types.h> /* For size_t. */
PTR
xmemdup (input, copy_size, alloc_size)
const PTR input;
size_t copy_size;
size_t alloc_size;
{
PTR output = xcalloc (1, alloc_size);
memcpy (output, input, copy_size);
return output;
}

View File

@@ -2,6 +2,7 @@
This trivial function is in the public domain.
Ian Lance Taylor, Cygnus Support, December 1995. */
#include <sys/types.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif