Add explicit keyword to 1 arg constructors
The cppcheck tool complains about it otherwise.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Id977a6c349b0b49354b52ac994ea7742e0a39307
diff --git a/control/json/dbus_zone.hpp b/control/json/dbus_zone.hpp
index 83abb53..d2b82dc 100644
--- a/control/json/dbus_zone.hpp
+++ b/control/json/dbus_zone.hpp
@@ -47,7 +47,7 @@
*
* @param[in] zone - Zone object
*/
- DBusZone(const Zone& zone);
+ explicit DBusZone(const Zone& zone);
/**
* @brief Overridden thermalmode interface's set 'Current' property function
diff --git a/control/json/fan.hpp b/control/json/fan.hpp
index cac8dd2..06c301d 100644
--- a/control/json/fan.hpp
+++ b/control/json/fan.hpp
@@ -61,7 +61,7 @@
*
* @param[in] jsonObj - JSON object
*/
- Fan(const json& jsonObj);
+ explicit Fan(const json& jsonObj);
/**
* @brief Get the zone
diff --git a/control/json/group.hpp b/control/json/group.hpp
index 4057914..2d4a489 100644
--- a/control/json/group.hpp
+++ b/control/json/group.hpp
@@ -58,7 +58,7 @@
*
* @param[in] jsonObj - JSON object
*/
- Group(const json& jsonObj);
+ explicit Group(const json& jsonObj);
/**
* Copy Constructor
diff --git a/control/json/manager.hpp b/control/json/manager.hpp
index 8bb5c35..c169919 100644
--- a/control/json/manager.hpp
+++ b/control/json/manager.hpp
@@ -162,7 +162,7 @@
*
* @param[in] event - sdeventplus event loop
*/
- Manager(const sdeventplus::Event& event);
+ explicit Manager(const sdeventplus::Event& event);
/**
* @brief Callback function to handle receiving a HUP signal to reload the
diff --git a/control/json/profile.hpp b/control/json/profile.hpp
index dd0aed0..8647eb8 100644
--- a/control/json/profile.hpp
+++ b/control/json/profile.hpp
@@ -56,7 +56,7 @@
* @param[in] bus - sdbusplus bus object
* @param[in] jsonObj - JSON object
*/
- Profile(const json& jsonObj);
+ explicit Profile(const json& jsonObj);
/**
* @brief Get the active state
diff --git a/control/json/utils/modifier.cpp b/control/json/utils/modifier.cpp
index 501a035..91978e7 100644
--- a/control/json/utils/modifier.cpp
+++ b/control/json/utils/modifier.cpp
@@ -93,7 +93,7 @@
*/
struct MinusOperator : public Modifier::BaseOperator
{
- MinusOperator(const json& jsonObj) :
+ explicit MinusOperator(const json& jsonObj) :
arg(ConfigBase::getJsonValue(jsonObj["value"]))
{}
@@ -162,7 +162,7 @@
*/
struct LessThanOperator : public Modifier::BaseOperator
{
- LessThanOperator(const json& jsonObj)
+ explicit LessThanOperator(const json& jsonObj)
{
const auto& valueArray = jsonObj["value"];
if (!valueArray.is_array())
diff --git a/control/json/utils/modifier.hpp b/control/json/utils/modifier.hpp
index 8959203..92fdb70 100644
--- a/control/json/utils/modifier.hpp
+++ b/control/json/utils/modifier.hpp
@@ -80,7 +80,7 @@
*
* @param[in] jsonObj - The JSON config object
*/
- Modifier(const json& jsonObj);
+ explicit Modifier(const json& jsonObj);
/**
* @brief Performs the operation
diff --git a/control/json/utils/pcie_card_metadata.hpp b/control/json/utils/pcie_card_metadata.hpp
index a879a51..c6b2083 100644
--- a/control/json/utils/pcie_card_metadata.hpp
+++ b/control/json/utils/pcie_card_metadata.hpp
@@ -68,7 +68,7 @@
*
* @param[in] systemNames - The system names values
*/
- PCIeCardMetadata(const std::vector<std::string>& systemNames);
+ explicit PCIeCardMetadata(const std::vector<std::string>& systemNames);
/**
* @brief Look up a floor index based on a card's metadata
diff --git a/monitor/fan_error.cpp b/monitor/fan_error.cpp
index ccbba4e..f6aa0e6 100644
--- a/monitor/fan_error.cpp
+++ b/monitor/fan_error.cpp
@@ -56,7 +56,7 @@
JournalCloser& operator=(const JournalCloser&) = delete;
JournalCloser& operator=(JournalCloser&&) = delete;
- JournalCloser(sd_journal* journal) : journal{journal}
+ explicit JournalCloser(sd_journal* journal) : journal{journal}
{}
~JournalCloser()