gdb, gdbsupport: use DISABLE_COPY_AND_ASSIGN in a few spots

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>
This commit is contained in:
Simon Marchi
2025-11-13 16:00:48 -05:00
committed by Simon Marchi
parent 3917afa371
commit 4ec16ac822
10 changed files with 24 additions and 40 deletions

View 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;

View 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);

View 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 ()
{

View 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;

View 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;

View 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;

View 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;
};

View 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)
{

View 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 { }

View 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 ()
{