merge from gcc

This commit is contained in:
DJ Delorie 2003-02-13 18:52:46 +00:00
parent e46e5ccdd0
commit fcd7c7c9fd
2 changed files with 32 additions and 15 deletions

View file

@ -1,3 +1,19 @@
2003-02-13 Daniel Jacobowitz <drow@mvista.com>
Fix PR c++/7612.
* cplus-dem.c (demangle_signature): Call string_delete.
Remove extra string_init.
(demangle_arm_hp_template): Call string_delete instead of
string_clear. Add missing string_delete call.
(demangle_qualified): Add missing string_delete call.
(do_type): Remove unused variable btype. Add missing string_delete
call. Call string_delete instead of string_clear.
(demangle_fund_type): Move variable btype inside of the switch
statement. Add missing string_delete call.
(do_arg): Call string_delete instead of string_clear. Remove extra
string_init.
(demangle_nested_args): Free work->previous_argument.
2003-02-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2003-02-12 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* acconfig.h: New file. Add uintptr_t. * acconfig.h: New file. Add uintptr_t.

View file

@ -1429,6 +1429,7 @@ demangle_signature (work, mangled, declp)
{ {
string_append (&s, SCOPE_STRING (work)); string_append (&s, SCOPE_STRING (work));
string_prepends (declp, &s); string_prepends (declp, &s);
string_delete (&s);
} }
oldmangled = NULL; oldmangled = NULL;
expect_func = 1; expect_func = 1;
@ -1508,7 +1509,6 @@ demangle_signature (work, mangled, declp)
{ {
/* Read the return type. */ /* Read the return type. */
string return_type; string return_type;
string_init (&return_type);
(*mangled)++; (*mangled)++;
success = do_type (work, mangled, &return_type); success = do_type (work, mangled, &return_type);
@ -2321,7 +2321,7 @@ demangle_arm_hp_template (work, mangled, n, declp)
string_append (declp, "<"); string_append (declp, "<");
while (1) while (1)
{ {
string_clear (&arg); string_delete (&arg);
switch (**mangled) switch (**mangled)
{ {
case 'T': case 'T':
@ -2378,7 +2378,7 @@ demangle_arm_hp_template (work, mangled, n, declp)
string_append (declp, "<"); string_append (declp, "<");
/* should do error checking here */ /* should do error checking here */
while (args < e) { while (args < e) {
string_clear (&arg); string_delete (&arg);
/* Check for type or literal here */ /* Check for type or literal here */
switch (*args) switch (*args)
@ -2393,6 +2393,7 @@ demangle_arm_hp_template (work, mangled, n, declp)
goto cfront_template_args_done; goto cfront_template_args_done;
string_append (&arg, "("); string_append (&arg, "(");
string_appends (&arg, &type_str); string_appends (&arg, &type_str);
string_delete (&type_str);
string_append (&arg, ")"); string_append (&arg, ")");
if (*args != 'L') if (*args != 'L')
goto cfront_template_args_done; goto cfront_template_args_done;
@ -3350,6 +3351,7 @@ demangle_qualified (work, mangled, result, isfuncname, append)
} }
else else
{ {
string_delete (&last_name);
success = do_type (work, mangled, &last_name); success = do_type (work, mangled, &last_name);
if (!success) if (!success)
break; break;
@ -3492,10 +3494,8 @@ do_type (work, mangled, result)
string decl; string decl;
const char *remembered_type; const char *remembered_type;
int type_quals; int type_quals;
string btype;
type_kind_t tk = tk_none; type_kind_t tk = tk_none;
string_init (&btype);
string_init (&decl); string_init (&decl);
string_init (result); string_init (result);
@ -3613,6 +3613,7 @@ do_type (work, mangled, result)
string temp; string temp;
do_type (work, mangled, &temp); do_type (work, mangled, &temp);
string_prepends (&decl, &temp); string_prepends (&decl, &temp);
string_delete (&temp);
} }
else if (**mangled == 't') else if (**mangled == 't')
{ {
@ -3623,7 +3624,7 @@ do_type (work, mangled, result)
if (success) if (success)
{ {
string_prependn (&decl, temp.b, temp.p - temp.b); string_prependn (&decl, temp.b, temp.p - temp.b);
string_clear (&temp); string_delete (&temp);
} }
else else
break; break;
@ -3803,11 +3804,8 @@ demangle_fund_type (work, mangled, result)
int success = 1; int success = 1;
char buf[10]; char buf[10];
unsigned int dec = 0; unsigned int dec = 0;
string btype;
type_kind_t tk = tk_integral; type_kind_t tk = tk_integral;
string_init (&btype);
/* First pick off any type qualifiers. There can be more than one. */ /* First pick off any type qualifiers. There can be more than one. */
while (!done) while (!done)
@ -3979,8 +3977,11 @@ demangle_fund_type (work, mangled, result)
} }
case 't': case 't':
{ {
string btype;
string_init (&btype);
success = demangle_template (work, mangled, &btype, 0, 1, 1); success = demangle_template (work, mangled, &btype, 0, 1, 1);
string_appends (result, &btype); string_appends (result, &btype);
string_delete (&btype);
break; break;
} }
default: default:
@ -4182,12 +4183,9 @@ do_arg (work, mangled, result)
do not want to add additional types to the back-referenceable do not want to add additional types to the back-referenceable
type vector when processing a repeated type. */ type vector when processing a repeated type. */
if (work->previous_argument) if (work->previous_argument)
string_clear (work->previous_argument); string_delete (work->previous_argument);
else else
{ work->previous_argument = (string*) xmalloc (sizeof (string));
work->previous_argument = (string*) xmalloc (sizeof (string));
string_init (work->previous_argument);
}
if (!do_type (work, mangled, work->previous_argument)) if (!do_type (work, mangled, work->previous_argument))
return 0; return 0;
@ -4551,7 +4549,10 @@ demangle_nested_args (work, mangled, declp)
/* Restore the previous_argument field. */ /* Restore the previous_argument field. */
if (work->previous_argument) if (work->previous_argument)
string_delete (work->previous_argument); {
string_delete (work->previous_argument);
free ((char *) work->previous_argument);
}
work->previous_argument = saved_previous_argument; work->previous_argument = saved_previous_argument;
--work->forgetting_types; --work->forgetting_types;
work->nrepeats = saved_nrepeats; work->nrepeats = saved_nrepeats;