* value.c (value_fn_field): Constify.

* symtab.c (gdb_mangle_name): Constify.
	* stabsread.c (update_method_name_from_physname): Make 'physname'
	argument const.
	* p-typeprint.c (pascal_type_print_method_args): Make arguments
	const.  Use explicit fputc_filtered loop.
	(pascal_type_print_base): Constify.
	* p-lang.h (pascal_type_print_method_args): Update.
	* linespec.c (add_matching_methods): Constify.
	(add_constructors): Likewise.
	* jv-typeprint.c (java_type_print_base): Constify.
	* gdbtypes.h (struct cplus_struct_type)
	<fn_fieldlist.fn_field.physname>: Now const.
	* dwarf2read.c (compute_delayed_physnames): Constify.
	(dwarf2_add_member_fn): Likewise.
	* c-typeprint.c (c_type_print_base): Constify.  Use cleanups.
This commit is contained in:
Tom Tromey 2011-05-18 16:30:37 +00:00
parent 5652e39766
commit 1d06ead687
11 changed files with 58 additions and 29 deletions

View File

@ -1,3 +1,22 @@
2011-05-18 Tom Tromey <tromey@redhat.com>
* value.c (value_fn_field): Constify.
* symtab.c (gdb_mangle_name): Constify.
* stabsread.c (update_method_name_from_physname): Make 'physname'
argument const.
* p-typeprint.c (pascal_type_print_method_args): Make arguments
const. Use explicit fputc_filtered loop.
(pascal_type_print_base): Constify.
* p-lang.h (pascal_type_print_method_args): Update.
* linespec.c (add_matching_methods): Constify.
(add_constructors): Likewise.
* jv-typeprint.c (java_type_print_base): Constify.
* gdbtypes.h (struct cplus_struct_type)
<fn_fieldlist.fn_field.physname>: Now const.
* dwarf2read.c (compute_delayed_physnames): Constify.
(dwarf2_add_member_fn): Likewise.
* c-typeprint.c (c_type_print_base): Constify. Use cleanups.
2011-05-18 Pedro Alves <pedro@codesourcery.com>
* infrun.c (resume): Mention which is the current thread, and its

View File

@ -719,9 +719,6 @@ c_type_print_base (struct type *type, struct ui_file *stream,
int i;
int len, real_len;
int lastval;
char *mangled_name;
char *demangled_name;
char *demangled_no_static;
enum
{
s_none, s_public, s_private, s_protected
@ -1001,7 +998,10 @@ c_type_print_base (struct type *type, struct ui_file *stream,
for (j = 0; j < len2; j++)
{
char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
const char *mangled_name;
char *demangled_name;
struct cleanup *inner_cleanup;
const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
int is_full_physname_constructor =
is_constructor_name (physname)
|| is_destructor_name (physname)
@ -1011,6 +1011,8 @@ c_type_print_base (struct type *type, struct ui_file *stream,
if (TYPE_FN_FIELD_ARTIFICIAL (f, j))
continue;
inner_cleanup = make_cleanup (null_cleanup, NULL);
QUIT;
if (TYPE_FN_FIELD_PROTECTED (f, j))
{
@ -1064,8 +1066,14 @@ c_type_print_base (struct type *type, struct ui_file *stream,
fputs_filtered (" ", stream);
}
if (TYPE_FN_FIELD_STUB (f, j))
/* Build something we can demangle. */
mangled_name = gdb_mangle_name (type, i, j);
{
char *tem;
/* Build something we can demangle. */
tem = gdb_mangle_name (type, i, j);
make_cleanup (xfree, tem);
mangled_name = tem;
}
else
mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j);
@ -1107,6 +1115,7 @@ c_type_print_base (struct type *type, struct ui_file *stream,
if (p != NULL)
{
int length = p - demangled_no_class;
char *demangled_no_static;
demangled_no_static
= (char *) xmalloc (length + 1);
@ -1121,8 +1130,7 @@ c_type_print_base (struct type *type, struct ui_file *stream,
xfree (demangled_name);
}
if (TYPE_FN_FIELD_STUB (f, j))
xfree (mangled_name);
do_cleanups (inner_cleanup);
fprintf_filtered (stream, ";\n");
}

View File

@ -4609,10 +4609,10 @@ compute_delayed_physnames (struct dwarf2_cu *cu)
struct delayed_method_info *mi;
for (i = 0; VEC_iterate (delayed_method_info, cu->method_list, i, mi) ; ++i)
{
char *physname;
const char *physname;
struct fn_fieldlist *fn_flp
= &TYPE_FN_FIELDLIST (mi->type, mi->fnfield_index);
physname = (char *) dwarf2_physname ((char *) mi->name, mi->die, cu);
physname = dwarf2_physname ((char *) mi->name, mi->die, cu);
fn_flp->fn_fields[mi->index].physname = physname ? physname : "";
}
}
@ -6792,7 +6792,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
}
else
{
char *physname = (char *) dwarf2_physname (fieldname, die, cu);
const char *physname = dwarf2_physname (fieldname, die, cu);
fnp->physname = physname ? physname : "";
}

View File

@ -773,7 +773,7 @@ struct cplus_struct_type
arguments. See gdb_mangle_name for the conversion from this
format to the one used if is_stub is clear. */
char *physname;
const char *physname;
/* The function type for the method.
(This comment used to say "The return value of the method",

View File

@ -221,7 +221,8 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
for (j = 0; j < n_overloads; j++)
{
char *real_physname, *physname, *p;
const char *real_physname;
char *physname, *p;
int is_full_physname_constructor;
real_physname = TYPE_FN_FIELD_PHYSNAME (f, j);

View File

@ -312,20 +312,21 @@ add_matching_methods (int method_counter, struct type *t,
--field_counter)
{
struct fn_field *f;
char *phys_name;
const char *phys_name;
f = TYPE_FN_FIELDLIST1 (t, method_counter);
if (TYPE_FN_FIELD_STUB (f, field_counter))
{
char *tmp_name;
char *tmp_name, *tmp2;
tmp_name = gdb_mangle_name (t,
method_counter,
field_counter);
phys_name = alloca (strlen (tmp_name) + 1);
strcpy (phys_name, tmp_name);
tmp2 = alloca (strlen (tmp_name) + 1);
strcpy (tmp2, tmp_name);
xfree (tmp_name);
phys_name = tmp2;
}
else
phys_name = TYPE_FN_FIELD_PHYSNAME (f, field_counter);
@ -373,7 +374,7 @@ add_constructors (int method_counter, struct type *t,
--field_counter)
{
struct fn_field *f;
char *phys_name;
const char *phys_name;
f = TYPE_FN_FIELDLIST1 (t, method_counter);

View File

@ -44,7 +44,7 @@ extern int pascal_val_print (struct type *, const gdb_byte *, int,
extern int pascal_value_print (struct value *, struct ui_file *,
const struct value_print_options *);
extern void pascal_type_print_method_args (char *, char *,
extern void pascal_type_print_method_args (const char *, const char *,
struct ui_file *);
/* These are in p-lang.c: */

View File

@ -153,7 +153,7 @@ pascal_type_print_derivation_info (struct ui_file *stream, struct type *type)
/* Print the Pascal method arguments ARGS to the file STREAM. */
void
pascal_type_print_method_args (char *physname, char *methodname,
pascal_type_print_method_args (const char *physname, const char *methodname,
struct ui_file *stream)
{
int is_constructor = (strncmp (physname, "__ct__", 6) == 0);
@ -173,8 +173,7 @@ pascal_type_print_method_args (char *physname, char *methodname,
while (isdigit (physname[0]))
{
int len = 0;
int i;
char storec;
int i, j;
char *argname;
while (isdigit (physname[len]))
@ -183,10 +182,11 @@ pascal_type_print_method_args (char *physname, char *methodname,
}
i = strtol (physname, &argname, 0);
physname += len;
storec = physname[i];
physname[i] = 0;
for (j = 0; j < i; ++j)
fputc_filtered (physname[i], stream);
fputs_filtered (physname, stream);
physname[i] = storec;
physname += i;
if (physname[0] != 0)
{
@ -638,7 +638,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
It might work for GNU pascal. */
for (j = 0; j < len2; j++)
{
char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
int is_constructor = (strncmp (physname, "__ct__", 6) == 0);
int is_destructor = (strncmp (physname, "__dt__", 6) == 0);

View File

@ -2236,7 +2236,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
/* Replace *OLD_NAME with the method name portion of PHYSNAME. */
static void
update_method_name_from_physname (char **old_name, char *physname)
update_method_name_from_physname (char **old_name, const char *physname)
{
char *method_name;

View File

@ -278,7 +278,7 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, method_id);
struct fn_field *method = &f[signature_id];
char *field_name = TYPE_FN_FIELDLIST_NAME (type, method_id);
char *physname = TYPE_FN_FIELD_PHYSNAME (f, signature_id);
const char *physname = TYPE_FN_FIELD_PHYSNAME (f, signature_id);
char *newname = type_name_no_tag (type);
/* Does the form of physname indicate that it is the full mangled name

View File

@ -2559,7 +2559,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f,
{
struct value *v;
struct type *ftype = TYPE_FN_FIELD_TYPE (f, j);
char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
const char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
struct symbol *sym;
struct minimal_symbol *msym;