Enable -Wsuggest-override
I noticed the existence of -Wsuggest-override and so this patch enables it for gdb. It found a few spots that could use "override". Also I went ahead and removed all uses of the "OVERRIDE" macro. Using override is beneficial because it makes it harder to change a base class and then forget to change a derived class. Tested by the buildbot. ChangeLog 2018-04-27 Tom Tromey <tom@tromey.com> * configure: Rebuild. * warning.m4 (AM_GDB_WARNINGS): Add -Wsuggest-override. * dwarf2loc.c (class dwarf_evaluate_loc_desc): Use "override", not "OVERRIDE". (class symbol_needs_eval_context): Likewise. * dwarf2read.c (mock_mapped_index::symbol_name_count) (mock_mapped_index::symbol_name_at): Use "override". Remove "virtual". * dwarf2-frame.c (dwarf_expr_executor::get_addr_index): Use "override". (class dwarf_expr_executor): Use "override", not "OVERRIDE". * aarch64-tdep.c (instruction_reader::read): Use "override". (instruction_reader_test::read): Likewise. * arm-tdep.c (instruction_reader::read): Use "override". (instruction_reader_thumb::read): Likewise. gdbserver/ChangeLog 2018-04-27 Tom Tromey <tom@tromey.com> * configure: Rebuild.
This commit is contained in:
parent
197b262f98
commit
632e107b32
|
@ -1,3 +1,21 @@
|
|||
2018-04-27 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* configure: Rebuild.
|
||||
* warning.m4 (AM_GDB_WARNINGS): Add -Wsuggest-override.
|
||||
* dwarf2loc.c (class dwarf_evaluate_loc_desc): Use "override", not
|
||||
"OVERRIDE".
|
||||
(class symbol_needs_eval_context): Likewise.
|
||||
* dwarf2read.c (mock_mapped_index::symbol_name_count)
|
||||
(mock_mapped_index::symbol_name_at): Use "override". Remove
|
||||
"virtual".
|
||||
* dwarf2-frame.c (dwarf_expr_executor::get_addr_index): Use
|
||||
"override".
|
||||
(class dwarf_expr_executor): Use "override", not "OVERRIDE".
|
||||
* aarch64-tdep.c (instruction_reader::read): Use "override".
|
||||
(instruction_reader_test::read): Likewise.
|
||||
* arm-tdep.c (instruction_reader::read): Use "override".
|
||||
(instruction_reader_thumb::read): Likewise.
|
||||
|
||||
2018-04-26 Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
|
||||
|
||||
PR remote/9665
|
||||
|
|
|
@ -210,6 +210,7 @@ class instruction_reader : public abstract_instruction_reader
|
|||
{
|
||||
public:
|
||||
ULONGEST read (CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
|
||||
override
|
||||
{
|
||||
return read_code_unsigned_integer (memaddr, len, byte_order);
|
||||
}
|
||||
|
@ -505,6 +506,7 @@ public:
|
|||
{}
|
||||
|
||||
ULONGEST read (CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
|
||||
override
|
||||
{
|
||||
SELF_CHECK (len == 4);
|
||||
SELF_CHECK (memaddr % 4 == 0);
|
||||
|
|
|
@ -13061,7 +13061,7 @@ public:
|
|||
class instruction_reader : public abstract_memory_reader
|
||||
{
|
||||
public:
|
||||
bool read (CORE_ADDR memaddr, gdb_byte *buf, const size_t len)
|
||||
bool read (CORE_ADDR memaddr, gdb_byte *buf, const size_t len) override
|
||||
{
|
||||
if (target_read_memory (memaddr, buf, len))
|
||||
return false;
|
||||
|
@ -13214,7 +13214,7 @@ public:
|
|||
: m_endian (endian), m_insns (insns), m_insns_size (SIZE)
|
||||
{}
|
||||
|
||||
bool read (CORE_ADDR memaddr, gdb_byte *buf, const size_t len)
|
||||
bool read (CORE_ADDR memaddr, gdb_byte *buf, const size_t len) override
|
||||
{
|
||||
SELF_CHECK (len == 4 || len == 2);
|
||||
SELF_CHECK (memaddr % 2 == 0);
|
||||
|
|
|
@ -15365,7 +15365,8 @@ build_warnings="-Wall -Wpointer-arith \
|
|||
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
|
||||
-Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized \
|
||||
-Wno-mismatched-tags \
|
||||
-Wno-error=deprecated-register"
|
||||
-Wno-error=deprecated-register \
|
||||
-Wsuggest-override"
|
||||
|
||||
case "${host}" in
|
||||
*-*-mingw32*)
|
||||
|
|
|
@ -230,12 +230,12 @@ class dwarf_expr_executor : public dwarf_expr_context
|
|||
|
||||
struct frame_info *this_frame;
|
||||
|
||||
CORE_ADDR read_addr_from_reg (int reg) OVERRIDE
|
||||
CORE_ADDR read_addr_from_reg (int reg) override
|
||||
{
|
||||
return ::read_addr_from_reg (this_frame, reg);
|
||||
}
|
||||
|
||||
struct value *get_reg_value (struct type *type, int reg) OVERRIDE
|
||||
struct value *get_reg_value (struct type *type, int reg) override
|
||||
{
|
||||
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
||||
int regnum = dwarf_reg_to_regnum_or_error (gdbarch, reg);
|
||||
|
@ -243,44 +243,44 @@ class dwarf_expr_executor : public dwarf_expr_context
|
|||
return value_from_register (type, regnum, this_frame);
|
||||
}
|
||||
|
||||
void read_mem (gdb_byte *buf, CORE_ADDR addr, size_t len) OVERRIDE
|
||||
void read_mem (gdb_byte *buf, CORE_ADDR addr, size_t len) override
|
||||
{
|
||||
read_memory (addr, buf, len);
|
||||
}
|
||||
|
||||
void get_frame_base (const gdb_byte **start, size_t *length) OVERRIDE
|
||||
void get_frame_base (const gdb_byte **start, size_t *length) override
|
||||
{
|
||||
invalid ("DW_OP_fbreg");
|
||||
}
|
||||
|
||||
void push_dwarf_reg_entry_value (enum call_site_parameter_kind kind,
|
||||
union call_site_parameter_u kind_u,
|
||||
int deref_size) OVERRIDE
|
||||
int deref_size) override
|
||||
{
|
||||
invalid ("DW_OP_entry_value");
|
||||
}
|
||||
|
||||
CORE_ADDR get_object_address () OVERRIDE
|
||||
CORE_ADDR get_object_address () override
|
||||
{
|
||||
invalid ("DW_OP_push_object_address");
|
||||
}
|
||||
|
||||
CORE_ADDR get_frame_cfa () OVERRIDE
|
||||
CORE_ADDR get_frame_cfa () override
|
||||
{
|
||||
invalid ("DW_OP_call_frame_cfa");
|
||||
}
|
||||
|
||||
CORE_ADDR get_tls_address (CORE_ADDR offset) OVERRIDE
|
||||
CORE_ADDR get_tls_address (CORE_ADDR offset) override
|
||||
{
|
||||
invalid ("DW_OP_form_tls_address");
|
||||
}
|
||||
|
||||
void dwarf_call (cu_offset die_offset) OVERRIDE
|
||||
void dwarf_call (cu_offset die_offset) override
|
||||
{
|
||||
invalid ("DW_OP_call*");
|
||||
}
|
||||
|
||||
CORE_ADDR get_addr_index (unsigned int index)
|
||||
CORE_ADDR get_addr_index (unsigned int index) override
|
||||
{
|
||||
invalid ("DW_OP_GNU_addr_index");
|
||||
}
|
||||
|
|
|
@ -557,7 +557,7 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
|||
/* Helper function for dwarf2_evaluate_loc_desc. Computes the CFA for
|
||||
the frame in BATON. */
|
||||
|
||||
CORE_ADDR get_frame_cfa () OVERRIDE
|
||||
CORE_ADDR get_frame_cfa () override
|
||||
{
|
||||
return dwarf2_frame_cfa (frame);
|
||||
}
|
||||
|
@ -565,14 +565,14 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
|||
/* Helper function for dwarf2_evaluate_loc_desc. Computes the PC for
|
||||
the frame in BATON. */
|
||||
|
||||
CORE_ADDR get_frame_pc () OVERRIDE
|
||||
CORE_ADDR get_frame_pc () override
|
||||
{
|
||||
return get_frame_address_in_block (frame);
|
||||
}
|
||||
|
||||
/* Using the objfile specified in BATON, find the address for the
|
||||
current thread's thread-local storage with offset OFFSET. */
|
||||
CORE_ADDR get_tls_address (CORE_ADDR offset) OVERRIDE
|
||||
CORE_ADDR get_tls_address (CORE_ADDR offset) override
|
||||
{
|
||||
struct objfile *objfile = dwarf2_per_cu_objfile (per_cu);
|
||||
|
||||
|
@ -582,12 +582,12 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
|||
/* Helper interface of per_cu_dwarf_call for
|
||||
dwarf2_evaluate_loc_desc. */
|
||||
|
||||
void dwarf_call (cu_offset die_offset) OVERRIDE
|
||||
void dwarf_call (cu_offset die_offset) override
|
||||
{
|
||||
per_cu_dwarf_call (this, die_offset, per_cu);
|
||||
}
|
||||
|
||||
struct type *get_base_type (cu_offset die_offset, int size) OVERRIDE
|
||||
struct type *get_base_type (cu_offset die_offset, int size) override
|
||||
{
|
||||
struct type *result = dwarf2_get_die_type (die_offset, per_cu);
|
||||
if (result == NULL)
|
||||
|
@ -600,7 +600,7 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
|||
/* Callback function for dwarf2_evaluate_loc_desc.
|
||||
Fetch the address indexed by DW_OP_GNU_addr_index. */
|
||||
|
||||
CORE_ADDR get_addr_index (unsigned int index) OVERRIDE
|
||||
CORE_ADDR get_addr_index (unsigned int index) override
|
||||
{
|
||||
return dwarf2_read_addr_index (per_cu, index);
|
||||
}
|
||||
|
@ -608,7 +608,7 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
|||
/* Callback function for get_object_address. Return the address of the VLA
|
||||
object. */
|
||||
|
||||
CORE_ADDR get_object_address () OVERRIDE
|
||||
CORE_ADDR get_object_address () override
|
||||
{
|
||||
if (obj_address == 0)
|
||||
error (_("Location address is not set."));
|
||||
|
@ -625,7 +625,7 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
|||
|
||||
void push_dwarf_reg_entry_value (enum call_site_parameter_kind kind,
|
||||
union call_site_parameter_u kind_u,
|
||||
int deref_size) OVERRIDE
|
||||
int deref_size) override
|
||||
{
|
||||
struct frame_info *caller_frame;
|
||||
struct dwarf2_per_cu_data *caller_per_cu;
|
||||
|
@ -666,7 +666,7 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
|||
/* Using the frame specified in BATON, find the location expression
|
||||
describing the frame base. Return a pointer to it in START and
|
||||
its length in LENGTH. */
|
||||
void get_frame_base (const gdb_byte **start, size_t * length) OVERRIDE
|
||||
void get_frame_base (const gdb_byte **start, size_t * length) override
|
||||
{
|
||||
/* FIXME: cagney/2003-03-26: This code should be using
|
||||
get_frame_base_address(), and then implement a dwarf2 specific
|
||||
|
@ -694,14 +694,14 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
|||
|
||||
/* Read memory at ADDR (length LEN) into BUF. */
|
||||
|
||||
void read_mem (gdb_byte *buf, CORE_ADDR addr, size_t len) OVERRIDE
|
||||
void read_mem (gdb_byte *buf, CORE_ADDR addr, size_t len) override
|
||||
{
|
||||
read_memory (addr, buf, len);
|
||||
}
|
||||
|
||||
/* Using the frame specified in BATON, return the value of register
|
||||
REGNUM, treated as a pointer. */
|
||||
CORE_ADDR read_addr_from_reg (int dwarf_regnum) OVERRIDE
|
||||
CORE_ADDR read_addr_from_reg (int dwarf_regnum) override
|
||||
{
|
||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||
int regnum = dwarf_reg_to_regnum_or_error (gdbarch, dwarf_regnum);
|
||||
|
@ -711,7 +711,7 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context
|
|||
|
||||
/* Implement "get_reg_value" callback. */
|
||||
|
||||
struct value *get_reg_value (struct type *type, int dwarf_regnum) OVERRIDE
|
||||
struct value *get_reg_value (struct type *type, int dwarf_regnum) override
|
||||
{
|
||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||
int regnum = dwarf_reg_to_regnum_or_error (gdbarch, dwarf_regnum);
|
||||
|
@ -2735,7 +2735,7 @@ class symbol_needs_eval_context : public dwarf_expr_context
|
|||
struct dwarf2_per_cu_data *per_cu;
|
||||
|
||||
/* Reads from registers do require a frame. */
|
||||
CORE_ADDR read_addr_from_reg (int regnum) OVERRIDE
|
||||
CORE_ADDR read_addr_from_reg (int regnum) override
|
||||
{
|
||||
needs = SYMBOL_NEEDS_FRAME;
|
||||
return 1;
|
||||
|
@ -2744,20 +2744,20 @@ class symbol_needs_eval_context : public dwarf_expr_context
|
|||
/* "get_reg_value" callback: Reads from registers do require a
|
||||
frame. */
|
||||
|
||||
struct value *get_reg_value (struct type *type, int regnum) OVERRIDE
|
||||
struct value *get_reg_value (struct type *type, int regnum) override
|
||||
{
|
||||
needs = SYMBOL_NEEDS_FRAME;
|
||||
return value_zero (type, not_lval);
|
||||
}
|
||||
|
||||
/* Reads from memory do not require a frame. */
|
||||
void read_mem (gdb_byte *buf, CORE_ADDR addr, size_t len) OVERRIDE
|
||||
void read_mem (gdb_byte *buf, CORE_ADDR addr, size_t len) override
|
||||
{
|
||||
memset (buf, 0, len);
|
||||
}
|
||||
|
||||
/* Frame-relative accesses do require a frame. */
|
||||
void get_frame_base (const gdb_byte **start, size_t *length) OVERRIDE
|
||||
void get_frame_base (const gdb_byte **start, size_t *length) override
|
||||
{
|
||||
static gdb_byte lit0 = DW_OP_lit0;
|
||||
|
||||
|
@ -2768,20 +2768,20 @@ class symbol_needs_eval_context : public dwarf_expr_context
|
|||
}
|
||||
|
||||
/* CFA accesses require a frame. */
|
||||
CORE_ADDR get_frame_cfa () OVERRIDE
|
||||
CORE_ADDR get_frame_cfa () override
|
||||
{
|
||||
needs = SYMBOL_NEEDS_FRAME;
|
||||
return 1;
|
||||
}
|
||||
|
||||
CORE_ADDR get_frame_pc () OVERRIDE
|
||||
CORE_ADDR get_frame_pc () override
|
||||
{
|
||||
needs = SYMBOL_NEEDS_FRAME;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Thread-local accesses require registers, but not a frame. */
|
||||
CORE_ADDR get_tls_address (CORE_ADDR offset) OVERRIDE
|
||||
CORE_ADDR get_tls_address (CORE_ADDR offset) override
|
||||
{
|
||||
if (needs <= SYMBOL_NEEDS_REGISTERS)
|
||||
needs = SYMBOL_NEEDS_REGISTERS;
|
||||
|
@ -2791,7 +2791,7 @@ class symbol_needs_eval_context : public dwarf_expr_context
|
|||
/* Helper interface of per_cu_dwarf_call for
|
||||
dwarf2_loc_desc_get_symbol_read_needs. */
|
||||
|
||||
void dwarf_call (cu_offset die_offset) OVERRIDE
|
||||
void dwarf_call (cu_offset die_offset) override
|
||||
{
|
||||
per_cu_dwarf_call (this, die_offset, per_cu);
|
||||
}
|
||||
|
@ -2801,7 +2801,7 @@ class symbol_needs_eval_context : public dwarf_expr_context
|
|||
|
||||
void push_dwarf_reg_entry_value (enum call_site_parameter_kind kind,
|
||||
union call_site_parameter_u kind_u,
|
||||
int deref_size) OVERRIDE
|
||||
int deref_size) override
|
||||
{
|
||||
needs = SYMBOL_NEEDS_FRAME;
|
||||
|
||||
|
@ -2811,7 +2811,7 @@ class symbol_needs_eval_context : public dwarf_expr_context
|
|||
|
||||
/* DW_OP_GNU_addr_index doesn't require a frame. */
|
||||
|
||||
CORE_ADDR get_addr_index (unsigned int index) OVERRIDE
|
||||
CORE_ADDR get_addr_index (unsigned int index) override
|
||||
{
|
||||
/* Nothing to do. */
|
||||
return 1;
|
||||
|
@ -2819,7 +2819,7 @@ class symbol_needs_eval_context : public dwarf_expr_context
|
|||
|
||||
/* DW_OP_push_object_address has a frame already passed through. */
|
||||
|
||||
CORE_ADDR get_object_address () OVERRIDE
|
||||
CORE_ADDR get_object_address () override
|
||||
{
|
||||
/* Nothing to do. */
|
||||
return 1;
|
||||
|
|
|
@ -4577,13 +4577,13 @@ public:
|
|||
DISABLE_COPY_AND_ASSIGN (mock_mapped_index);
|
||||
|
||||
/* Return the number of names in the symbol table. */
|
||||
virtual size_t symbol_name_count () const
|
||||
size_t symbol_name_count () const override
|
||||
{
|
||||
return m_symbol_table.size ();
|
||||
}
|
||||
|
||||
/* Get the name of the symbol at IDX in the symbol table. */
|
||||
virtual const char *symbol_name_at (offset_type idx) const
|
||||
const char *symbol_name_at (offset_type idx) const override
|
||||
{
|
||||
return m_symbol_table[idx];
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2018-04-27 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* configure: Rebuild.
|
||||
|
||||
2018-04-23 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* configure: Rebuild.
|
||||
|
|
|
@ -7172,7 +7172,8 @@ build_warnings="-Wall -Wpointer-arith \
|
|||
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
|
||||
-Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized \
|
||||
-Wno-mismatched-tags \
|
||||
-Wno-error=deprecated-register"
|
||||
-Wno-error=deprecated-register \
|
||||
-Wsuggest-override"
|
||||
|
||||
case "${host}" in
|
||||
*-*-mingw32*)
|
||||
|
|
|
@ -42,7 +42,8 @@ build_warnings="-Wall -Wpointer-arith \
|
|||
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
|
||||
-Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized \
|
||||
-Wno-mismatched-tags \
|
||||
-Wno-error=deprecated-register"
|
||||
-Wno-error=deprecated-register \
|
||||
-Wsuggest-override"
|
||||
|
||||
case "${host}" in
|
||||
*-*-mingw32*)
|
||||
|
|
Loading…
Reference in New Issue