aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-10-15 13:33:45 -0600
committerTom Tromey <tom@tromey.com>2023-11-29 14:29:44 -0700
commitcc87f13181d12a7844e1988fe2d27ead4150d263 (patch)
tree04325fa8817f87e1c2ac7249f88c332ede4a7eb3 /gdbsupport
parent553b78748fd19cd5832989f3c2817c6ced4f503b (diff)
downloadbinutils-cc87f13181d12a7844e1988fe2d27ead4150d263.zip
binutils-cc87f13181d12a7844e1988fe2d27ead4150d263.tar.gz
binutils-cc87f13181d12a7844e1988fe2d27ead4150d263.tar.bz2
Rely on copy elision in scope-exit.h
gdbsupport/scope-exit.h has a couple of comments about being able to rely on copy elision in C++17. This patch makes the change. Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/scope-exit.h22
1 files changed, 2 insertions, 20 deletions
diff --git a/gdbsupport/scope-exit.h b/gdbsupport/scope-exit.h
index cb8d925..8fa40b1 100644
--- a/gdbsupport/scope-exit.h
+++ b/gdbsupport/scope-exit.h
@@ -69,16 +69,7 @@ public:
}
}
- /* This is needed for make_scope_exit because copy elision isn't
- guaranteed until C++17. An optimizing compiler will usually skip
- calling this, but it must exist. */
- scope_exit_base (const scope_exit_base &other)
- : m_released (other.m_released)
- {
- other.m_released = true;
- }
-
- void operator= (const scope_exit_base &) = delete;
+ DISABLE_COPY_AND_ASSIGN (scope_exit_base);
/* If this is called, then the wrapped function will not be called
on destruction. */
@@ -132,16 +123,7 @@ public:
rhs.release ();
}
- /* This is needed for make_scope_exit because copy elision isn't
- guaranteed until C++17. An optimizing compiler will usually skip
- calling this, but it must exist. */
- scope_exit (const scope_exit &other)
- : scope_exit_base<scope_exit<EF>> (other),
- m_exit_function (other.m_exit_function)
- {
- }
-
- void operator= (const scope_exit &) = delete;
+ DISABLE_COPY_AND_ASSIGN (scope_exit);
void operator= (scope_exit &&) = delete;
private: