summaryrefslogtreecommitdiff
path: root/redfish-core/lib/chassis.hpp
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2020-07-25 07:45:05 +0300
committerEd Tanous <ed@tanous.net>2020-08-17 23:54:37 +0300
commit23a21a1cbed23ace4174664950e595df961e9e69 (patch)
tree12e7cc9d9301642fc1e48332a0e0834c54e8c8af /redfish-core/lib/chassis.hpp
parent52cc112d962920b035c870127784bcbd98948fad (diff)
downloadbmcweb-23a21a1cbed23ace4174664950e595df961e9e69.tar.xz
Enable clang warnings
This commit enables clang warnings, and fixes all warnings that were found. Most of these fall into a couple categories: Variable shadow issues were fixed by renaming variables unused parameter warnings were resolved by either checking error codes that had been ignored, or removing the name of the variable from the scope. Other various warnings were fixed in the best way I was able to come up with. Note, the redfish Node class is especially insidious, as it causes all imlementers to have variables for parameters, regardless of whether or not they are used. Deprecating the Node class is on my list of things to do, as it adds extra overhead, and in general isn't a useful abstraction. For now, I have simply fixed all the handlers. Tested: Added the current meta-clang meta layer into bblayers.conf, and added TOOLCHAIN_pn-bmcweb = "clang" to my local.conf Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Ia75b94010359170159c703e535d1c1af182fe700
Diffstat (limited to 'redfish-core/lib/chassis.hpp')
-rw-r--r--redfish-core/lib/chassis.hpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index ce0a8c1269..10b07980e0 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -33,7 +33,7 @@ namespace redfish
*
* @return None.
*/
-void getChassisState(std::shared_ptr<AsyncResp> aResp)
+inline void getChassisState(std::shared_ptr<AsyncResp> aResp)
{
crow::connections::systemBus->async_method_call(
[aResp{std::move(aResp)}](
@@ -85,9 +85,9 @@ using ManagedObjectsType = std::vector<std::pair<
using PropertiesType = boost::container::flat_map<std::string, VariantType>;
-void getIntrusionByService(std::shared_ptr<AsyncResp> aResp,
- const std::string& service,
- const std::string& objPath)
+inline void getIntrusionByService(std::shared_ptr<AsyncResp> aResp,
+ const std::string& service,
+ const std::string& objPath)
{
BMCWEB_LOG_DEBUG << "Get intrusion status by service \n";
@@ -120,7 +120,7 @@ void getIntrusionByService(std::shared_ptr<AsyncResp> aResp,
/**
* Retrieves physical security properties over dbus
*/
-void getPhysicalSecurityData(std::shared_ptr<AsyncResp> aResp)
+inline void getPhysicalSecurityData(std::shared_ptr<AsyncResp> aResp)
{
crow::connections::systemBus->async_method_call(
[aResp{std::move(aResp)}](
@@ -289,9 +289,9 @@ class Chassis : public Node
auto health = std::make_shared<HealthPopulate>(asyncResp);
crow::connections::systemBus->async_method_call(
- [health](const boost::system::error_code ec,
+ [health](const boost::system::error_code ec2,
std::variant<std::vector<std::string>>& resp) {
- if (ec)
+ if (ec2)
{
return; // no sensors = no failures
}
@@ -335,7 +335,7 @@ class Chassis : public Node
const std::string& connectionName =
connectionNames[0].first;
- const std::vector<std::string>& interfaces =
+ const std::vector<std::string>& interfaces2 =
connectionNames[0].second;
const std::array<const char*, 2> hasIndicatorLed = {
"xyz.openbmc_project.Inventory.Item.Panel",
@@ -343,8 +343,8 @@ class Chassis : public Node
for (const char* interface : hasIndicatorLed)
{
- if (std::find(interfaces.begin(), interfaces.end(),
- interface) != interfaces.end())
+ if (std::find(interfaces2.begin(), interfaces2.end(),
+ interface) != interfaces2.end())
{
getIndicatorLedState(asyncResp);
break;
@@ -353,7 +353,7 @@ class Chassis : public Node
crow::connections::systemBus->async_method_call(
[asyncResp, chassisId(std::string(chassisId))](
- const boost::system::error_code ec,
+ const boost::system::error_code ec2,
const std::vector<std::pair<
std::string, VariantType>>& propertiesList) {
for (const std::pair<std::string, VariantType>&
@@ -480,7 +480,7 @@ class Chassis : public Node
continue;
}
- const std::vector<std::string>& interfaces =
+ const std::vector<std::string>& interfaces3 =
connectionNames[0].second;
if (indicatorLed)
@@ -492,8 +492,9 @@ class Chassis : public Node
bool indicatorChassis = false;
for (const char* interface : hasIndicatorLed)
{
- if (std::find(interfaces.begin(), interfaces.end(),
- interface) != interfaces.end())
+ if (std::find(interfaces3.begin(),
+ interfaces3.end(),
+ interface) != interfaces3.end())
{
indicatorChassis = true;
break;
@@ -523,7 +524,7 @@ class Chassis : public Node
}
};
-void doChassisPowerCycle(std::shared_ptr<AsyncResp> asyncResp)
+inline void doChassisPowerCycle(std::shared_ptr<AsyncResp> asyncResp)
{
const char* processName = "xyz.openbmc_project.State.Chassis";
const char* objectPath = "/xyz/openbmc_project/state/chassis0";