aboutsummaryrefslogtreecommitdiff
path: root/gdb/completer.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-04-20 11:45:06 -0600
committerTom Tromey <tromey@adacore.com>2020-04-20 11:45:06 -0600
commit0fa7617d84da8b809b14e1e2ee67474526c62021 (patch)
treec0df8e58cdc7411ed31337b87830614c9223b6a9 /gdb/completer.h
parent9b2c992cfa4e9911d3b54c21ced179aa4928c422 (diff)
downloadbinutils-0fa7617d84da8b809b14e1e2ee67474526c62021.zip
binutils-0fa7617d84da8b809b14e1e2ee67474526c62021.tar.gz
binutils-0fa7617d84da8b809b14e1e2ee67474526c62021.tar.bz2
Mark move constructors as "noexcept"
I recently learned that move constructors generally should be marked "noexcept". This ensures that standard containers will move objects when possible, rather than copy them. This patch fixes the cases I could find. Note that implicitly-defined or defaulted move constructors will automatically do what you'd expect; that is, they are noexcept if all the members have noexcept move constructors. While doing this, I noticed a couple of odd cases where the move constructor seemed to assume that the object being constructed could have state requiring destruction. I've fixed these as well. See completion_result and scoped_mmap. gdb/ChangeLog 2020-04-20 Tom Tromey <tromey@adacore.com> * python/python.c (struct gdbpy_event): Mark move constructor as noexcept. * python/py-tui.c (class gdbpy_tui_window_maker): Mark move constructor as noexcept. * completer.h (struct completion_result): Mark move constructor as noexcept. * completer.c (completion_result::completion_result): Use initialization style. Don't call reset_match_list. gdbsupport/ChangeLog 2020-04-20 Tom Tromey <tromey@adacore.com> * scoped_mmap.h (scoped_mmap): Mark move constructor as noexcept. Use initialization style. Don't call destroy. * scoped_fd.h (class scoped_fd): Mark move constructor as noexcept. * gdb_ref_ptr.h (class ref_ptr): Mark move constructor as noexcept.
Diffstat (limited to 'gdb/completer.h')
-rw-r--r--gdb/completer.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/completer.h b/gdb/completer.h
index fd0d47b..d3afa5f 100644
--- a/gdb/completer.h
+++ b/gdb/completer.h
@@ -242,7 +242,7 @@ struct completion_result
DISABLE_COPY_AND_ASSIGN (completion_result);
/* Move a result. */
- completion_result (completion_result &&rhs);
+ completion_result (completion_result &&rhs) noexcept;
/* Release ownership of the match list array. */
char **release_match_list ();