diff options
author | Chih-Hung Hsieh <chh@google.com> | 2018-09-25 11:16:22 -0700 |
---|---|---|
committer | Chih-hung Hsieh <chh@google.com> | 2018-10-05 16:43:47 +0000 |
commit | 747eb149d06d9077e7b44aa1edd966e637386f33 (patch) | |
tree | f64bdec4eba3c79bcb6dd1da72e948da5e3a08f6 /base/include | |
parent | 5f2a21d244be6cbbc64047474b0aca352f93b2d9 (diff) | |
download | system_core-747eb149d06d9077e7b44aa1edd966e637386f33.tar.gz system_core-747eb149d06d9077e7b44aa1edd966e637386f33.tar.bz2 system_core-747eb149d06d9077e7b44aa1edd966e637386f33.zip |
Add noexcept to move constructors and assignment operators.
Bug: 116614593
Test: build with WITH_TIDY=1
Change-Id: I5a7461386946ca623ab509609092aa0ac8418b80
Diffstat (limited to 'base/include')
-rw-r--r-- | base/include/android-base/scopeguard.h | 2 | ||||
-rw-r--r-- | base/include/android-base/unique_fd.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/base/include/android-base/scopeguard.h b/base/include/android-base/scopeguard.h index e6a9d109d..5a224d634 100644 --- a/base/include/android-base/scopeguard.h +++ b/base/include/android-base/scopeguard.h @@ -28,7 +28,7 @@ class ScopeGuard { public: ScopeGuard(F&& f) : f_(std::forward<F>(f)), active_(true) {} - ScopeGuard(ScopeGuard&& that) : f_(std::move(that.f_)), active_(that.active_) { + ScopeGuard(ScopeGuard&& that) noexcept : f_(std::move(that.f_)), active_(that.active_) { that.active_ = false; } diff --git a/base/include/android-base/unique_fd.h b/base/include/android-base/unique_fd.h index 71025adc2..cd2dc0416 100644 --- a/base/include/android-base/unique_fd.h +++ b/base/include/android-base/unique_fd.h @@ -90,8 +90,8 @@ class unique_fd_impl final { explicit unique_fd_impl(int fd) { reset(fd); } ~unique_fd_impl() { reset(); } - unique_fd_impl(unique_fd_impl&& other) { reset(other.release()); } - unique_fd_impl& operator=(unique_fd_impl&& s) { + unique_fd_impl(unique_fd_impl&& other) noexcept { reset(other.release()); } + unique_fd_impl& operator=(unique_fd_impl&& s) noexcept { int fd = s.fd_; s.fd_ = -1; reset(fd, &s); |