adt,fsm: ignore GCC warning for template specialization w/wo defaults for ReactFn or GuardFn

master
Robert Falkenberg 3 years ago
parent 02cb2532f8
commit aa9f844630

@ -332,6 +332,9 @@ public:
constexpr static void (Derived::*react_fn)(SrcState&, const Event&) = ReactFn; constexpr static void (Derived::*react_fn)(SrcState&, const Event&) = ReactFn;
constexpr static bool (Derived::*guard_fn)(SrcState&, const Event&) = GuardFn; constexpr static bool (Derived::*guard_fn)(SrcState&, const Event&) = GuardFn;
// ignore warning "never nullptr" for template specialization w/wo defaults for ReactFn or GuardFn
_Pragma("GCC diagnostic push"); // save current diagnostic config
_Pragma("GCC diagnostic ignored \"-Waddress\""); // ignore -Waddress
static bool react(derived_view* f, src_state_t& s, const event_t& ev) static bool react(derived_view* f, src_state_t& s, const event_t& ev)
{ {
if (guard_fn == nullptr or (f->*guard_fn)(s, ev)) { if (guard_fn == nullptr or (f->*guard_fn)(s, ev)) {
@ -342,6 +345,7 @@ public:
} }
return false; return false;
} }
_Pragma("GCC diagnostic pop"); // restore diagnostic config
template <typename SrcState2, typename Event2> template <typename SrcState2, typename Event2>
using is_match = std::is_same<type_list<SrcState2, Event2>, type_list<src_state_t, event_t> >; using is_match = std::is_same<type_list<SrcState2, Event2>, type_list<src_state_t, event_t> >;
@ -363,6 +367,9 @@ public:
constexpr static void (Derived::*react_fn)(const Event&) = ReactFn; constexpr static void (Derived::*react_fn)(const Event&) = ReactFn;
constexpr static bool (Derived::*guard_fn)(const Event&) = GuardFn; constexpr static bool (Derived::*guard_fn)(const Event&) = GuardFn;
// ignore warning "never nullptr" for template specialization w/wo defaults for ReactFn or GuardFn
_Pragma("GCC diagnostic push"); // save current diagnostic config
_Pragma("GCC diagnostic ignored \"-Waddress\""); // ignore -Waddress
template <typename SrcState> template <typename SrcState>
static bool react(derived_view* f, SrcState& s, const event_t& ev) static bool react(derived_view* f, SrcState& s, const event_t& ev)
{ {
@ -374,6 +381,7 @@ public:
} }
return false; return false;
} }
_Pragma("GCC diagnostic pop"); // restore diagnostic config
template <typename SrcState2, typename Event2> template <typename SrcState2, typename Event2>
using is_match = std::is_same<Event2, event_t>; using is_match = std::is_same<Event2, event_t>;

Loading…
Cancel
Save