merge from gcc repository

This commit is contained in:
DJ Delorie 2000-10-12 02:16:48 +00:00
parent 3ef20aaa54
commit 74bcd5294f
14 changed files with 1002 additions and 395 deletions

View file

@ -1,3 +1,7 @@
2000-10-11 Mark Mitchell <mark@codesourcery.com>
* splay-tree.h (splay_tree_predecessor): Declare.
2000-09-29 Hans-Peter Nilsson <hp@axis.com>
* dis-asm.h: Declare cris_get_disassembler, not print_insn_cris.

View file

@ -1,5 +1,5 @@
/* A splay-tree datatype.
Copyright (C) 1998 Free Software Foundation, Inc.
Copyright (C) 1998, 2000 Free Software Foundation, Inc.
Contributed by Mark Mitchell (mark@markmitchell.com).
This file is part of GNU CC.
@ -104,6 +104,12 @@ extern void splay_tree_remove PARAMS((splay_tree,
extern splay_tree_node splay_tree_lookup
PARAMS((splay_tree,
splay_tree_key));
extern splay_tree_node splay_tree_predecessor
PARAMS((splay_tree,
splay_tree_key));
extern splay_tree_node splay_tree_successor
PARAMS((splay_tree,
splay_tree_key));
extern int splay_tree_foreach PARAMS((splay_tree,
splay_tree_foreach_fn,
void*));

View file

@ -1,3 +1,187 @@
2000-10-11 DJ Delorie <dj@redhat.com>
Merge from gcc, all 2000-10-11 entries below
2000-10-11 Mark Mitchell <mark@codesourcery.com>
* splay-tree.c (splay_tree_insert): Fix formatting.
2000-10-11 Mark Mitchell <mark@codesourcery.com>
* splay-tree.c (splay_tree_predecessor): Fix typo in comment.
2000-10-11 Mark Mitchell <mark@codesourcery.com>
* splay-tree.c (splay_tree_predecessor): New function.
(splay_tree_successor): Likewise.
2000-10-11 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c: Fix copyright banner.
2000-10-11 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c (status_allocation_failed): Rearrange whitespace.
(demangle_type): Handle substitution candidates correctly in the
face of special substitutions.
2000-10-11 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c (demangle_encoding): Rename variable.
(demangle_name): Rename parameter. Handle return type
suppression.
(demangle_nested_name): Rename parameter.
(demangle_prefix): Likewise. Change return type suppression.
(demangle_unqualified_name): Add parameter. Flag constructors and
conversion operators.
(demangle_special_name): Fix comment.
(demangle_type): Rename variable.
(demangle_bare_function_type): Check for missing return type and
parameter.
(demangle_class_enum_type): Rename parameter.
(demangle_discriminator): Fix misspelling in comment.
2000-10-11 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c (demangle_template_arg): Eat an `E' after an
<expression>.
2000-10-11 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c (demangle_type_ptr): Increment position past
pointer and reference characters.
2000-10-11 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c (demangle_nv_offset): New function.
(demangle_v_offset): Likewise.
(demangle_call_offset): Likewise.
(demangle_special_name): Update thunk demangling to comply with
ABI changes.
2000-10-11 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c (ANONYMOUS_NAMESPACE_PREFIX): New macro.
(substitution_def): Remove template_parm_number.
(NOT_TEMPLATE_PARM): Remove.
(result_insert_string): New macro.
(result_insert): Likewise.
(result_insert_char): Likewise.
(substitution_add): Remove last parameter. Don't store template
parm number.
(BFT_NO_RETURN_TYPE): Define as NULL.
(demangle_encoding): Adjust call to demangle_bare_function_type.
(demangle_name): Adjust substitution. Adjust call to
substitution_add.
(demangle_prefix): Adjust call to substitution_add.
(demangle_identifier): Handle anonymous namespaces.
(demangle_operator_name): Change demangling of vendor-extended
operator to match ABI changes.
(demangle_type_ptr): Change parameters. Make recursive. Handle
substitutions here.
(demangle_type): Adjust calls to demangle_template_param,
substitution_add, and demangle_type_ptr. Fix substitution of
templated types.
(demangle_function_type): Change parameter to a pointer.
(demangle_bare_function_type): Likewise. Adjust insertion point.
(demangle_template_param): Remove last parameter.
(demangle_expr_primary): Remove unused variable. Adjust call to
demangle_template_param.
(is_mangled_char): Accept `$' and `.'.
* cplus-dem.c (gnu_new_abi_symbol_characters): Add '$' and '.'.
* dyn-string.c (dyn_string_insert_char): New function.
2000-10-11 Richard Henderson <rth@cygnus.com>
* Makefile.in (md5.o): Depend on config.h.
2000-10-11 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c (demangle_name): Initialize template_p in local
name case. Don't re-add substitutions as candidates.
(demangle_nested_name): Use <unqualified-name>.
(demangle_prefix): Likewise. Don't add template names as
substitution candidates twice, or re-add a substitution or the
last prefix component.
(demangle_local_name): Adjust output format.
2000-10-11 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c (result_add_separated_char): Change parameter to
int.
(substitution_add): Don't check for duplicates. Check if
previously allocated size is zero.
(demangle_name): Remove duplicate check for std substitution.
Clear template flag appropriately.
(demangle_prefix): Remove argument to demangle_substitution.
Don't check that template flag is already set.
(demangle_operator_name): Add pt operator.
(demangle_type): Don't treat r as built-in type. Remove argument
to demangle_substitution. Fix substitution candidate mechanics.
Handle <template-template-parm>s. Improve comments.
(demangle_template_param): Don't handle template arg lists here.
(demangle_substitution): Remove parameter.
(print_usage): Remove extra fprintf option.
2000-10-11 Greg McGary <greg@mcgary.org>
* libiberty/random.c (end_ptr): Revert previous change.
2000-10-11 Greg McGary <greg@mcgary.org>
* libiberty/cplus-dem.c (cplus_demangle_opname, cplus_mangle_opname,
demangle_expression, demangle_function_name): Use ARRAY_SIZE.
* libiberty/random.c (end_ptr): Likewise.
2000-10-11 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c (result_close_template_list): Remove function.
(result_add_separated_char): New function.
(result_open_template_list): New macro.
(result_close_template_list): Likewise.
(demangle_prefix): Don't set template_p if the
prefix ends with a ctor name.
(demangle_type_ptr): Remove duplicate RETURN_IF_ERROR.
(demangle_type): Check for template args after substitution.
(demangle_template_args): Use result_open_template_list.
2000-10-11 Zack Weinberg <zack@wolery.cumb.org>
* pexecute.c: Don't use vfork. Initialize 'pid' before retry loop.
2000-10-11 RodneyBrown <RodneyBrown@pmsc.com>
Jeff Law <law@cygnus.com>
* getcwd.c: Include string.h, stdlib.h for prototypes
* Makefile.in (rename.o, waitpid.o): Depend on config.h
* rename.c: Include config.h, unistd.h
* waitpid.c: Include config.h, sys/wait.h
2000-10-11 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c (demangle_ctor_dtor_name): Remove not-in-charge
allocating ctor mangling.
(demangle_array_type): Handle empty and non-constant array length.
2000-10-11 Mike Stump <mrs@wrs.com>
* Makefile.in (xexit.o): Add dependency for config.h in xexit.c.
* (vasprintf.o): Add dependency for config.h in vasprintf.c.
2000-10-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cp-demangle.c (cp_demangle_type): Wrap in IN_LIBGCC2.
* setenv.c (setenv): Initialize variable `ep'.
* sigsetmask.c (abort): Prototype.
* vasprintf.c: Include config.h. Check ANSI_PROTOTYPES, not
__STDC__ for stdarg.h include.
(int_vasprintf): Prototype.
(checkit): Prototype. Use VPARAMS/ANSI_PROTOTYPES/VA_START in
definition. Cast `global_total_width' in comparison.
(main): Prototype. Return a value.
* vfork.c (fork): Prototype.
* xexit.c: Include config.h.
2000-09-25 Michael Sokolov <msokolov@ivan.Harhan.ORG>
* md5.c: #include "ansidecl.h".

View file

@ -276,6 +276,7 @@ getruntime.o: config.h $(INCDIR)/libiberty.h
hex.o: $(INCDIR)/libiberty.h
floatformat.o: $(INCDIR)/floatformat.h
mkstemps.o: config.h
md5.o: config.h
objalloc.o: config.h $(INCDIR)/objalloc.h
obstack.o: config.h $(INCDIR)/obstack.h
partition.o: config.h $(INCDIR)/partition.h
@ -289,8 +290,9 @@ strerror.o: config.h $(INCDIR)/libiberty.h
strsignal.o: config.h $(INCDIR)/libiberty.h
strtol.o: config.h
strtoul.o: config.h
vasprintf.o: config.h
xatexit.o: $(INCDIR)/libiberty.h
xexit.o: $(INCDIR)/libiberty.h
xexit.o: config.h $(INCDIR)/libiberty.h
xmalloc.o: config.h $(INCDIR)/libiberty.h
xmemdup.o: config.h $(INCDIR)/libiberty.h
xstrdup.o: config.h $(INCDIR)/libiberty.h

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,6 @@
/* Demangler for GNU C++
Copyright 1989, 91, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
Copyright 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999,
2000 Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.uucp)
Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling
Modified by Satish Pai (pai@apollo.hp.com) for HP demangling
@ -705,7 +706,7 @@ cplus_demangle_opname (opname, result, options)
{
/* Operator. */
size_t i;
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
for (i = 0; i < ARRAY_SIZE (optable); i++)
{
if (strlen (optable[i].in) == 2
&& memcmp (optable[i].in, opname + 2, 2) == 0)
@ -723,7 +724,7 @@ cplus_demangle_opname (opname, result, options)
{
/* Assignment. */
size_t i;
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
for (i = 0; i < ARRAY_SIZE (optable); i++)
{
if (strlen (optable[i].in) == 3
&& memcmp (optable[i].in, opname + 2, 3) == 0)
@ -747,7 +748,7 @@ cplus_demangle_opname (opname, result, options)
&& memcmp (opname + 3, "assign_", 7) == 0)
{
size_t i;
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
for (i = 0; i < ARRAY_SIZE (optable); i++)
{
len1 = len - 10;
if ((int) strlen (optable[i].in) == len1
@ -764,7 +765,7 @@ cplus_demangle_opname (opname, result, options)
else
{
size_t i;
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
for (i = 0; i < ARRAY_SIZE (optable); i++)
{
len1 = len - 3;
if ((int) strlen (optable[i].in) == len1
@ -811,7 +812,7 @@ cplus_mangle_opname (opname, options)
int len;
len = strlen (opname);
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
for (i = 0; i < ARRAY_SIZE (optable); i++)
{
if ((int) strlen (optable[i].out) == len
&& (options & DMGL_ANSI) == (optable[i].flags & DMGL_ANSI)
@ -1573,9 +1574,7 @@ demangle_expression (work, mangled, s, tk)
len = strlen (*mangled);
for (i = 0;
i < sizeof (optable) / sizeof (optable [0]);
++i)
for (i = 0; i < ARRAY_SIZE (optable); ++i)
{
size_t l = strlen (optable[i].in);
@ -4449,7 +4448,7 @@ demangle_function_name (work, mangled, declp, scan)
if (declp->p - declp->b >= 10 /* op$assign_ */
&& memcmp (declp->b + 3, "assign_", 7) == 0)
{
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
for (i = 0; i < ARRAY_SIZE (optable); i++)
{
int len = declp->p - declp->b - 10;
if ((int) strlen (optable[i].in) == len
@ -4465,7 +4464,7 @@ demangle_function_name (work, mangled, declp, scan)
}
else
{
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
for (i = 0; i < ARRAY_SIZE (optable); i++)
{
int len = declp->p - declp->b - 3;
if ((int) strlen (optable[i].in) == len
@ -4513,7 +4512,7 @@ demangle_function_name (work, mangled, declp, scan)
if (declp->b[4] == '\0')
{
/* Operator. */
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
for (i = 0; i < ARRAY_SIZE (optable); i++)
{
if (strlen (optable[i].in) == 2
&& memcmp (optable[i].in, declp->b + 2, 2) == 0)
@ -4530,7 +4529,7 @@ demangle_function_name (work, mangled, declp, scan)
if (declp->b[2] == 'a' && declp->b[5] == '\0')
{
/* Assignment. */
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
for (i = 0; i < ARRAY_SIZE (optable); i++)
{
if (strlen (optable[i].in) == 3
&& memcmp (optable[i].in, declp->b + 2, 3) == 0)
@ -4873,7 +4872,7 @@ hp_symbol_characters ()
static const char *
gnu_new_abi_symbol_characters ()
{
return "_";
return "_$.";
}

View file

@ -305,6 +305,30 @@ dyn_string_insert_cstr (dest, pos, src)
return 1;
}
/* Inserts character C into DEST starting at position POS. DEST is
expanded as necessary. Returns 1 on success. On failure,
RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */
int
dyn_string_insert_char (dest, pos, c)
dyn_string_t dest;
int pos;
int c;
{
int i;
if (dyn_string_resize (dest, dest->length + 1) == NULL)
return 0;
/* Make room for the insertion. Be sure to copy the NUL. */
for (i = dest->length; i >= pos; --i)
dest->s[i + 1] = dest->s[i];
/* Add the new character. */
dest->s[pos] = c;
/* Compute the new length. */
++dest->length;
return 1;
}
/* Append S to DS, resizing DS if necessary. Returns 1 on success.
On failure, if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and
returns 0. */

View file

@ -46,19 +46,6 @@ extern int errno;
#include <sys/wait.h>
#endif
#ifdef vfork /* Autoconf may define this to fork for us. */
# define VFORK_STRING "fork"
#else
# define VFORK_STRING "vfork"
#endif
#ifdef HAVE_VFORK_H
#include <vfork.h>
#endif
#ifdef VMS
#define vfork() (decc$$alloc_vfork_blocks() >= 0 ? \
lib$get_current_invo_context(decc$$get_vfork_jmpbuf()) : -1)
#endif /* VMS */
#include "libiberty.h"
/* stdin file number. */
@ -714,9 +701,10 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
/* Fork a subprocess; wait and retry if it fails. */
sleep_interval = 1;
pid = -1;
for (retries = 0; retries < 4; retries++)
{
pid = vfork ();
pid = fork ();
if (pid >= 0)
break;
sleep (sleep_interval);
@ -726,11 +714,9 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
switch (pid)
{
case -1:
{
*errmsg_fmt = VFORK_STRING;
*errmsg_fmt = "fork";
*errmsg_arg = NULL;
return -1;
}
case 0: /* child */
/* Move the input and output pipes into place, if necessary. */
@ -754,7 +740,6 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
/* Exec the program. */
(*func) (program, argv);
/* Note: Calling fprintf and exit here doesn't seem right for vfork. */
fprintf (stderr, "%s: ", this_pname);
fprintf (stderr, install_error_msg, program);
fprintf (stderr, ": %s\n", xstrerror (errno));

View file

@ -63,7 +63,7 @@ setenv (name, value, replace)
const char *value;
int replace;
{
register char **ep;
register char **ep = 0;
register size_t size;
const size_t namelen = strlen (name);
const size_t vallen = strlen (value) + 1;

View file

@ -12,6 +12,8 @@
#include <sys/types.h>
#include <signal.h>
extern void abort PARAMS ((void)) ATTRIBUTE_NORETURN;
#ifdef SIG_SETMASK
int
DEFUN(sigsetmask,(set),

View file

@ -1,5 +1,5 @@
/* A splay-tree datatype.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
Contributed by Mark Mitchell (mark@markmitchell.com).
This file is part of GNU CC.
@ -368,6 +368,72 @@ splay_tree_lookup (sp, key)
return 0;
}
/* Return the immediate predecessor KEY, or NULL if there is no
predecessor. KEY need not be present in the tree. */
splay_tree_node
splay_tree_predecessor (sp, key)
splay_tree sp;
splay_tree_key key;
{
int comparison;
splay_tree_node node;
/* If the tree is empty, there is certainly no predecessor. */
if (!sp->root)
return NULL;
/* Splay the tree around KEY. That will leave either the KEY
itself, its predecessor, or its successor at the root. */
splay_tree_splay (sp, key);
comparison = (*sp->comp)(sp->root->key, key);
/* If the predecessor is at the root, just return it. */
if (comparison < 0)
return sp->root;
/* Otherwise, find the leftmost element of the right subtree. */
node = sp->root->left;
if (node)
while (node->right)
node = node->right;
return node;
}
/* Return the immediate successor KEY, or NULL if there is no
predecessor. KEY need not be present in the tree. */
splay_tree_node
splay_tree_successor (sp, key)
splay_tree sp;
splay_tree_key key;
{
int comparison;
splay_tree_node node;
/* If the tree is empty, there is certainly no predecessor. */
if (!sp->root)
return NULL;
/* Splay the tree around KEY. That will leave either the KEY
itself, its predecessor, or its successor at the root. */
splay_tree_splay (sp, key);
comparison = (*sp->comp)(sp->root->key, key);
/* If the successor is at the root, just return it. */
if (comparison > 0)
return sp->root;
/* Otherwise, find the rightmost element of the left subtree. */
node = sp->root->right;
if (node)
while (node->left)
node = node->left;
return node;
}
/* Call FN, passing it the DATA, for every node in SP, following an
in-order traversal. If FN every returns a non-zero value, the
iteration ceases immediately, and the value is returned.

View file

@ -18,21 +18,31 @@ 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. */
#ifdef __STDC__
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <ansidecl.h>
#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <stdio.h>
#include <string.h>
#include <ansidecl.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#else
extern unsigned long strtoul ();
extern PTR malloc ();
#endif
#include "libiberty.h"
#ifdef TEST
int global_total_width;
#endif
unsigned long strtoul ();
char *malloc ();
static int int_vasprintf PARAMS ((char **, const char *, va_list *));
static int
int_vasprintf (result, format, args)
@ -60,7 +70,7 @@ int_vasprintf (result, format, args)
total_width += abs (va_arg (ap, int));
}
else
total_width += strtoul (p, &p, 10);
total_width += strtoul (p, (char **) &p, 10);
if (*p == '.')
{
++p;
@ -70,7 +80,7 @@ int_vasprintf (result, format, args)
total_width += abs (va_arg (ap, int));
}
else
total_width += strtoul (p, &p, 10);
total_width += strtoul (p, (char **) &p, 10);
}
while (strchr ("hlL", *p))
++p;
@ -132,33 +142,33 @@ vasprintf (result, format, args)
}
#ifdef TEST
void
checkit
#ifdef __STDC__
(const char* format, ...)
#else
(va_alist)
va_dcl
#endif
static void checkit PARAMS ((const char *, ...));
static void
checkit VPARAMS ((const char* format, ...))
{
va_list args;
char *result;
#ifdef __STDC__
va_start (args, format);
#else
char *format;
va_start (args);
format = va_arg (args, char *);
#ifndef ANSI_PROTOTYPES
const char *format;
#endif
VA_START (args, format);
#ifndef ANSI_PROTOTYPES
format = va_arg (args, const char *);
#endif
vasprintf (&result, format, args);
if (strlen (result) < global_total_width)
if (strlen (result) < (size_t) global_total_width)
printf ("PASS: ");
else
printf ("FAIL: ");
printf ("%d %s\n", global_total_width, result);
}
extern int main PARAMS ((void));
int
main ()
{
@ -169,5 +179,7 @@ main ()
checkit ("%s", "jjjjjjjjjiiiiiiiiiiiiiiioooooooooooooooooppppppppppppaa\n\
777777777777777777333333333333366666666666622222222222777777777777733333");
checkit ("%f%s%d%s", 1.0, "foo", 77, "asdjffffffffffffffiiiiiiiiiiixxxxx");
return 0;
}
#endif /* TEST */

View file

@ -1,6 +1,10 @@
/* Emulate vfork using just plain fork, for systems without a real vfork.
This function is in the public domain. */
#include "ansidecl.h"
extern int fork PARAMS ((void));
int
vfork ()
{

View file

@ -17,13 +17,15 @@ 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. */
#include "ansidecl.h"
#include "libiberty.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include "libiberty.h"
/* This variable is set by xatexit if it is called. This way, xmalloc
doesn't drag xatexit into the link. */