From bcd0d91dc79dcaf71d28a23e499c0135fb4b769b Mon Sep 17 00:00:00 2001 From: Romain Geissler Date: Thu, 5 Dec 2019 21:54:45 +0000 Subject: [PATCH] Ignore unused argument warning when compiling with -DNDEBUG. The argument "state" is indeed used only in the BOOST_ASSERT. --- include/boost/msm/back/state_machine.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/boost/msm/back/state_machine.hpp b/include/boost/msm/back/state_machine.hpp index 640802d..1623207 100644 --- a/include/boost/msm/back/state_machine.hpp +++ b/include/boost/msm/back/state_machine.hpp @@ -19,6 +19,7 @@ #include +#include #include #include #include @@ -442,6 +443,7 @@ private: BOOST_STATIC_CONSTANT(int, current_state = (get_state_id::type::value)); BOOST_STATIC_CONSTANT(int, next_state = (get_state_id::type::value)); + boost::ignore_unused(state); // Avoid warnings if BOOST_ASSERT expands to nothing. BOOST_ASSERT(state == (current_state)); // if T1 is an exit pseudo state, then take the transition only if the pseudo exit state is active if (has_pseudo_exit::type::value && @@ -521,6 +523,7 @@ private: { BOOST_STATIC_CONSTANT(int, current_state = (get_state_id::type::value)); BOOST_STATIC_CONSTANT(int, next_state = (get_state_id::type::value)); + boost::ignore_unused(state); // Avoid warnings if BOOST_ASSERT expands to nothing. BOOST_ASSERT(state == (current_state)); // if T1 is an exit pseudo state, then take the transition only if the pseudo exit state is active if (has_pseudo_exit::type::value && @@ -584,6 +587,7 @@ private: { BOOST_STATIC_CONSTANT(int, current_state = (get_state_id::type::value)); BOOST_STATIC_CONSTANT(int, next_state = (get_state_id::type::value)); + boost::ignore_unused(state); // Avoid warnings if BOOST_ASSERT expands to nothing. BOOST_ASSERT(state == (current_state)); // if T1 is an exit pseudo state, then take the transition only if the pseudo exit state is active @@ -650,6 +654,7 @@ private: { BOOST_STATIC_CONSTANT(int, current_state = (get_state_id::type::value)); BOOST_STATIC_CONSTANT(int, next_state = (get_state_id::type::value)); + boost::ignore_unused(state); // Avoid warnings if BOOST_ASSERT expands to nothing. BOOST_ASSERT(state == (current_state)); // if T1 is an exit pseudo state, then take the transition only if the pseudo exit state is active @@ -701,6 +706,7 @@ private: { BOOST_STATIC_CONSTANT(int, current_state = (get_state_id::type::value)); + boost::ignore_unused(state, current_state); // Avoid warnings if BOOST_ASSERT expands to nothing. BOOST_ASSERT(state == (current_state)); if (!check_guard(fsm,evt)) { @@ -743,6 +749,7 @@ private: static HandledEnum execute(library_sm& fsm, int , int state, transition_event const& evt) { BOOST_STATIC_CONSTANT(int, current_state = (get_state_id::type::value)); + boost::ignore_unused(state, current_state); // Avoid warnings if BOOST_ASSERT expands to nothing. BOOST_ASSERT(state == (current_state)); if (!check_guard(fsm,evt)) { @@ -770,6 +777,7 @@ private: static HandledEnum execute(library_sm& fsm, int , int state, transition_event const& evt) { BOOST_STATIC_CONSTANT(int, current_state = (get_state_id::type::value)); + boost::ignore_unused(state, current_state); // Avoid warnings if BOOST_ASSERT expands to nothing. BOOST_ASSERT(state == (current_state)); // call the action method @@ -797,6 +805,7 @@ private: static HandledEnum execute(library_sm& , int , int state, transition_event const& ) { BOOST_STATIC_CONSTANT(int, current_state = (get_state_id::type::value)); + boost::ignore_unused(state, current_state); // Avoid warnings if BOOST_ASSERT expands to nothing. BOOST_ASSERT(state == (current_state)); return HANDLED_TRUE; }