From 03981f2cd92fd631a1675c52c48abe9fc1c984d7 Mon Sep 17 00:00:00 2001 From: falsycat Date: Tue, 1 Aug 2023 20:49:16 +0900 Subject: [PATCH] add noexcept specifier to Observer::Notify() methods --- iface/common/observer.hh | 6 +++--- iface/common/observer_test.hh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/iface/common/observer.hh b/iface/common/observer.hh index 4a1e9fd..6c2fc17 100644 --- a/iface/common/observer.hh +++ b/iface/common/observer.hh @@ -20,9 +20,9 @@ class Observer { inline virtual ~Observer() noexcept; protected: - virtual void Notify(const T&) {} - virtual void NotifyWithMove(T&& v) { Notify(v); } - virtual void NotifyDestruction(const T* = nullptr) {} + virtual void Notify(const T&) noexcept {} + virtual void NotifyWithMove(T&& v) noexcept { Notify(v); } + virtual void NotifyDestruction(const T* = nullptr) noexcept {} private: Target& target_; diff --git a/iface/common/observer_test.hh b/iface/common/observer_test.hh index dd450b6..9a4e4a9 100644 --- a/iface/common/observer_test.hh +++ b/iface/common/observer_test.hh @@ -14,9 +14,9 @@ class ObserverMock : public Observer { explicit ObserverMock(Observer::Target& target) : Observer(target) { } - MOCK_METHOD(void, Notify, (const T&)); - MOCK_METHOD(void, NotifyWithMove, (T&&)); - MOCK_METHOD(void, NotifyDestruction, (const T*)); + MOCK_METHOD(void, Notify, (const T&), (noexcept, override)); + MOCK_METHOD(void, NotifyWithMove, (T&&), (noexcept, override)); + MOCK_METHOD(void, NotifyDestruction, (const T*), (noexcept, override)); }; template