]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb, gdbsupport: use DISABLE_COPY_AND_ASSIGN in a few spots
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 13 Nov 2025 21:00:48 +0000 (16:00 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Fri, 14 Nov 2025 19:50:39 +0000 (14:50 -0500)
Replace some explicitly deleted copy constructor and copy assignment
operator with the DISABLE_COPY_AND_ASSIGN macro for consistency
with the rest of the codebase.

Change-Id: If3fe2c4d7b3cb4530eace86d589116f805c7656f
Approved-By: Tom Tromey <tom@tromey.com>
gdb/cli/cli-script.c
gdb/interps.h
gdb/language.h
gdb/skip.c
gdb/target-descriptions.c
gdb/ui-out.h
gdb/utils.h
gdbsupport/buildargv.h
gdbsupport/cxx-thread.h
gdbsupport/gdb_argv_vec.h

index c5b6f88bf88c854746db4a28f7321b3f4cc3024d..31be1141871db6f5d87e0247bccf4fe5cf599c3e 100644 (file)
@@ -360,14 +360,13 @@ public:
   {
   }
 
+  DISABLE_COPY_AND_ASSIGN (scoped_restore_hook_in);
+
   ~scoped_restore_hook_in ()
   {
     m_cmd->hook_in = 0;
   }
 
-  scoped_restore_hook_in (const scoped_restore_hook_in &) = delete;
-  scoped_restore_hook_in &operator= (const scoped_restore_hook_in &) = delete;
-
 private:
 
   struct cmd_list_element *m_cmd;
index f048bf59a52e5306fedd242e1d8d7a3b69fd223e..c9dbe3dbebd319443226f240b42cab6d590e1f33 100644 (file)
@@ -232,14 +232,13 @@ public:
   {
   }
 
+  DISABLE_COPY_AND_ASSIGN (scoped_restore_interp);
+
   ~scoped_restore_interp ()
   {
     set_interp (m_interp->name ());
   }
 
-  scoped_restore_interp (const scoped_restore_interp &) = delete;
-  scoped_restore_interp &operator= (const scoped_restore_interp &) = delete;
-
 private:
 
   struct interp *set_interp (const char *name);
index 196dd05bb1d29db00782f72166839085e7a1715c..926d94405ea5db32741a619899bef6df38304a02 100644 (file)
@@ -836,6 +836,8 @@ public:
   /* Set the current language as well.  */
   explicit scoped_restore_current_language (enum language lang);
 
+  DISABLE_COPY_AND_ASSIGN (scoped_restore_current_language);
+
   ~scoped_restore_current_language ();
 
   scoped_restore_current_language (scoped_restore_current_language &&other)
@@ -845,11 +847,6 @@ public:
     other.dont_restore ();
   }
 
-  scoped_restore_current_language (const scoped_restore_current_language &)
-      = delete;
-  scoped_restore_current_language &operator=
-      (const scoped_restore_current_language &) = delete;
-
   /* Cancel restoring on scope exit.  */
   void dont_restore ()
   {
index a56b3555d1730c08679dfa6a6c2b955941a356f1..01a7aa6eb990e8839b0b9189a63b171162b4d517 100644 (file)
@@ -72,10 +72,6 @@ public:
   void enable () { m_enabled = true; };
   void disable () { m_enabled = false; };
 
-  /* Disable copy.  */
-  skiplist_entry (const skiplist_entry &) = delete;
-  void operator= (const skiplist_entry &) = delete;
-
 private:
   /* Key that grants access to the constructor.  */
   struct private_key {};
@@ -87,6 +83,9 @@ public:
                  bool function_is_regexp, std::string &&function,
                  private_key);
 
+  /* Disable copy.  */
+  DISABLE_COPY_AND_ASSIGN (skiplist_entry);
+
 private:
   /* Return true if we're stopped at a file to be skipped.  */
   bool do_skip_file_p (const symtab_and_line &function_sal) const;
index 0e2e70aa3ac7b1228f7d949f6928ee799fcf6c96..858a019e615212ff80c68904355a752c470be566 100644 (file)
@@ -341,10 +341,9 @@ struct target_desc : tdesc_element
   target_desc ()
   {}
 
-  virtual ~target_desc () = default;
+  DISABLE_COPY_AND_ASSIGN (target_desc);
 
-  target_desc (const target_desc &) = delete;
-  void operator= (const target_desc &) = delete;
+  virtual ~target_desc () = default;
 
   /* The architecture reported by the target, if any.  */
   const struct bfd_arch_info *arch = NULL;
index 1796e9c9eb3439422a767603d2799f4a7c167cf2..f3687c9cb95dbadf03f482d67639e08c3f385ba5 100644 (file)
@@ -307,14 +307,13 @@ class ui_out
       m_uiout->do_progress_start ();
     }
 
+    DISABLE_COPY_AND_ASSIGN (progress_update);
+
     ~progress_update ()
     {
       m_uiout->do_progress_end ();
     }
 
-    progress_update (const progress_update &) = delete;
-    progress_update &operator= (const progress_update &) = delete;
-
     /* Emit some progress for this progress meter.  Includes current
        amount of progress made and total amount in the display.  */
     void update_progress (const std::string& msg, const char *unit,
@@ -445,8 +444,7 @@ public:
     m_uiout->table_end ();
   }
 
-  ui_out_emit_table (const ui_out_emit_table &) = delete;
-  ui_out_emit_table &operator= (const ui_out_emit_table &) = delete;
+  DISABLE_COPY_AND_ASSIGN (ui_out_emit_table);
 
 private:
 
@@ -471,8 +469,7 @@ public:
     m_uiout->redirect (NULL);
   }
 
-  ui_out_redirect_pop (const ui_out_redirect_pop &) = delete;
-  ui_out_redirect_pop &operator= (const ui_out_redirect_pop &) = delete;
+  DISABLE_COPY_AND_ASSIGN (ui_out_redirect_pop);
 
 private:
   struct ui_out *m_uiout;
index ddeac46b1da373992371bd7d0131ae77592bb4ce..0e28f9424e5aa6631d3a76ca5eb7c96d486ed835 100644 (file)
@@ -407,14 +407,11 @@ class scoped_restore_warning_hook
 public:
   explicit scoped_restore_warning_hook (warning_hook_handler new_handler);
 
+  DISABLE_COPY_AND_ASSIGN (scoped_restore_warning_hook);
+
   ~scoped_restore_warning_hook ();
 
 private:
-  scoped_restore_warning_hook (const scoped_restore_warning_hook &other)
-    = delete;
-  scoped_restore_warning_hook &operator= (const scoped_restore_warning_hook &)
-    = delete;
-
   warning_hook_handler m_save;
 };
 
index e2cc543e048a8c1f992a749f561396c3de0bc2c9..483d198722263e50ddf0d48fea0bd555337dd44c 100644 (file)
@@ -52,8 +52,7 @@ public:
   {
   }
 
-  gdb_argv (const gdb_argv &) = delete;
-  gdb_argv &operator= (const gdb_argv &) = delete;
+  DISABLE_COPY_AND_ASSIGN (gdb_argv);
 
   gdb_argv &operator= (gdb_argv &&other)
   {
index e4061ebef9dfbc4287c258ac4c4754a3a41cf410..f734e24122072a50605126e4ed874852972d4761 100644 (file)
@@ -178,10 +178,11 @@ public:
   }
 
   future () = default;
+
+  DISABLE_COPY_AND_ASSIGN (future);
+
   future (future &&other) = default;
-  future (const future &other) = delete;
   future &operator= (future &&other) = default;
-  future &operator= (const future &other) = delete;
 
   void wait () const { }
 
index 43571ae173a7b803c2558719ba5799bf3369b27a..147f7869a87eccbd53c9bf21f05320e0b46769a5 100644 (file)
@@ -48,15 +48,15 @@ public:
     /* Nothing.  */
   }
 
+  /* Don't currently support copying the strings from OTHER.  */
+  DISABLE_COPY_AND_ASSIGN (argv_vec);
+
   /* Move the owned strings from OTHER.  */
   argv_vec (argv_vec &&other)
   {
     this->m_args = std::move (other.m_args);
   }
 
-  /* Don't currently support copying the strings from OTHER.  */
-  argv_vec (const argv_vec &other) = delete;
-
   /* Move elements from OTHER.  Free currently owned strings.  */
   argv_vec &operator= (argv_vec &&other)
   {
@@ -65,9 +65,6 @@ public:
     return *this;
   }
 
-  /* Don't currently support copying the strings from OTHER.  */
-  argv_vec &operator= (const argv_vec &other) = delete;
-
   /* Release the owned strings.  */
   ~argv_vec ()
   {