aboutsummaryrefslogtreecommitdiff
path: root/gdb/psymtab.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-03-22 15:54:10 -0600
committerTom Tromey <tom@tromey.com>2019-03-24 23:32:08 -0600
commit582942f4560f1c8d2a60c2557267f9d3ad8dd6aa (patch)
tree6d3663f08e31c531accde3f95c252a5c13ac53af /gdb/psymtab.c
parent258876ee34a4b656c754355cf175a825e0db80f3 (diff)
downloadgdb-582942f4560f1c8d2a60c2557267f9d3ad8dd6aa.zip
gdb-582942f4560f1c8d2a60c2557267f9d3ad8dd6aa.tar.gz
gdb-582942f4560f1c8d2a60c2557267f9d3ad8dd6aa.tar.bz2
More block constification
I noticed that there are still many places referring to non-const blocks. This constifies all the remaining ones that I found that could be constified. In a few spots, this search found unused variables or fields. I removed these. I've also removed some unnecessary casts to "struct block *". gdb/ChangeLog 2019-03-24 Tom Tromey <tom@tromey.com> * c-exp.y (typebase): Remove casts. * gdbtypes.c (lookup_unsigned_typename, ) (lookup_signed_typename): Remove cast. * eval.c (parse_to_comma_and_eval): Remove cast. * parse.c (write_dollar_variable): Remove cast. * block.h (struct block) <superblock>: Now const. * symfile-debug.c (debug_qf_map_matching_symbols): Update. * psymtab.c (psym_map_matching_symbols): Make "block" const. (map_block): Make "block" const. * symfile.h (struct quick_symbol_functions) <map_matching_symbols>: Constify block argument to "callback". * symtab.c (basic_lookup_transparent_type_quick): Make "block" const. (find_pc_sect_compunit_symtab): Make "b" const. (find_symbol_at_address): Likewise. (search_symbols): Likewise. * dwarf2read.c (dw2_lookup_symbol): Make "block" const. (dw2_debug_names_lookup_symbol): Likewise. (dw2_map_matching_symbols): Update. * p-valprint.c (pascal_val_print): Remove "block". * ada-lang.c (ada_add_global_exceptions): Make "b" const. (aux_add_nonlocal_symbols): Make "block" const. (resolve_subexp): Remove cast. * linespec.c (iterate_over_all_matching_symtabs): Make "block" const. (iterate_over_file_blocks): Likewise. * f-exp.y (%union) <bval>: Remove. * coffread.c (patch_opaque_types): Make "b" const. * spu-tdep.c (spu_catch_start): Make "block" const. * c-valprint.c (print_unpacked_pointer): Remove "block". * symmisc.c (dump_symtab_1): Make "b" const. (block_depth): Make "block" const. * d-exp.y (%union) <bval>: Remove. * cp-support.h (cp_lookup_rtti_type): Update. * cp-support.c (cp_lookup_rtti_type): Make "block" const. * psymtab.c (psym_lookup_symbol): Make "block" const. (maintenance_check_psymtabs): Make "b" const. * python/py-framefilter.c (extract_sym): Make "sym_block" const. (enumerate_locals, enumerate_args): Update. * python/py-symtab.c (stpy_global_block): Make "block" const. (stpy_static_block): Likewise. * inline-frame.c (block_starting_point_at): Make "new_block" const. * block.c (find_block_in_blockvector): Make return type const. (blockvector_for_pc_sect): Make "b" const. (find_block_in_blockvector): Make "b" const.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r--gdb/psymtab.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 96b4fa0..584a5e9 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -498,7 +498,7 @@ psym_lookup_symbol (struct objfile *objfile,
partial symtab is empty, we can assume it won't here
because lookup_partial_symbol succeeded. */
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab);
- struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
+ const struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
sym = block_find_symbol (block, name, domain,
block_find_non_opaque_type_preferred,
@@ -1165,8 +1165,8 @@ psymtab_to_fullname (struct partial_symtab *ps)
static int
map_block (const char *name, domain_enum domain, struct objfile *objfile,
- struct block *block,
- int (*callback) (struct block *, struct symbol *, void *),
+ const struct block *block,
+ int (*callback) (const struct block *, struct symbol *, void *),
void *data, symbol_name_match_type match)
{
struct block_iterator iter;
@@ -1196,7 +1196,7 @@ static void
psym_map_matching_symbols (struct objfile *objfile,
const char *name, domain_enum domain,
int global,
- int (*callback) (struct block *,
+ int (*callback) (const struct block *,
struct symbol *, void *),
void *data,
symbol_name_match_type match,
@@ -1212,7 +1212,7 @@ psym_map_matching_symbols (struct objfile *objfile,
ordered_compare))
{
struct compunit_symtab *cust = psymtab_to_symtab (objfile, ps);
- struct block *block;
+ const struct block *block;
if (cust == NULL)
continue;
@@ -2095,7 +2095,7 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
struct symbol *sym;
struct compunit_symtab *cust = NULL;
const struct blockvector *bv;
- struct block *b;
+ const struct block *b;
int length;
for (objfile *objfile : current_program_space->objfiles ())