From 582942f4560f1c8d2a60c2557267f9d3ad8dd6aa Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 22 Mar 2019 15:54:10 -0600 Subject: 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 * 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) : 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) : 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) : 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) : 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. --- gdb/python/py-framefilter.c | 6 +++--- gdb/python/py-symtab.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index 7f416cb..7b241bb 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -54,7 +54,7 @@ enum mi_print_types static enum ext_lang_bt_status extract_sym (PyObject *obj, gdb::unique_xmalloc_ptr *name, - struct symbol **sym, struct block **sym_block, + struct symbol **sym, const struct block **sym_block, const struct language_defn **language) { gdbpy_ref<> result (PyObject_CallMethod (obj, "symbol", NULL)); @@ -449,7 +449,7 @@ enumerate_args (PyObject *iter, const struct language_defn *language; gdb::unique_xmalloc_ptr sym_name; struct symbol *sym; - struct block *sym_block; + const struct block *sym_block; struct value *val; enum ext_lang_bt_status success = EXT_LANG_BT_ERROR; @@ -567,7 +567,7 @@ enumerate_locals (PyObject *iter, struct value *val; enum ext_lang_bt_status success = EXT_LANG_BT_ERROR; struct symbol *sym; - struct block *sym_block; + const struct block *sym_block; int local_indent = 8 + (8 * indent); gdb::optional tuple; diff --git a/gdb/python/py-symtab.c b/gdb/python/py-symtab.c index 0fef6e4..15af300 100644 --- a/gdb/python/py-symtab.c +++ b/gdb/python/py-symtab.c @@ -176,7 +176,7 @@ static PyObject * stpy_global_block (PyObject *self, PyObject *args) { struct symtab *symtab = NULL; - struct block *block = NULL; + const struct block *block = NULL; const struct blockvector *blockvector; STPY_REQUIRE_VALID (self, symtab); @@ -192,7 +192,7 @@ static PyObject * stpy_static_block (PyObject *self, PyObject *args) { struct symtab *symtab = NULL; - struct block *block = NULL; + const struct block *block = NULL; const struct blockvector *blockvector; STPY_REQUIRE_VALID (self, symtab); -- cgit v1.1