From 1b453aed8bf68b3a7d1865213ebcb96cda6a0ed9 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 7 Jun 2021 23:59:17 +0100 Subject: [PATCH] Fix a couple -Wdeprecated-copy issues Building GDB with current git (future 13) Clang runs into these two issues: #1: src/gdb/symtab.h:1139:3: error: definition of implicit copy assignment operator for 'symbol' is deprecated because it has a user-declared copy constructor [-Werror,-Wdeprecated-copy] symbol (const symbol &) = default; ^ #2: src/gdb/dwarf2/read.c:834:23: error: definition of implicit copy constructor for 'partial_die_info' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy] partial_die_info& operator=(const partial_die_info& rhs) = delete; ^ Fix them by adding the explicit defaulted versions of copy ctor and copy-assign op appropriately. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * dwarf2/read.c (struct partial_die_info): Add defaulted copy ctor. * symtab.h (struct symbol): Add defaulted copy assignment operator. --- gdb/ChangeLog | 7 +++++++ gdb/dwarf2/read.c | 1 + gdb/symtab.h | 1 + 3 files changed, 9 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3026d383dd0..53d77aab62a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2021-06-07 Pedro Alves + + * dwarf2/read.c (struct partial_die_info): Add defaulted copy + ctor. + * symtab.h (struct symbol): Add defaulted copy assignment + operator. + 2021-06-07 Pedro Alves * completer.c (RL_QF_SINGLE_QUOTE, RL_QF_DOUBLE_QUOTE) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index de79454a85f..96009f1418f 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -832,6 +832,7 @@ struct partial_die_info : public allocate_on_obstack /* Disable assign but still keep copy ctor, which is needed load_partial_dies. */ partial_die_info& operator=(const partial_die_info& rhs) = delete; + partial_die_info (const partial_die_info &) = default; /* Adjust the partial die before generating a symbol for it. This function may set the is_external flag or change the DIE's diff --git a/gdb/symtab.h b/gdb/symtab.h index efdbada9761..a5d0168faf0 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1137,6 +1137,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack } symbol (const symbol &) = default; + symbol &operator= (const symbol &) = default; /* Data type of value */ -- 2.30.2