Skip to content

Commit

Permalink
Merge pull request #322 from eranpeer/fix-some-warnings
Browse files Browse the repository at this point in the history
Fix some warnings.
  • Loading branch information
FranckRJ authored Aug 27, 2023
2 parents b269281 + 7b0c028 commit dc1dbd1
Show file tree
Hide file tree
Showing 25 changed files with 82 additions and 82 deletions.
12 changes: 6 additions & 6 deletions config/standalone/StandaloneFakeit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace fakeit {

struct VerificationException : public std::exception {
virtual ~VerificationException() FAKEIT_NO_THROWS{};
~VerificationException() FAKEIT_NO_THROWS override {};

VerificationException(std::string format) : //
_format(format) { //
Expand All @@ -33,7 +33,7 @@ namespace fakeit {
return _callingMethod;
}

const char* what() const FAKEIT_NO_THROWS override{
const char* what() const FAKEIT_NO_THROWS override {
return _format.c_str();
}
private:
Expand Down Expand Up @@ -71,20 +71,20 @@ namespace fakeit {
: _formatter(formatter) {
}

virtual void handle(const UnexpectedMethodCallEvent &evt) override {
void handle(const UnexpectedMethodCallEvent &evt) override {
std::string format = _formatter.format(evt);
UnexpectedMethodCallException ex(format);
throw ex;
}

virtual void handle(const SequenceVerificationEvent &evt) override {
void handle(const SequenceVerificationEvent &evt) override {
std::string format(formatLineNumner(evt.file(), evt.line()) + ": " + _formatter.format(evt));
SequenceVerificationException e(format);
e.setFileInfo(evt.file(), evt.line(), evt.callingMethod());
throw e;
}

virtual void handle(const NoMoreInvocationsVerificationEvent &evt) override {
void handle(const NoMoreInvocationsVerificationEvent &evt) override {
std::string format(formatLineNumner(evt.file(), evt.line()) + ": " + _formatter.format(evt));
NoMoreInvocationsVerificationException e(format);
e.setFileInfo(evt.file(), evt.line(), evt.callingMethod());
Expand All @@ -98,7 +98,7 @@ namespace fakeit {
class StandaloneFakeit : public DefaultFakeit {

public:
virtual ~StandaloneFakeit() = default;
~StandaloneFakeit() override = default;

StandaloneFakeit() : _standaloneAdapter(*this) {
}
Expand Down
16 changes: 8 additions & 8 deletions include/fakeit/Action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ namespace fakeit {
f(func), times(t) {
}

virtual R invoke(const ArgumentsTuple<arglist...> & args) override {
R invoke(const ArgumentsTuple<arglist...> & args) override {
times--;
return TupleDispatcher::invoke<R, arglist...>(f, args);
}

virtual bool isDone() override {
bool isDone() override {
return times == 0;
}

Expand All @@ -63,11 +63,11 @@ namespace fakeit {
f(func) {
}

virtual R invoke(const ArgumentsTuple<arglist...> & args) override {
R invoke(const ArgumentsTuple<arglist...> & args) override {
return TupleDispatcher::invoke<R, arglist...>(f, args);
}

virtual bool isDone() override {
bool isDone() override {
return false;
}

Expand All @@ -79,11 +79,11 @@ namespace fakeit {
struct ReturnDefaultValue : public Action<R, arglist...> {
virtual ~ReturnDefaultValue() = default;

virtual R invoke(const ArgumentsTuple<arglist...> &) override {
R invoke(const ArgumentsTuple<arglist...> &) override {
return DefaultValue<R>::value();
}

virtual bool isDone() override {
bool isDone() override {
return false;
}
};
Expand All @@ -95,11 +95,11 @@ namespace fakeit {

virtual ~ReturnDelegateValue() = default;

virtual R invoke(const ArgumentsTuple<arglist...> & args) override {
R invoke(const ArgumentsTuple<arglist...> & args) override {
return TupleDispatcher::invoke<R, arglist...>(_delegate, args);
}

virtual bool isDone() override {
bool isDone() override {
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions include/fakeit/ActionSequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace fakeit {
append(action);
}

virtual R handleMethodInvocation(ArgumentsTuple<arglist...> & args) override
R handleMethodInvocation(ArgumentsTuple<arglist...> & args) override
{
std::shared_ptr<Destructible> destructablePtr = _recordedActions.front();
Destructible &destructable = *destructablePtr;
Expand All @@ -63,11 +63,11 @@ namespace fakeit {
// throw NoMoreRecordedActionException();
// }

virtual R invoke(const ArgumentsTuple<arglist...> &) override {
R invoke(const ArgumentsTuple<arglist...> &) override {
throw NoMoreRecordedActionException();
}

virtual bool isDone() override {
bool isDone() override {
return false;
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/fakeit/ActualInvocation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace fakeit {
return _matcher;
}

virtual std::string format() const override {
std::string format() const override {
std::ostringstream out;
out << getMethod().name();
print(out, actualArguments);
Expand Down
6 changes: 3 additions & 3 deletions include/fakeit/DefaultEventFormatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace fakeit {

struct DefaultEventFormatter : public EventFormatter {

virtual std::string format(const UnexpectedMethodCallEvent &e) override {
std::string format(const UnexpectedMethodCallEvent &e) override {
std::ostringstream out;
out << "Unexpected method invocation: ";
out << e.getInvocation().format() << std::endl;
Expand All @@ -34,7 +34,7 @@ namespace fakeit {
Actual matches : 0
Actual sequence : no actual invocations
*/
virtual std::string format(const SequenceVerificationEvent &e) override {
std::string format(const SequenceVerificationEvent &e) override {
std::ostringstream out;
out << "Verification error" << std::endl;

Expand All @@ -60,7 +60,7 @@ namespace fakeit {
return out.str();
}

virtual std::string format(const NoMoreInvocationsVerificationEvent &e) override {
std::string format(const NoMoreInvocationsVerificationEvent &e) override {
std::ostringstream out;
out << "Verification error" << std::endl;
out << "Expected no more invocations!! but the following unverified invocations were found:" << std::endl;
Expand Down
6 changes: 3 additions & 3 deletions include/fakeit/DefaultEventLogger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ namespace fakeit {

DefaultEventLogger(EventFormatter &formatter) : _formatter(formatter), _out(std::cout) { }

virtual void handle(const UnexpectedMethodCallEvent &e) override {
void handle(const UnexpectedMethodCallEvent &e) override {
_out << _formatter.format(e) << std::endl;
}

virtual void handle(const SequenceVerificationEvent &e) override {
void handle(const SequenceVerificationEvent &e) override {
_out << _formatter.format(e) << std::endl;
}

virtual void handle(const NoMoreInvocationsVerificationEvent &e) override {
void handle(const NoMoreInvocationsVerificationEvent &e) override {
_out << _formatter.format(e) << std::endl;
}

Expand Down
4 changes: 2 additions & 2 deletions include/fakeit/DefaultFakeit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace fakeit {

class AbstractFakeit : public FakeitContext {
public:
virtual ~AbstractFakeit() = default;
~AbstractFakeit() override = default;

protected:

Expand All @@ -35,7 +35,7 @@ namespace fakeit {
_testingFrameworkAdapter(nullptr) {
}

virtual ~DefaultFakeit() = default;
~DefaultFakeit() override = default;

void setCustomEventFormatter(fakeit::EventFormatter &customEventFormatter) {
_customFormatter = &customEventFormatter;
Expand Down
4 changes: 2 additions & 2 deletions include/fakeit/FakeitEvents.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace fakeit {

struct NoMoreInvocationsVerificationEvent : public VerificationEvent {

~NoMoreInvocationsVerificationEvent() = default;
~NoMoreInvocationsVerificationEvent() override = default;

NoMoreInvocationsVerificationEvent( //
std::vector<Invocation *> &allTheIvocations, //
Expand All @@ -87,7 +87,7 @@ namespace fakeit {

struct SequenceVerificationEvent : public VerificationEvent {

~SequenceVerificationEvent() = default;
~SequenceVerificationEvent() override = default;

SequenceVerificationEvent(VerificationType aVerificationType, //
std::vector<Sequence *> &anExpectedPattern, //
Expand Down
2 changes: 1 addition & 1 deletion include/fakeit/FakeitExceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace fakeit {
_format(format) {
}

virtual std::string what() const override {
std::string what() const override {
return _format;
}

Expand Down
4 changes: 2 additions & 2 deletions include/fakeit/Invocation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace fakeit {
_ordinal(ordinal), _method(method), _isVerified(false) {
}

virtual ~Invocation() override = default;
~Invocation() override = default;

unsigned int getOrdinal() const {
return _ordinal;
Expand All @@ -65,4 +65,4 @@ namespace fakeit {
bool _isVerified;
};

}
}
2 changes: 1 addition & 1 deletion include/fakeit/MethodMockingContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ namespace fakeit {
: _impl(std::move(other._impl)) {
}

virtual ~MethodMockingContext() FAKEIT_NO_THROWS { }
~MethodMockingContext() FAKEIT_NO_THROWS override { }

std::string format() const override {
return _impl->format();
Expand Down
2 changes: 1 addition & 1 deletion include/fakeit/Mock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace fakeit {
class Mock : public ActualInvocationsSource {
MockImpl<C, baseclasses...> impl;
public:
virtual ~Mock() = default;
~Mock() override = default;

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

Expand Down
22 changes: 11 additions & 11 deletions include/fakeit/MockImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace fakeit {
fake->getVirtualTable().setCookie(1, this);
}

virtual ~MockImpl() FAKEIT_NO_THROWS {
~MockImpl() FAKEIT_NO_THROWS override {
_proxy.detach();
}

Expand Down Expand Up @@ -75,11 +75,11 @@ namespace fakeit {
initDataMembersIfOwner();
}

virtual C &get() override {
C &get() override {
return _proxy.get();
}

virtual FakeitContext &getFakeIt() override {
FakeitContext &getFakeIt() override {
return _fakeit;
}

Expand Down Expand Up @@ -141,27 +141,27 @@ namespace fakeit {
virtual ~MethodMockingContextBase() = default;

void addMethodInvocationHandler(typename ActualInvocation<arglist...>::Matcher *matcher,
ActualInvocationHandler<R, arglist...> *invocationHandler) {
ActualInvocationHandler<R, arglist...> *invocationHandler) override {
getRecordedMethodBody().addMethodInvocationHandler(matcher, invocationHandler);
}

void scanActualInvocations(const std::function<void(ActualInvocation<arglist...> &)> &scanner) {
void scanActualInvocations(const std::function<void(ActualInvocation<arglist...> &)> &scanner) override {
getRecordedMethodBody().scanActualInvocations(scanner);
}

void setMethodDetails(std::string mockName, std::string methodName) {
void setMethodDetails(std::string mockName, std::string methodName) override {
getRecordedMethodBody().setMethodDetails(mockName, methodName);
}

bool isOfMethod(MethodInfo &method) {
bool isOfMethod(MethodInfo &method) override {
return getRecordedMethodBody().isOfMethod(method);
}

ActualInvocationsSource &getInvolvedMock() {
ActualInvocationsSource &getInvolvedMock() override {
return _mock;
}

std::string getMethodName() {
std::string getMethodName() override {
return getRecordedMethodBody().getMethod().name();
}

Expand Down Expand Up @@ -218,7 +218,7 @@ namespace fakeit {
class UniqueMethodMockingContextImpl : public MethodMockingContextImpl<R, arglist...> {
protected:

virtual RecordedMethodBody<R, arglist...> &getRecordedMethodBody() override {
RecordedMethodBody<R, arglist...> &getRecordedMethodBody() override {
return MethodMockingContextBase<R, arglist...>::_mock.template stubMethodIfNotStubbed<id>(
MethodMockingContextBase<R, arglist...>::_mock._proxy,
MethodMockingContextImpl<R, arglist...>::_vMethod);
Expand All @@ -235,7 +235,7 @@ namespace fakeit {

protected:

virtual RecordedMethodBody<void> &getRecordedMethodBody() override {
RecordedMethodBody<void> &getRecordedMethodBody() override {
return MethodMockingContextBase<void>::_mock.stubDtorIfNotStubbed(
MethodMockingContextBase<void>::_mock._proxy);
}
Expand Down
4 changes: 2 additions & 2 deletions include/fakeit/RecordedMethodBody.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace fakeit {
_matcher{matcher}, _invocationHandler{invocationHandler} {
}

virtual R handleMethodInvocation(ArgumentsTuple<arglist...> & args) override
R handleMethodInvocation(ArgumentsTuple<arglist...> & args) override
{
Destructible &destructable = *_invocationHandler;
ActualInvocationHandler<R, arglist...> &invocationHandler = dynamic_cast<ActualInvocationHandler<R, arglist...> &>(destructable);
Expand Down Expand Up @@ -95,7 +95,7 @@ namespace fakeit {
RecordedMethodBody(FakeitContext &fakeit, std::string name) :
_fakeit(fakeit), _method{MethodInfo::nextMethodOrdinal(), name} { }

virtual ~RecordedMethodBody() FAKEIT_NO_THROWS {
~RecordedMethodBody() FAKEIT_NO_THROWS override {
}

MethodInfo &getMethod() {
Expand Down
6 changes: 3 additions & 3 deletions include/fakeit/Sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace fakeit {

public:

virtual ~ConcatenatedSequence() {
~ConcatenatedSequence() override {
}

unsigned int size() const override {
Expand All @@ -77,7 +77,7 @@ namespace fakeit {
s2.getExpectedSequence(into);
}

virtual void getInvolvedMocks(std::vector<ActualInvocationsSource *> &into) const override {
void getInvolvedMocks(std::vector<ActualInvocationsSource *> &into) const override {
s1.getInvolvedMocks(into);
s2.getInvolvedMocks(into);
}
Expand All @@ -97,7 +97,7 @@ namespace fakeit {

public:

~RepeatedSequence() {
~RepeatedSequence() override {
}

unsigned int size() const override {
Expand Down
2 changes: 1 addition & 1 deletion include/fakeit/WhenFunctor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace fakeit {

friend class WhenFunctor;

virtual ~MethodProgress() override = default;
~MethodProgress() override = default;

MethodProgress(const MethodProgress &other) :
_progress(other._progress), _context(other._context) {
Expand Down
Loading

0 comments on commit dc1dbd1

Please sign in to comment.