From 2e09eb68adb31df9b9947c08d62400207b99309c Mon Sep 17 00:00:00 2001 From: hvellyr Date: Tue, 28 Jan 2014 00:47:03 +0100 Subject: [PATCH 01/11] Fix unused parameter warnings about unused parameters --- src/CukeEngineImpl.cpp | 4 ++-- src/connectors/wire/WireProtocol.cpp | 2 +- src/connectors/wire/WireProtocolCommands.cpp | 2 +- src/drivers/BoostDriver.cpp | 16 ++++++++-------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/CukeEngineImpl.cpp b/src/CukeEngineImpl.cpp index 290b1f0b..c39b36d9 100644 --- a/src/CukeEngineImpl.cpp +++ b/src/CukeEngineImpl.cpp @@ -87,11 +87,11 @@ void CukeEngineImpl::invokeStep(const std::string & id, const invoke_args_type & } } -void CukeEngineImpl::endScenario(const tags_type & tags) { +void CukeEngineImpl::endScenario(const tags_type & /*tags*/) { cukeCommands.endScenario(); } -std::string CukeEngineImpl::snippetText(const std::string & keyword, const std::string & name, const std::string & multilineArgClass) const { +std::string CukeEngineImpl::snippetText(const std::string & keyword, const std::string & name, const std::string & /*multilineArgClass*/) const { return cukeCommands.snippetText(keyword, name); } diff --git a/src/connectors/wire/WireProtocol.cpp b/src/connectors/wire/WireProtocol.cpp index b12706e8..7d699a50 100644 --- a/src/connectors/wire/WireProtocol.cpp +++ b/src/connectors/wire/WireProtocol.cpp @@ -256,7 +256,7 @@ namespace { return write_string(v, false); } - void visit(const SuccessResponse *response) { + void visit(const SuccessResponse */*response*/) { success(); } diff --git a/src/connectors/wire/WireProtocolCommands.cpp b/src/connectors/wire/WireProtocolCommands.cpp index 1209b6d0..a8f00a17 100644 --- a/src/connectors/wire/WireProtocolCommands.cpp +++ b/src/connectors/wire/WireProtocolCommands.cpp @@ -71,7 +71,7 @@ WireResponse *SnippetTextCommand::run(CukeEngine *engine) const { } -WireResponse *FailingCommand::run(CukeEngine *engine) const { +WireResponse *FailingCommand::run(CukeEngine* /*engine*/) const { return new FailureResponse; } diff --git a/src/drivers/BoostDriver.cpp b/src/drivers/BoostDriver.cpp index ec74ab40..0411ff17 100644 --- a/src/drivers/BoostDriver.cpp +++ b/src/drivers/BoostDriver.cpp @@ -31,19 +31,19 @@ class CukeBoostLogInterceptor : public ::boost::unit_test::unit_test_log_formatt void reset(); // Formatter - void log_start( std::ostream&, counter_t test_cases_amount) {}; + void log_start( std::ostream&, counter_t /*test_cases_amount*/) {}; void log_finish( std::ostream&) {}; void log_build_info( std::ostream&) {}; - void test_unit_start( std::ostream&, test_unit const& tu) {}; - void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed) {}; - void test_unit_skipped( std::ostream&, test_unit const& tu) {}; + void test_unit_start( std::ostream&, test_unit const& /*tu*/) {}; + void test_unit_finish( std::ostream&, test_unit const& /*tu*/, unsigned long /*elapsed*/) {}; + void test_unit_skipped( std::ostream&, test_unit const& /*tu*/) {}; - void log_exception( std::ostream&, log_checkpoint_data const&, execution_exception const& ex) {}; + void log_exception( std::ostream&, log_checkpoint_data const&, execution_exception const& /*ex*/) {}; - void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let) {}; - void log_entry_value( std::ostream&, const_string value); - void log_entry_value( std::ostream&, lazy_ostream const& value) {}; + void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types /*let*/) {}; + void log_entry_value( std::ostream&, const_string /*value*/); + void log_entry_value( std::ostream&, lazy_ostream const& /*value*/) {}; void log_entry_finish( std::ostream&) {}; void log_exception(std::ostream&, const boost::unit_test::log_checkpoint_data&, boost::unit_test::const_string) {}; From 5b0ea922c11fae9dc222a16bc01e3ec640179f22 Mon Sep 17 00:00:00 2001 From: hvellyr Date: Tue, 28 Jan 2014 00:47:34 +0100 Subject: [PATCH 02/11] Fix compiler warnings about missing virtual destructors --- include/cucumber-cpp/internal/hook/Tag.hpp | 1 + src/connectors/wire/WireProtocol.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/cucumber-cpp/internal/hook/Tag.hpp b/include/cucumber-cpp/internal/hook/Tag.hpp index 22634001..48db4a00 100644 --- a/include/cucumber-cpp/internal/hook/Tag.hpp +++ b/include/cucumber-cpp/internal/hook/Tag.hpp @@ -16,6 +16,7 @@ class TagExpression { public: typedef std::vector tag_list; + virtual ~TagExpression() { } virtual bool matches(const tag_list &tags) = 0; }; diff --git a/src/connectors/wire/WireProtocol.cpp b/src/connectors/wire/WireProtocol.cpp index 7d699a50..7a13d2d1 100644 --- a/src/connectors/wire/WireProtocol.cpp +++ b/src/connectors/wire/WireProtocol.cpp @@ -88,7 +88,8 @@ void SnippetTextResponse::accept(WireResponseVisitor *visitor) const { class CommandDecoder { public: - virtual WireCommand *decode(const mValue & jsonArgs) const = 0; + virtual ~CommandDecoder() { } + virtual WireCommand *decode(const mValue & jsonArgs) const = 0; }; From 3bb7d323d8bb0bafe61ae64630d9636862f09edb Mon Sep 17 00:00:00 2001 From: hvellyr Date: Tue, 28 Jan 2014 00:48:27 +0100 Subject: [PATCH 03/11] Fix compiler warning about useless const on returntype --- include/cucumber-cpp/internal/step/StepManager.hpp | 2 +- src/StepManager.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/cucumber-cpp/internal/step/StepManager.hpp b/include/cucumber-cpp/internal/step/StepManager.hpp index 41992230..cbb03b2b 100644 --- a/include/cucumber-cpp/internal/step/StepManager.hpp +++ b/include/cucumber-cpp/internal/step/StepManager.hpp @@ -91,7 +91,7 @@ class InvokeResult { bool isSuccess() const; bool isPending() const; - const InvokeResultType getType() const; + InvokeResultType getType() const; const std::string &getDescription() const; }; diff --git a/src/StepManager.cpp b/src/StepManager.cpp index 20838c3a..73a9781f 100644 --- a/src/StepManager.cpp +++ b/src/StepManager.cpp @@ -114,7 +114,7 @@ bool InvokeResult::isPending() const { return (type == PENDING); } -const InvokeResultType InvokeResult::getType() const { +InvokeResultType InvokeResult::getType() const { return type; } From fab772469c9a0d0250ddf3ed835d9a088b6fe9ea Mon Sep 17 00:00:00 2001 From: hvellyr Date: Tue, 28 Jan 2014 00:48:41 +0100 Subject: [PATCH 04/11] Fix compiler warning about type mismatch --- src/CukeEngineImpl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CukeEngineImpl.cpp b/src/CukeEngineImpl.cpp index c39b36d9..fb594c0c 100644 --- a/src/CukeEngineImpl.cpp +++ b/src/CukeEngineImpl.cpp @@ -55,13 +55,13 @@ void CukeEngineImpl::invokeStep(const std::string & id, const invoke_args_type & if (tableArg.shape()[0] > 1 && tableArg.shape()[1] > 0) { Table & commandTableArg = commandArgs.getVariableTableArg(); - for (table_index j = 0; j < tableArg.shape()[1]; ++j) { + for (table_index j = 0; j < table_index(tableArg.shape()[1]); ++j) { commandTableArg.addColumn(tableArg[0][j]); } - for (table_index i = 1; i < tableArg.shape()[0]; ++i) { + for (table_index i = 1; i < table_index(tableArg.shape()[0]); ++i) { Table::row_type row; - for (table_index j = 0; j < tableArg.shape()[1]; ++j) { + for (table_index j = 0; j < table_index(tableArg.shape()[1]); ++j) { row.push_back(tableArg[i][j]); } commandTableArg.addRow(row); From e4414cf428ef99412fa1547545f41a85c4098b30 Mon Sep 17 00:00:00 2001 From: hvellyr Date: Tue, 28 Jan 2014 00:48:56 +0100 Subject: [PATCH 05/11] Fix compiler warning about inlined static function --- include/cucumber-cpp/internal/step/StepManager.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/cucumber-cpp/internal/step/StepManager.hpp b/include/cucumber-cpp/internal/step/StepManager.hpp index cbb03b2b..861b876b 100644 --- a/include/cucumber-cpp/internal/step/StepManager.hpp +++ b/include/cucumber-cpp/internal/step/StepManager.hpp @@ -157,7 +157,7 @@ class StepManager { }; -static std::string toSourceString(const char *filePath, const int line) { +static inline std::string toSourceString(const char *filePath, const int line) { using namespace std; stringstream s; string file(filePath); From 0e76db6919c7b670124cfbed9ff0df1560bde01c Mon Sep 17 00:00:00 2001 From: hvellyr Date: Tue, 28 Jan 2014 00:49:13 +0100 Subject: [PATCH 06/11] Fix compiler warning about hidden virtual function definition --- include/cucumber-cpp/internal/hook/HookRegistrar.hpp | 2 +- src/HookRegistrar.cpp | 4 ++-- tests/utils/HookRegistrationFixture.hpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/cucumber-cpp/internal/hook/HookRegistrar.hpp b/include/cucumber-cpp/internal/hook/HookRegistrar.hpp index bee9009b..dc97b569 100644 --- a/include/cucumber-cpp/internal/hook/HookRegistrar.hpp +++ b/include/cucumber-cpp/internal/hook/HookRegistrar.hpp @@ -35,7 +35,7 @@ class BeforeHook : public Hook { class AroundStepHook : public Hook { public: - virtual void invokeHook(Scenario *scenario, CallableStep *step); + virtual void invokeHookWithStep(Scenario *scenario, CallableStep *step); virtual void skipHook(); protected: CallableStep *step; diff --git a/src/HookRegistrar.cpp b/src/HookRegistrar.cpp index 13e92dc1..eb52caa2 100644 --- a/src/HookRegistrar.cpp +++ b/src/HookRegistrar.cpp @@ -24,7 +24,7 @@ bool Hook::tagsMatch(Scenario *scenario) { return !scenario || tagExpression->matches(scenario->getTags()); } -void AroundStepHook::invokeHook(Scenario *scenario, CallableStep *step) { +void AroundStepHook::invokeHookWithStep(Scenario *scenario, CallableStep *step) { this->step = step; Hook::invokeHook(scenario); } @@ -155,7 +155,7 @@ void StepCallChain::execNext() { } else { HookRegistrar::aroundhook_list_type::iterator currentHook = nextHook++; CallableStepChain callableStepChain(this); - (*currentHook)->invokeHook(scenario, &callableStepChain); + (*currentHook)->invokeHookWithStep(scenario, &callableStepChain); } } diff --git a/tests/utils/HookRegistrationFixture.hpp b/tests/utils/HookRegistrationFixture.hpp index a488bc2b..6eebcd6b 100644 --- a/tests/utils/HookRegistrationFixture.hpp +++ b/tests/utils/HookRegistrationFixture.hpp @@ -54,7 +54,7 @@ class HookRegistrarDouble : public HookRegistrar { EmptyCallableStep emptyStep; aroundhook_list_type &ash = aroundStepHooks(); for (HookRegistrar::aroundhook_list_type::const_iterator h = ash.begin(); h != ash.end(); ++h) { - (*h)->invokeHook(scenario, &emptyStep); + (*h)->invokeHookWithStep(scenario, &emptyStep); } } }; From bc2cd117ebef7c6e152db44fc54798a2e7fc968d Mon Sep 17 00:00:00 2001 From: hvellyr Date: Tue, 28 Jan 2014 00:49:26 +0100 Subject: [PATCH 07/11] Fix compiler warning about member initializer order --- src/connectors/wire/WireServer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/connectors/wire/WireServer.cpp b/src/connectors/wire/WireServer.cpp index 915c272f..64ac2249 100644 --- a/src/connectors/wire/WireServer.cpp +++ b/src/connectors/wire/WireServer.cpp @@ -4,9 +4,9 @@ namespace cucumber { namespace internal { SocketServer::SocketServer(const ProtocolHandler *protocolHandler) : + protocolHandler(protocolHandler), ios(), - acceptor(ios), - protocolHandler(protocolHandler) { + acceptor(ios) { } void SocketServer::listen(const port_type port) { From bdcc9e29fbdee8467139e22082966bca03ce6af0 Mon Sep 17 00:00:00 2001 From: hvellyr Date: Tue, 28 Jan 2014 00:49:42 +0100 Subject: [PATCH 08/11] Fix building with newer boost version ... using a different framework::init() API. --- src/drivers/BoostDriver.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/drivers/BoostDriver.cpp b/src/drivers/BoostDriver.cpp index 0411ff17..8525643d 100644 --- a/src/drivers/BoostDriver.cpp +++ b/src/drivers/BoostDriver.cpp @@ -15,13 +15,18 @@ namespace internal { namespace { - -bool boost_test_init() { +#ifdef BOOST_TEST_ALTERNATIVE_INIT_API + bool boost_init_unit_test() { return true; -} - -static CukeBoostLogInterceptor *logInterceptor = 0; - + } +#else + ::boost::unit_test::test_suite* + boost_init_unit_test_suite(int /*argc*/, char* /*argv*/[]) { + return NULL; + } +#endif + + static CukeBoostLogInterceptor *logInterceptor = 0; } @@ -83,7 +88,12 @@ void BoostStep::initBoostTest() { if (!framework::is_initialized()) { int argc = 2; char *argv[] = { (char *) "", (char *) "" }; - framework::init(&boost_test_init, argc, argv); + +#ifdef BOOST_TEST_ALTERNATIVE_INIT_API + framework::init(&boost_init_unit_test, argc, argv); +#else + framework::init(&boost_init_unit_test_suite, argc, argv); +#endif logInterceptor = new CukeBoostLogInterceptor; ::boost::unit_test::unit_test_log.set_formatter(logInterceptor); ::boost::unit_test::unit_test_log.set_threshold_level(log_all_errors); From 5a409f7970e6a5ed83def23f23c3fec132ab85c0 Mon Sep 17 00:00:00 2001 From: hvellyr Date: Tue, 28 Jan 2014 00:49:58 +0100 Subject: [PATCH 09/11] Fix compiler warning when building with newer boost --- include/cucumber-cpp/internal/utils/Regex.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/cucumber-cpp/internal/utils/Regex.hpp b/include/cucumber-cpp/internal/utils/Regex.hpp index 55f1e5c9..08bc1205 100644 --- a/include/cucumber-cpp/internal/utils/Regex.hpp +++ b/include/cucumber-cpp/internal/utils/Regex.hpp @@ -1,8 +1,11 @@ #ifndef CUKE_REGEX_HPP_ #define CUKE_REGEX_HPP_ +#include #include +#define BOOST_REGEX_V4_CHAR_REGEX_TRAITS_HPP + #include namespace cucumber { From 663fa4ba74c791ae4ba5b44e4fe6733a1eef65d1 Mon Sep 17 00:00:00 2001 From: hvellyr Date: Tue, 28 Jan 2014 00:50:12 +0100 Subject: [PATCH 10/11] Give access to the number of args in InvokeArgs to support arg forwarding --- include/cucumber-cpp/internal/step/StepManager.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/cucumber-cpp/internal/step/StepManager.hpp b/include/cucumber-cpp/internal/step/StepManager.hpp index 861b876b..1b2cbe78 100644 --- a/include/cucumber-cpp/internal/step/StepManager.hpp +++ b/include/cucumber-cpp/internal/step/StepManager.hpp @@ -62,6 +62,11 @@ class InvokeArgs { template T getInvokeArg(size_type i) const; const Table & getTableArg() const; + + size_type argsSize() const { + return args.size(); + } + private: Table tableArg; args_type args; From fa77eac5f8598658e18c6bd2e10423655060e151 Mon Sep 17 00:00:00 2001 From: gck Date: Thu, 27 Feb 2014 10:15:53 +0100 Subject: [PATCH 11/11] Avoid build warning about nested comments on Visual studio --- src/connectors/wire/WireProtocol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connectors/wire/WireProtocol.cpp b/src/connectors/wire/WireProtocol.cpp index 7a13d2d1..e94013d3 100644 --- a/src/connectors/wire/WireProtocol.cpp +++ b/src/connectors/wire/WireProtocol.cpp @@ -257,7 +257,7 @@ namespace { return write_string(v, false); } - void visit(const SuccessResponse */*response*/) { + void visit(const SuccessResponse* /*response*/) { success(); }