fix coverity warning for useless call

master
Francisco Paisana 5 years ago committed by Andre Puschmann
parent 28c98280d7
commit cf9d31ea64

@ -99,25 +99,17 @@ using fsm_transitions = typename FSM::derived_view::transitions;
//! Detection of enter/exit methods of a state. //! Detection of enter/exit methods of a state.
template <typename FSM, typename State> template <typename FSM, typename State>
auto call_enter(FSM* f, State* s) -> decltype(s->enter(f), std::true_type{}) auto call_enter(FSM* f, State* s) -> decltype(s->enter(f))
{ {
s->enter(f); s->enter(f);
return std::true_type{};
}
auto call_enter(...) -> std::false_type
{
return {};
} }
void call_enter(...) {}
template <typename FSM, typename State> template <typename FSM, typename State>
auto call_exit(FSM* f, State* s) -> decltype(s->exit(f), std::true_type{}) auto call_exit(FSM* f, State* s) -> decltype(s->exit(f))
{ {
s->exit(f); s->exit(f);
return std::true_type{};
}
auto call_exit(...) -> std::false_type
{
return {};
} }
void call_exit(...) {}
//! Find State in FSM recursively (e.g. find State in FSM,FSM::parentFSM,FSM::parentFSM::parentFSM,...) //! Find State in FSM recursively (e.g. find State in FSM,FSM::parentFSM,FSM::parentFSM::parentFSM,...)
template <typename State, typename FSM> template <typename State, typename FSM>
@ -145,8 +137,6 @@ struct state_traits {
static_assert(FSM::template can_hold_state<State>(), "FSM type does not hold provided State\n"); static_assert(FSM::template can_hold_state<State>(), "FSM type does not hold provided State\n");
using state_t = State; using state_t = State;
using is_subfsm = std::integral_constant<bool, ::srslte::fsm_details::is_subfsm<State>()>; using is_subfsm = std::integral_constant<bool, ::srslte::fsm_details::is_subfsm<State>()>;
using has_enter = decltype(fsm_details::call_enter((FSM*)nullptr, (State*)nullptr));
using has_exit = decltype(fsm_details::call_exit((FSM*)nullptr, (State*)nullptr));
//! enter new state. enter is called recursively for subFSMs //! enter new state. enter is called recursively for subFSMs
static void enter_state(FSM* f, State* s) { enter_(f, s, is_subfsm{}); } static void enter_state(FSM* f, State* s) { enter_(f, s, is_subfsm{}); }

@ -171,9 +171,6 @@ static_assert(fsm1::can_hold_state<fsm1::state1>(), "failed can_hold_state check
static_assert(std::is_same<enable_if_fsm_state<fsm1, fsm1::idle_st>, void>::value, "get state list failed\n"); static_assert(std::is_same<enable_if_fsm_state<fsm1, fsm1::idle_st>, void>::value, "get state list failed\n");
static_assert(std::is_same<disable_if_fsm_state<fsm1, fsm1::fsm2::state_inner>, void>::value, static_assert(std::is_same<disable_if_fsm_state<fsm1, fsm1::fsm2::state_inner>, void>::value,
"get state list failed\n"); "get state list failed\n");
static_assert(fsm_details::state_traits<fsm1, fsm1::idle_st>::has_enter::value, "Failed detection of enter method\n");
static_assert(fsm_details::state_traits<fsm1, fsm1::idle_st>::has_exit::value == false,
"Failed detection of exit method\n");
} // namespace fsm_details } // namespace fsm_details
} // namespace srslte } // namespace srslte

Loading…
Cancel
Save