Fix cppcheck warnings
Warning message:
```
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:97:16: error: invalid application of 'sizeof' to an incomplete type 'phosphor::led::fru::fault::monitor::Remove'
97 | static_assert(sizeof(_Tp)>0,
| ^~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:404:4: note: in instantiation of member function 'std::default_delete<phosphor::led::fru::fault::monitor::Remove>::operator()' requested here
404 | get_deleter()(std::move(__ptr));
| ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88:15: note: in instantiation of member function 'std::unique_ptr<phosphor::led::fru::fault::monitor::Remove>::~unique_ptr' requested here
88 | __location->~_Tp();
| ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:149:12: note: in instantiation of function template specialization 'std::destroy_at<std::unique_ptr<phosphor::led::fru::fault::monitor::Remove>>' requested here
149 | std::destroy_at(__pointer);
| ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:163:11: note: in instantiation of function template specialization 'std::_Destroy<std::unique_ptr<phosphor::led::fru::fault::monitor::Remove>>' requested here
163 | std::_Destroy(std::__addressof(*__first));
| ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:193:35: note: in instantiation of function template specialization 'std::_Destroy_aux<false>::__destroy<std::unique_ptr<phosphor::led::fru::fault::monitor::Remove> *>' requested here
193 | return std::_Destroy_aux<false>::__destroy(__first, __last);
| ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:948:12: note: in instantiation of function template specialization 'std::_Destroy<std::unique_ptr<phosphor::led::fru::fault::monitor::Remove> *>' requested here
948 | std::_Destroy(__first, __last);
| ^
/usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:735:7: note: in instantiation of function template specialization 'std::_Destroy<std::unique_ptr<phosphor::led::fru::fault::monitor::Remove> *, std::unique_ptr<phosphor::led::fru::fault::monitor::Remove>>' requested here
735 | std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,
| ^
../../../fault-monitor/fru-fault-monitor.hpp:48:14: note: in instantiation of member function 'std::vector<std::unique_ptr<phosphor::led::fru::fault::monitor::Remove>>::~vector' requested here
48 | explicit Add(sdbusplus::bus_t& bus) :
| ^
../../../fault-monitor/fru-fault-monitor.hpp:28:7: note: forward declaration of 'phosphor::led::fru::fault::monitor::Remove'
28 | class Remove;
| ^
```
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I5c20a0031deff51e6bacccdd81310e95f14e52a0
diff --git a/fault-monitor/fru-fault-monitor.hpp b/fault-monitor/fru-fault-monitor.hpp
index 028e873..e5ddc53 100644
--- a/fault-monitor/fru-fault-monitor.hpp
+++ b/fault-monitor/fru-fault-monitor.hpp
@@ -25,54 +25,6 @@
*/
void action(sdbusplus::bus_t& bus, const std::string& path, bool assert);
-class Remove;
-
-/** @class Add
- * @brief Implementation of LED handling during FRU fault
- * @details This implements methods for watching for a FRU fault
- * being logged to assert the corresponding LED
- */
-class Add
-{
- public:
- Add() = delete;
- ~Add() = default;
- Add(const Add&) = delete;
- Add& operator=(const Add&) = delete;
- Add(Add&&) = default;
- Add& operator=(Add&&) = default;
-
- /** @brief constructs Add a watch for FRU faults.
- * @param[in] bus - The Dbus bus object
- */
- explicit Add(sdbusplus::bus_t& bus) :
- matchCreated(
- bus,
- sdbusplus::bus::match::rules::interfacesAdded() +
- sdbusplus::bus::match::rules::path_namespace(
- "/xyz/openbmc_project/logging"),
- std::bind(std::mem_fn(&Add::created), this, std::placeholders::_1))
- {
- processExistingCallouts(bus);
- }
-
- private:
- /** @brief sdbusplus signal match for fault created */
- sdbusplus::bus::match_t matchCreated;
-
- std::vector<std::unique_ptr<Remove>> removeWatches;
-
- /** @brief Callback function for fru fault created
- * @param[in] msg - Data associated with subscribed signal
- */
- void created(sdbusplus::message_t& msg);
-
- /** @brief This function process all callouts at application start
- * @param[in] bus - The Dbus bus object
- */
- void processExistingCallouts(sdbusplus::bus_t& bus);
-};
-
/** @class Remove
* @brief Implementation of LED handling after resolution of FRU fault
* @details Implement methods for watching the resolution of FRU faults
@@ -127,6 +79,52 @@
return matchStmt;
}
};
+
+/** @class Add
+ * @brief Implementation of LED handling during FRU fault
+ * @details This implements methods for watching for a FRU fault
+ * being logged to assert the corresponding LED
+ */
+class Add
+{
+ public:
+ Add() = delete;
+ ~Add() = default;
+ Add(const Add&) = delete;
+ Add& operator=(const Add&) = delete;
+ Add(Add&&) = default;
+ Add& operator=(Add&&) = default;
+
+ /** @brief constructs Add a watch for FRU faults.
+ * @param[in] bus - The Dbus bus object
+ */
+ explicit Add(sdbusplus::bus_t& bus) :
+ matchCreated(
+ bus,
+ sdbusplus::bus::match::rules::interfacesAdded() +
+ sdbusplus::bus::match::rules::path_namespace(
+ "/xyz/openbmc_project/logging"),
+ std::bind(std::mem_fn(&Add::created), this, std::placeholders::_1))
+ {
+ processExistingCallouts(bus);
+ }
+
+ private:
+ /** @brief sdbusplus signal match for fault created */
+ sdbusplus::bus::match_t matchCreated;
+
+ std::vector<std::unique_ptr<Remove>> removeWatches;
+
+ /** @brief Callback function for fru fault created
+ * @param[in] msg - Data associated with subscribed signal
+ */
+ void created(sdbusplus::message_t& msg);
+
+ /** @brief This function process all callouts at application start
+ * @param[in] bus - The Dbus bus object
+ */
+ void processExistingCallouts(sdbusplus::bus_t& bus);
+};
} // namespace monitor
} // namespace fault
} // namespace fru