Skip to content

Commit

Permalink
Replaced noexcept by FAKEIT_NO_THROWS and removed useless defaulted s…
Browse files Browse the repository at this point in the history
…pecial member functions for Mock.
  • Loading branch information
FranckRJ committed May 10, 2024
1 parent 625a27c commit bb569e5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
8 changes: 0 additions & 8 deletions include/fakeit/Mock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ namespace fakeit {
class Mock : public ActualInvocationsSource {
MockImpl<C, baseclasses...> impl;
public:
Mock(const Mock&) = delete;
Mock(Mock&&) noexcept = default;

Mock& operator=(const Mock&) = delete;
Mock& operator=(Mock&&) = delete;

~Mock() override = default;

static_assert(std::is_polymorphic<C>::value, "Can only mock a polymorphic type");

Mock() : impl(Fakeit) {
Expand Down
2 changes: 1 addition & 1 deletion include/fakeit/MockImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace fakeit {
}

MockImpl(const MockImpl&) = delete;
MockImpl(MockImpl&& other) noexcept
MockImpl(MockImpl&& other) FAKEIT_NO_THROWS
: _instanceOwner(std::move(other._instanceOwner))
, _proxy(std::move(other._proxy))
, _fakeit(other._fakeit) {
Expand Down
2 changes: 1 addition & 1 deletion include/mockutils/DynamicProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace fakeit {
}

DynamicProxy(const DynamicProxy&) = delete;
DynamicProxy(DynamicProxy&& other) noexcept
DynamicProxy(DynamicProxy&& other) FAKEIT_NO_THROWS
: _originalVt(std::move(other._originalVt))
, _methodMocks(std::move(other._methodMocks))
, _members(std::move(other._members))
Expand Down
6 changes: 4 additions & 2 deletions include/mockutils/gcc/VirtualTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#endif

#include "mockutils/Macros.hpp"

namespace fakeit {

struct VirtualTableBase {
Expand All @@ -27,12 +29,12 @@ namespace fakeit {
VirtualTableBase(void **firstMethod) : _firstMethod(firstMethod) { }

VirtualTableBase(const VirtualTableBase&) = delete;
VirtualTableBase(VirtualTableBase&& other) noexcept {
VirtualTableBase(VirtualTableBase&& other) FAKEIT_NO_THROWS {
std::swap(_firstMethod, other._firstMethod);
}

VirtualTableBase& operator=(const VirtualTableBase&) = delete;
VirtualTableBase& operator=(VirtualTableBase&& other) noexcept {
VirtualTableBase& operator=(VirtualTableBase&& other) FAKEIT_NO_THROWS {
std::swap(_firstMethod, other._firstMethod);
return *this;
}
Expand Down
6 changes: 4 additions & 2 deletions include/mockutils/mscpp/VirtualTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <utility>
#include <typeinfo>

#include "mockutils/Macros.hpp"

namespace fakeit {

typedef unsigned long dword_;
Expand Down Expand Up @@ -188,13 +190,13 @@ namespace fakeit {
}

VirtualTable(const VirtualTable&) = delete;
VirtualTable(VirtualTable&& other) noexcept
VirtualTable(VirtualTable&& other) FAKEIT_NO_THROWS
: VirtualTableBase(nullptr) {
std::swap(_firstMethod, other._firstMethod);
}

VirtualTable& operator=(const VirtualTable&) = delete;
VirtualTable& operator=(VirtualTable&& other) noexcept {
VirtualTable& operator=(VirtualTable&& other) FAKEIT_NO_THROWS {
std::swap(_firstMethod, other._firstMethod);
return *this;
}
Expand Down

0 comments on commit bb569e5

Please sign in to comment.