[ob/pushed] Fix a couple -Wdeprecated-copy issues

Message ID 20210607232655.1419237-1-pedro@palves.net
State New
Headers show
Series
  • [ob/pushed] Fix a couple -Wdeprecated-copy issues
Related show

Commit Message

Pedro Alves June 7, 2021, 11:26 p.m.
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  <pedro@palves.net>

	* 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(+)


base-commit: fa6ec8efa4b902f65a8057b5ee3ba0da456ec8c2
-- 
2.26.2

Patch

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  <pedro@palves.net>
+
+	* 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  <pedro@palves.net>
 
 	* 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 */