Commit 19ddc834 by Jason Merrill

cplus-dem.c (demangle_signature): Don't look for return types on constructors.

Tue Oct 14 12:01:00 1997  Mark Mitchell  <mmitchell@usa.net>

	* cplus-dem.c (demangle_signature): Don't look for return types on
	constructors.  Handle member template constructors.

and update from devo.

From-SVN: r15901
parent e66d884e
Tue Oct 14 12:01:00 1997 Mark Mitchell <mmitchell@usa.net>
* cplus-dem.c (demangle_signature): Don't look for return types on
constructors. Handle member template constructors.
Fri Oct 3 17:53:30 1997 Ian Lance Taylor <ian@cygnus.com>
* README: Fix configuration instructions.
Mon Sep 29 12:28:41 1997 Ian Lance Taylor <ian@cygnus.com>
* pexecute.c: Update to current version from /gd/gnu/lib:
Mon Sep 29 12:27:59 1997 Ian Lance Taylor <ian@cygnus.com>
* pexecute.c: Use spawn if __CYGWIN32__.
1997-08-08 Paul Eggert <eggert@twinsun.com>
* pexecute.c: Include "config.h" first, as per autoconf manual.
Fri Jun 27 15:20:29 1997 Scott Christley <scottc@net-community.com>
* pexecute.c (fix_argv): New function.
(pexecute): Win32 but not Cygwin32 needs its arguments fixed.
Add underscore to cwait function call.
Sun Sep 28 12:00:52 1997 Mark Mitchell <mmitchell@usa.net> Sun Sep 28 12:00:52 1997 Mark Mitchell <mmitchell@usa.net>
* cplus-dem.c (demangle_template): Add new parameter. Handle new * cplus-dem.c (demangle_template): Add new parameter. Handle new
...@@ -5,6 +32,31 @@ Sun Sep 28 12:00:52 1997 Mark Mitchell <mmitchell@usa.net> ...@@ -5,6 +32,31 @@ Sun Sep 28 12:00:52 1997 Mark Mitchell <mmitchell@usa.net>
(consume_count_with_underscores): New function. (consume_count_with_underscores): New function.
(demangle_signature): Handle new name-mangling scheme. (demangle_signature): Handle new name-mangling scheme.
Sun Sep 28 12:00:52 1997 Mark Mitchell <mmitchell@usa.net>
* cplus-dem.c (demangle_template): Add new parameter. Handle new
template-function mangling.
(consume_count_with_underscores): New function.
(demangle_signature): Handle new name-mangling scheme.
Wed Sep 24 00:31:59 1997 Felix Lee <flee@yin.cygnus.com>
* asprintf.c: stdarg.h when ALMOST_STDC
* config/mh-windows (EXTRA_OFILES): add asprintf.o and
strncasecmp.o.
Thu Aug 28 14:27:15 1997 Andrew Cagney <cagney@b1.cygnus.com>
* vasprintf.c (vasprintf): Allow for _BSD_VA_LIST_.
* config.table: Add case for FreeBSD 2.1 and 2.2, needs mh-fbsd21.
* config/mh-fbsd21 (EXTRA_OFILES): Force vasprintf.o
Wed Sep 10 12:43:10 1997 Jason Merrill <jason@yorick.cygnus.com>
* cplus-dem.c (demangle_fund_type): Change "complex" to "__complex".
Tue Sep 9 19:39:12 1997 Jim Wilson <wilson@cygnus.com> Tue Sep 9 19:39:12 1997 Jim Wilson <wilson@cygnus.com>
* Makefile.in (install_to_libdir, install_to_tooldir): Add MULTISUBDIR * Makefile.in (install_to_libdir, install_to_tooldir): Add MULTISUBDIR
...@@ -14,11 +66,21 @@ Fri Sep 5 17:28:50 1997 Jim Wilson <wilson@cygnus.com> ...@@ -14,11 +66,21 @@ Fri Sep 5 17:28:50 1997 Jim Wilson <wilson@cygnus.com>
* Makefile.in (distclean): Do MULTICLEAN before deleting Makefile. * Makefile.in (distclean): Do MULTICLEAN before deleting Makefile.
Fri Sep 5 16:34:42 1997 Andrew Cagney <cagney@b1.cygnus.com>
* asprintf.c (asprintf): New file.
* Makefile.in (CFILES): Add asprintf.c
* functions.def: Ditto.
Wed Sep 3 14:35:52 1997 Jim Wilson <wilson@cygnus.com> Wed Sep 3 14:35:52 1997 Jim Wilson <wilson@cygnus.com>
* Makefile.in (stamp-needed, stamp-config): Add MULTISRCTOP to * Makefile.in (stamp-needed, stamp-config): Add MULTISRCTOP to
pathname for move-if-change. pathname for move-if-change.
Thu Aug 28 18:53:34 1997 Andrew Cagney <cagney@b1.cygnus.com>
* argv.c (dupargv): New function, duplicate an argument vector.
Tue Aug 19 20:28:45 1997 Geoffrey Noer <noer@cygnus.com> Tue Aug 19 20:28:45 1997 Geoffrey Noer <noer@cygnus.com>
* config/mh-cygwin32: also build random.o * config/mh-cygwin32: also build random.o
......
...@@ -146,7 +146,7 @@ HFILES = ...@@ -146,7 +146,7 @@ HFILES =
# NOTE: If you add new files to the library, add them to this list # NOTE: If you add new files to the library, add them to this list
# (alphabetical), and add them to REQUIRED_OFILES or 'functions.def'. # (alphabetical), and add them to REQUIRED_OFILES or 'functions.def'.
CFILES = alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c bzero.c \ 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 \ choose-temp.c clock.c concat.c cplus-dem.c fdmatch.c fnmatch.c \
getcwd.c getopt.c getopt1.c getpagesize.c getruntime.c \ getcwd.c getopt.c getopt1.c getpagesize.c getruntime.c \
floatformat.c hex.c index.c insque.c \ floatformat.c hex.c index.c insque.c \
......
...@@ -11,10 +11,9 @@ Current members include: ...@@ -11,10 +11,9 @@ Current members include:
We expect many of the GNU subroutines that are floating around to We expect many of the GNU subroutines that are floating around to
eventually arrive here. eventually arrive here.
To build the library, do: The library must be configured from the top source directory. Don't
try to run configure in this directory. Follow the configuration
./configure HOSTTYPE instructions in ../README.
make
Please report bugs and fixes to "bug-gnu-utils@prep.ai.mit.edu". Thank you. Please report bugs and fixes to "bug-gnu-utils@prep.ai.mit.edu". Thank you.
......
...@@ -72,6 +72,63 @@ extern char *strdup (); /* Duplicate a string */ ...@@ -72,6 +72,63 @@ extern char *strdup (); /* Duplicate a string */
NAME NAME
dupargv -- duplicate an argument vector
SYNOPSIS
char **dupargv (vector)
char **vector;
DESCRIPTION
Duplicate an argument vector. Simply scans through the
vector, duplicating each argument argument until the
terminating NULL is found.
RETURNS
Returns a pointer to the argument vector if
successful. Returns NULL if there is insufficient memory to
complete building the argument vector.
*/
char **
dupargv (argv)
char **argv;
{
int argc;
char **copy;
if (argv == NULL)
return NULL;
/* the vector */
for (argc = 0; argv[argc] != NULL; argc++);
copy = (char **) malloc ((argc + 1) * sizeof (char *));
if (copy == NULL)
return NULL;
/* the strings */
for (argc = 0; argv[argc] != NULL; argc++)
{
int len = strlen (argv[argc]);
copy[argc] = malloc (sizeof (char *) * (len + 1));
if (copy[argc] == NULL)
{
freeargv (copy);
return NULL;
}
strcpy (copy[argc], argv[argc]);
}
copy[argc] = NULL;
return copy;
}
/*
NAME
freeargv -- free an argument vector freeargv -- free an argument vector
SYNOPSIS SYNOPSIS
......
...@@ -10,6 +10,8 @@ case "${host}" in ...@@ -10,6 +10,8 @@ case "${host}" in
*-*-cxux7*) frag=mh-cxux7 ;; *-*-cxux7*) frag=mh-cxux7 ;;
*-*-cygwin32) frag=mh-cygwin32 ;; *-*-cygwin32) frag=mh-cygwin32 ;;
*-*-dgux*) frag=mh-sysv ;; *-*-dgux*) frag=mh-sysv ;;
*-*-freebsd2.1.*) frag=mh-fbsd21 ;;
*-*-freebsd2.2.*) frag=mh-fbsd21 ;;
hppa*-hp-bsd*) frag=mh-hpbsd ;; hppa*-hp-bsd*) frag=mh-hpbsd ;;
*-*-hpux*) frag=mh-hpux ;; *-*-hpux*) frag=mh-hpux ;;
*-*-hiux*) frag=mh-hpux ;; *-*-hiux*) frag=mh-hpux ;;
......
HDEFINES=-DNEED_basename -DNEED_sys_siglist -DNEED_strsignal -DNO_SYS_FILE_H HDEFINES=-DNEED_basename -DNEED_sys_siglist -DNEED_strsignal -DNO_SYS_FILE_H
EXTRA_OFILES=strcasecmp.o vasprintf.o EXTRA_OFILES=asprintf.o strcasecmp.o strncasecmp.o vasprintf.o
...@@ -293,6 +293,9 @@ string_prependn PARAMS ((string *, const char *, int)); ...@@ -293,6 +293,9 @@ string_prependn PARAMS ((string *, const char *, int));
static int static int
get_count PARAMS ((const char **, int *)); get_count PARAMS ((const char **, int *));
static int
consume_count_with_underscores PARAMS ((const char**));
static int static int
consume_count PARAMS ((const char **)); consume_count PARAMS ((const char **));
...@@ -377,6 +380,42 @@ consume_count_with_underscores (mangled) ...@@ -377,6 +380,42 @@ consume_count_with_underscores (mangled)
return idx; return idx;
} }
/* Like consume_count, but for counts that are preceeded and followed
by '_' if they are greater than 10. Also, -1 is returned for
failure, since 0 can be a valid value. */
static int
consume_count_with_underscores (mangled)
const char **mangled;
{
int idx;
if (**mangled == '_')
{
(*mangled)++;
if (!isdigit (**mangled))
return -1;
idx = consume_count (mangled);
if (**mangled != '_')
/* The trailing underscore was missing. */
return -1;
(*mangled)++;
}
else
{
if (**mangled < '0' || **mangled > '9')
return -1;
idx = **mangled - '0';
(*mangled)++;
}
return idx;
}
int int
cplus_demangle_opname (opname, result, options) cplus_demangle_opname (opname, result, options)
const char *opname; const char *opname;
...@@ -831,7 +870,8 @@ demangle_signature (work, mangled, declp) ...@@ -831,7 +870,8 @@ demangle_signature (work, mangled, declp)
{ {
/* A G++ template function. Read the template arguments. */ /* A G++ template function. Read the template arguments. */
success = demangle_template (work, mangled, declp, 0, 0); success = demangle_template (work, mangled, declp, 0, 0);
expect_return_type = 1; if (!(work->constructor & 1))
expect_return_type = 1;
(*mangled)++; (*mangled)++;
break; break;
} }
...@@ -1534,7 +1574,8 @@ demangle_prefix (work, mangled, declp) ...@@ -1534,7 +1574,8 @@ demangle_prefix (work, mangled, declp)
} }
} }
else if ((scan == *mangled) else if ((scan == *mangled)
&& (isdigit (scan[2]) || (scan[2] == 'Q') || (scan[2] == 't'))) && (isdigit (scan[2]) || (scan[2] == 'Q') || (scan[2] == 't')
|| (scan[2] == 'H')))
{ {
/* The ARM says nothing about the mangling of local variables. /* The ARM says nothing about the mangling of local variables.
But cfront mangles local variables by prepending __<nesting_level> But cfront mangles local variables by prepending __<nesting_level>
...@@ -1551,7 +1592,8 @@ demangle_prefix (work, mangled, declp) ...@@ -1551,7 +1592,8 @@ demangle_prefix (work, mangled, declp)
{ {
/* A GNU style constructor starts with __[0-9Qt]. But cfront uses /* A GNU style constructor starts with __[0-9Qt]. But cfront uses
names like __Q2_3foo3bar for nested type names. So don't accept names like __Q2_3foo3bar for nested type names. So don't accept
this style of constructor for cfront demangling. */ this style of constructor for cfront demangling. A GNU
style member-template constructor starts with 'H'. */
if (!(LUCID_DEMANGLING || ARM_DEMANGLING)) if (!(LUCID_DEMANGLING || ARM_DEMANGLING))
work -> constructor += 1; work -> constructor += 1;
*mangled = scan + 2; *mangled = scan + 2;
...@@ -2345,6 +2387,37 @@ do_type (work, mangled, result) ...@@ -2345,6 +2387,37 @@ do_type (work, mangled, result)
} }
break; break;
case 'X':
case 'Y':
/* A template parm. We substitute the corresponding argument. */
{
int idx;
int lvl;
(*mangled)++;
idx = consume_count_with_underscores (mangled);
if (idx == -1
|| (work->tmpl_argvec && idx >= work->ntmpl_args)
|| consume_count_with_underscores (mangled) == -1)
{
success = 0;
break;
}
if (work->tmpl_argvec)
string_append (result, work->tmpl_argvec[idx]);
else
{
char buf[10];
sprintf(buf, "T%d", idx);
string_append (result, buf);
}
success = 1;
}
break;
default: default:
success = demangle_fund_type (work, mangled, result); success = demangle_fund_type (work, mangled, result);
break; break;
...@@ -2423,7 +2496,7 @@ demangle_fund_type (work, mangled, result) ...@@ -2423,7 +2496,7 @@ demangle_fund_type (work, mangled, result)
case 'J': case 'J':
(*mangled)++; (*mangled)++;
APPEND_BLANK (result); APPEND_BLANK (result);
string_append (result, "complex"); string_append (result, "__complex");
break; break;
default: default:
done = 1; done = 1;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* the corresponding function in libc. * the corresponding function in libc.
*/ */
DEF(asprintf, int, (), NOTHING)
DEF(atexit, int, (f), void (*f)()) DEF(atexit, int, (f), void (*f)())
DEF(bcmp, int, (s1, s2, length), char *s1 AND char *s2 AND int length ) DEF(bcmp, int, (s1, s2, length), char *s1 AND char *s2 AND int length )
DEF(bcopy, void, (s1, s2, length), char *s1 AND char *s2 AND int length ) DEF(bcopy, void, (s1, s2, length), char *s1 AND char *s2 AND int length )
......
...@@ -23,11 +23,14 @@ Boston, MA 02111-1307, USA. */ ...@@ -23,11 +23,14 @@ Boston, MA 02111-1307, USA. */
/* This file lives in at least two places: libiberty and gcc. /* This file lives in at least two places: libiberty and gcc.
Don't change one without the other. */ Don't change one without the other. */
#ifdef IN_GCC
#include "config.h"
#endif
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#ifdef IN_GCC #ifdef IN_GCC
#include "config.h"
#include "gansidecl.h" #include "gansidecl.h"
/* ??? Need to find a suitable header file. */ /* ??? Need to find a suitable header file. */
#define PEXECUTE_FIRST 1 #define PEXECUTE_FIRST 1
...@@ -223,6 +226,51 @@ pwait (pid, status, flags) ...@@ -223,6 +226,51 @@ pwait (pid, status, flags)
extern int _spawnv (); extern int _spawnv ();
extern int _spawnvp (); extern int _spawnvp ();
#ifdef __CYGWIN32__
#define fix_argv(argvec) (argvec)
#else
/* This is a kludge to get around the Microsoft C spawn functions' propensity
to remove the outermost set of double quotes from all arguments. */
const char * const *
fix_argv (argvec)
char **argvec;
{
int i;
for (i = 1; argvec[i] != 0; i++)
{
int len, j;
char *temp, *newtemp;
temp = argvec[i];
len = strlen (temp);
for (j = 0; j < len; j++)
{
if (temp[j] == '"')
{
newtemp = xmalloc (len + 2);
strncpy (newtemp, temp, j);
newtemp [j] = '\\';
strncpy (&newtemp [j+1], &temp [j], len-j);
newtemp [len+1] = 0;
temp = newtemp;
len++;
j++;
}
}
argvec[i] = temp;
}
return (const char * const *) argvec;
}
#endif /* ! defined (__CYGWIN32__) */
int int
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
const char *program; const char *program;
...@@ -236,7 +284,8 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) ...@@ -236,7 +284,8 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE) if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE)
abort (); abort ();
pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv) (_P_NOWAIT, program, argv); pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv)
(_P_NOWAIT, program, fix_argv(argv));
if (pid == -1) if (pid == -1)
{ {
*errmsg_fmt = install_error_msg; *errmsg_fmt = install_error_msg;
...@@ -254,7 +303,7 @@ pwait (pid, status, flags) ...@@ -254,7 +303,7 @@ pwait (pid, status, flags)
{ {
/* ??? Here's an opportunity to canonicalize the values in STATUS. /* ??? Here's an opportunity to canonicalize the values in STATUS.
Needed? */ Needed? */
return cwait (status, pid, WAIT_CHILD); return _cwait (status, pid, WAIT_CHILD);
} }
#endif /* _WIN32 */ #endif /* _WIN32 */
......
...@@ -118,7 +118,11 @@ int ...@@ -118,7 +118,11 @@ int
vasprintf (result, format, args) vasprintf (result, format, args)
char **result; char **result;
const char *format; const char *format;
#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
_BSD_VA_LIST_ args;
#else
va_list args; va_list args;
#endif
{ {
return int_vasprintf (result, format, &args); return int_vasprintf (result, format, &args);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment