summarylogtreecommitdiffstats
path: root/0003-adt-fsm-ignore-GCC-warning-for-template-specializati.patch
blob: b09a59833ad73b27298cbb8b502515a0ba05de4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From aa9f844630d0627018c7ecb7008e309e1d04905e Mon Sep 17 00:00:00 2001
From: Robert Falkenberg <robert.falkenberg@srs.io>
Date: Fri, 13 May 2022 12:36:20 +0200
Subject: [PATCH] adt,fsm: ignore GCC warning for template specialization w/wo
 defaults for ReactFn or GuardFn

---
 lib/include/srsran/adt/fsm.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/include/srsran/adt/fsm.h b/lib/include/srsran/adt/fsm.h
index 1e00946d7..4583b1f19 100644
--- a/lib/include/srsran/adt/fsm.h
+++ b/lib/include/srsran/adt/fsm.h
@@ -332,6 +332,9 @@ public:
     constexpr static void (Derived::*react_fn)(SrcState&, const Event&) = ReactFn;
     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)
     {
       if (guard_fn == nullptr or (f->*guard_fn)(s, ev)) {
@@ -342,6 +345,7 @@ public:
       }
       return false;
     }
+    _Pragma("GCC diagnostic pop"); // restore diagnostic config
 
     template <typename SrcState2, typename Event2>
     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 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>
     static bool react(derived_view* f, SrcState& s, const event_t& ev)
     {
@@ -374,6 +381,7 @@ public:
       }
       return false;
     }
+    _Pragma("GCC diagnostic pop"); // restore diagnostic config
 
     template <typename SrcState2, typename Event2>
     using is_match = std::is_same<Event2, event_t>;
-- 
2.36.1