From b59661bd15b66aa6cb11fafd624fd534cce0fa98 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 2 Jun 2003 04:16:24 +0000 Subject: [PATCH] 2003-06-01 Andrew Cagney * dwarfread.c: Eliminate "register" (decode_die_type): Eliminate assignment within "if". (struct_type, decode_array_element_type): Ditto. (dwarf_read_array_type, read_tag_pointer_type): Ditto. (read_subroutine_type, enum_type, add_enum_psymbol): Ditto. (decode_modified_type, completedieinfo): Ditto. * block.c: Eliminate "register". (blockvector_for_pc_sect): Eliminate assignment within "if". * cp-support.h (struct symbol): Opaque declaration. * breakpoint.c (handle_gnu_v3_exceptions): Use xfree, not free. --- gdb/ChangeLog | 13 +++++++++++++ gdb/block.c | 17 +++++++++-------- gdb/breakpoint.c | 4 ++-- gdb/cp-support.h | 1 + gdb/dwarfread.c | 43 ++++++++++++++++++++++++++++--------------- 5 files changed, 53 insertions(+), 25 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3f0bc8aecb..e71e2a2c70 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2003-06-02 Andrew Cagney + + * dwarfread.c: Eliminate "register" + (decode_die_type): Eliminate assignment within "if". + (struct_type, decode_array_element_type): Ditto. + (dwarf_read_array_type, read_tag_pointer_type): Ditto. + (read_subroutine_type, enum_type, add_enum_psymbol): Ditto. + (decode_modified_type, completedieinfo): Ditto. + * block.c: Eliminate "register". + (blockvector_for_pc_sect): Eliminate assignment within "if". + * cp-support.h (struct symbol): Opaque declaration. + * breakpoint.c (handle_gnu_v3_exceptions): Use xfree, not free. + 2003-06-01 Richard Henderson * alpha-tdep.c (alpha_gdbarch_init): Use set_gdbarch_print_insn ... diff --git a/gdb/block.c b/gdb/block.c index 3396c8aa96..09c51b69c4 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -71,17 +71,18 @@ block_function (struct block *bl) is NULL, we don't pass this information back to the caller. */ struct blockvector * -blockvector_for_pc_sect (register CORE_ADDR pc, struct sec *section, +blockvector_for_pc_sect (CORE_ADDR pc, struct sec *section, int *pindex, struct symtab *symtab) { - register struct block *b; - register int bot, top, half; + struct block *b; + int bot, top, half; struct blockvector *bl; if (symtab == 0) /* if no symtab specified by caller */ { /* First search all symtabs for one whose file contains our pc */ - if ((symtab = find_pc_sect_symtab (pc, section)) == 0) + symtab = find_pc_sect_symtab (pc, section); + if (symtab == 0) return 0; } @@ -125,7 +126,7 @@ blockvector_for_pc_sect (register CORE_ADDR pc, struct sec *section, Backward compatibility, no section. */ struct blockvector * -blockvector_for_pc (register CORE_ADDR pc, int *pindex) +blockvector_for_pc (CORE_ADDR pc, int *pindex) { return blockvector_for_pc_sect (pc, find_pc_mapped_section (pc), pindex, NULL); @@ -135,9 +136,9 @@ blockvector_for_pc (register CORE_ADDR pc, int *pindex) in the specified section, or 0 if there is none. */ struct block * -block_for_pc_sect (register CORE_ADDR pc, struct sec *section) +block_for_pc_sect (CORE_ADDR pc, struct sec *section) { - register struct blockvector *bl; + struct blockvector *bl; int index; bl = blockvector_for_pc_sect (pc, section, &index, NULL); @@ -150,7 +151,7 @@ block_for_pc_sect (register CORE_ADDR pc, struct sec *section) or 0 if there is none. Backward compatibility, no section. */ struct block * -block_for_pc (register CORE_ADDR pc) +block_for_pc (CORE_ADDR pc) { return block_for_pc_sect (pc, find_pc_mapped_section (pc)); } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 66b319e842..a92ae8c666 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -6082,7 +6082,7 @@ handle_gnu_v3_exceptions (int tempflag, char *cond_string, sals = decode_line_1 (&nameptr, 1, NULL, 0, NULL); if (sals.nelts == 0) { - free (trigger_func_name); + xfree (trigger_func_name); return 0; } @@ -6098,7 +6098,7 @@ handle_gnu_v3_exceptions (int tempflag, char *cond_string, b->disposition = tempflag ? disp_del : disp_donttouch; b->ops = &gnu_v3_exception_catchpoint_ops; - free (sals.sals); + xfree (sals.sals); mention (b); return 1; } diff --git a/gdb/cp-support.h b/gdb/cp-support.h index 952d6a2b17..0b567dd8b3 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -30,6 +30,7 @@ /* Opaque declarations. */ +struct symbol; struct obstack; struct block; diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index bbfecbc29f..38b5d927de 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -701,7 +701,7 @@ static void read_lexical_block_scope (struct dieinfo *dip, char *thisdie, char *enddie, struct objfile *objfile) { - register struct context_stack *new; + struct context_stack *new; push_context (0, dip->at_low_pc); process_dies (thisdie + dip->die_length, enddie, objfile); @@ -862,7 +862,8 @@ decode_die_type (struct dieinfo *dip) } else if (dip->at_user_def_type) { - if ((type = lookup_utype (dip->at_user_def_type)) == NULL) + type = lookup_utype (dip->at_user_def_type); + if (type == NULL) { type = alloc_utype (dip->at_user_def_type, NULL); } @@ -916,7 +917,8 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie, char *nextdie; int anonymous_size; - if ((type = lookup_utype (dip->die_ref)) == NULL) + type = lookup_utype (dip->die_ref); + if (type == NULL) { /* No forward references created an empty type, so install one now */ type = alloc_utype (dip->die_ref, NULL); @@ -1149,7 +1151,8 @@ decode_array_element_type (char *scan) attribute = target_to_host (scan, SIZEOF_ATTRIBUTE, GET_UNSIGNED, current_objfile); scan += SIZEOF_ATTRIBUTE; - if ((nbytes = attribute_size (attribute)) == -1) + nbytes = attribute_size (attribute); + if (nbytes == -1) { bad_array_element_type_complaint (DIE_ID, DIE_NAME, attribute); typep = dwarf_fundamental_type (current_objfile, FT_INTEGER); @@ -1169,7 +1172,8 @@ decode_array_element_type (char *scan) case AT_user_def_type: die_ref = target_to_host (scan, nbytes, GET_UNSIGNED, current_objfile); - if ((typep = lookup_utype (die_ref)) == NULL) + typep = lookup_utype (die_ref); + if (typep == NULL) { typep = alloc_utype (die_ref, NULL); } @@ -1334,14 +1338,16 @@ dwarf_read_array_type (struct dieinfo *dip) "DIE @ 0x%x \"%s\", array not row major; not handled correctly", DIE_ID, DIE_NAME); } - if ((sub = dip->at_subscr_data) != NULL) + sub = dip->at_subscr_data; + if (sub != NULL) { nbytes = attribute_size (AT_subscr_data); blocksz = target_to_host (sub, nbytes, GET_UNSIGNED, current_objfile); subend = sub + nbytes + blocksz; sub += nbytes; type = decode_subscript_data_item (sub, subend); - if ((utype = lookup_utype (dip->die_ref)) == NULL) + utype = lookup_utype (dip->die_ref); + if (utype == NULL) { /* Install user defined type that has not been referenced yet. */ alloc_utype (dip->die_ref, type); @@ -1390,7 +1396,8 @@ read_tag_pointer_type (struct dieinfo *dip) struct type *utype; type = decode_die_type (dip); - if ((utype = lookup_utype (dip->die_ref)) == NULL) + utype = lookup_utype (dip->die_ref); + if (utype == NULL) { utype = lookup_pointer_type (type); alloc_utype (dip->die_ref, utype); @@ -1509,7 +1516,8 @@ read_subroutine_type (struct dieinfo *dip, char *thisdie, char *enddie) /* Check to see if we already have a partially constructed user defined type for this DIE, from a forward reference. */ - if ((ftype = lookup_utype (dip->die_ref)) == NULL) + ftype = lookup_utype (dip->die_ref); + if (ftype == NULL) { /* This is the first reference to one of these types. Make a new one and place it in the user defined types. */ @@ -1623,7 +1631,8 @@ enum_type (struct dieinfo *dip, struct objfile *objfile) int nbytes; int unsigned_enum = 1; - if ((type = lookup_utype (dip->die_ref)) == NULL) + type = lookup_utype (dip->die_ref); + if (type == NULL) { /* No forward references created an empty type, so install one now */ type = alloc_utype (dip->die_ref, NULL); @@ -1643,7 +1652,8 @@ enum_type (struct dieinfo *dip, struct objfile *objfile) { TYPE_LENGTH (type) = dip->at_byte_size; } - if ((scan = dip->at_element_list) != NULL) + scan = dip->at_element_list; + if (scan != NULL) { if (dip->short_element_list) { @@ -1734,7 +1744,7 @@ static void read_func_scope (struct dieinfo *dip, char *thisdie, char *enddie, struct objfile *objfile) { - register struct context_stack *new; + struct context_stack *new; /* AT_name is absent if the function is described with an AT_abstract_origin tag. @@ -2431,7 +2441,8 @@ add_enum_psymbol (struct dieinfo *dip, struct objfile *objfile) unsigned short blocksz; int nbytes; - if ((scan = dip->at_element_list) != NULL) + scan = dip->at_element_list; + if (scan != NULL) { if (dip->short_element_list) { @@ -3144,7 +3155,8 @@ decode_modified_type (char *modifiers, unsigned int modcount, int mtype) nbytes = attribute_size (AT_user_def_type); die_ref = target_to_host (modifiers, nbytes, GET_UNSIGNED, current_objfile); - if ((typep = lookup_utype (die_ref)) == NULL) + typep = lookup_utype (die_ref); + if (typep == NULL) { typep = alloc_utype (die_ref, NULL); } @@ -3493,7 +3505,8 @@ completedieinfo (struct dieinfo *dip, struct objfile *objfile) { attr = target_to_host (diep, SIZEOF_ATTRIBUTE, GET_UNSIGNED, objfile); diep += SIZEOF_ATTRIBUTE; - if ((nbytes = attribute_size (attr)) == -1) + nbytes = attribute_size (attr); + if (nbytes == -1) { complaint (&symfile_complaints, "DIE @ 0x%x \"%s\", unknown attribute length, skipped remaining attributes", -- 2.34.1