diff options
| author | Ed Tanous <ed@tanous.net> | 2019-02-13 20:10:56 -0800 |
|---|---|---|
| committer | Ed Tanous <ed.tanous@intel.com> | 2019-02-21 01:46:07 +0000 |
| commit | 43b761d0c8f5c4c39199093ee4bcd60698e77138 (patch) | |
| tree | 0d0c6132a6066fbeefb3248f5f2f73ca4b23fcc5 | |
| parent | 3eb2f35f28249b9b5dc2159a44ca75a0fa7677a5 (diff) | |
| download | bmcweb-43b761d0c8f5c4c39199093ee4bcd60698e77138.tar.gz bmcweb-43b761d0c8f5c4c39199093ee4bcd60698e77138.zip | |
bmcweb: fix compiler warnings
This patchset attempts to fix all compiler warnings in bmcweb owned
files. There are 2 warnings left, both in sdbusplus, which will be
resolved in a patchset there.
Tested By:
Recompiled, observed warning count went from 30, to zero.
Change-Id: Ife90207aa5773bc28faa8b04c732cafa5a56e4e4
Signed-off-by: Ed Tanous <ed@tanous.net>
| -rw-r--r-- | crow/include/crow/common.h | 5 | ||||
| -rw-r--r-- | crow/include/crow/http_connection.h | 2 | ||||
| -rw-r--r-- | crow/include/crow/http_request.h | 3 | ||||
| -rw-r--r-- | crow/include/crow/logging.h | 8 | ||||
| -rw-r--r-- | crow/include/crow/websocket.h | 6 | ||||
| -rw-r--r-- | redfish-core/lib/ethernet.hpp | 6 | ||||
| -rw-r--r-- | redfish-core/lib/managers.hpp | 39 | ||||
| -rw-r--r-- | redfish-core/lib/network_protocol.hpp | 3 | ||||
| -rw-r--r-- | redfish-core/lib/sensors.hpp | 4 | ||||
| -rw-r--r-- | redfish-core/lib/update_service.hpp | 1 |
10 files changed, 32 insertions, 45 deletions
diff --git a/crow/include/crow/common.h b/crow/include/crow/common.h index 428da7d..9dc8220 100644 --- a/crow/include/crow/common.h +++ b/crow/include/crow/common.h @@ -33,8 +33,9 @@ inline std::string methodName(boost::beast::http::verb method) return "TRACE"; case boost::beast::http::verb::patch: return "PATCH"; + default: + return "invalid"; } - return "invalid"; } enum class ParamType @@ -124,4 +125,4 @@ constexpr boost::beast::http::verb operator"" _method(const char* str, crow::black_magic::isEquP(str, "PURGE", 5) ? verb::purge : throw std::runtime_error("invalid http method"); // clang-format on -}
\ No newline at end of file +} diff --git a/crow/include/crow/http_connection.h b/crow/include/crow/http_connection.h index bd2a824..f056f27 100644 --- a/crow/include/crow/http_connection.h +++ b/crow/include/crow/http_connection.h @@ -312,8 +312,6 @@ class Connection { cancelDeadlineTimer(); bool isInvalidRequest = false; - const boost::string_view connection = - req->getHeaderValue(boost::beast::http::field::connection); // Check for HTTP version 1.1. if (req->version() == 11) diff --git a/crow/include/crow/http_request.h b/crow/include/crow/http_request.h index ac5f78d..7de618f 100644 --- a/crow/include/crow/http_request.h +++ b/crow/include/crow/http_request.h @@ -12,6 +12,7 @@ namespace crow struct Request { + boost::beast::http::request<boost::beast::http::string_body>& req; boost::string_view url{}; QueryString urlParams{}; bool isSecure{false}; @@ -65,8 +66,6 @@ struct Request { return req.keep_alive(); } - - boost::beast::http::request<boost::beast::http::string_body>& req; }; } // namespace crow diff --git a/crow/include/crow/logging.h b/crow/include/crow/logging.h index 353a448..9da47b7 100644 --- a/crow/include/crow/logging.h +++ b/crow/include/crow/logging.h @@ -71,24 +71,24 @@ class logger } ~logger() { -#ifdef BMCWEB_ENABLE_LOGGING if (level >= get_current_log_level()) { +#ifdef BMCWEB_ENABLE_LOGGING stringstream << std::endl; getHandlerRef()->log(stringstream.str(), level); - } #endif + } } // template <typename T> logger& operator<<(T const& value) { -#ifdef BMCWEB_ENABLE_LOGGING if (level >= get_current_log_level()) { +#ifdef BMCWEB_ENABLE_LOGGING stringstream << value; - } #endif + } return *this; } diff --git a/crow/include/crow/websocket.h b/crow/include/crow/websocket.h index b545b5a..6ce7e05 100644 --- a/crow/include/crow/websocket.h +++ b/crow/include/crow/websocket.h @@ -54,8 +54,8 @@ template <typename Adaptor> class ConnectionImpl : public Connection message_handler, std::function<void(Connection&, const std::string&)> close_handler, std::function<void(Connection&)> error_handler) : - inString(), - inBuffer(inString, 4096), ws(std::move(adaptorIn)), Connection(req), + Connection(req), + ws(std::move(adaptorIn)), inString(), inBuffer(inString, 4096), openHandler(std::move(open_handler)), messageHandler(std::move(message_handler)), closeHandler(std::move(close_handler)), @@ -129,7 +129,7 @@ template <typename Adaptor> class ConnectionImpl : public Connection { ws.async_close( boost::beast::websocket::close_code::normal, - [this, self(shared_from_this())](boost::system::error_code ec) { + [self(shared_from_this())](boost::system::error_code ec) { if (ec == boost::asio::error::operation_aborted) { return; diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp index aecfc21..a7018a4 100644 --- a/redfish-core/lib/ethernet.hpp +++ b/redfish-core/lib/ethernet.hpp @@ -632,8 +632,7 @@ inline void createIPv4(const std::string &ifaceId, unsigned int ipIdx, const std::string &address, std::shared_ptr<AsyncResp> asyncResp) { - auto createIpHandler = [ipIdx, - asyncResp](const boost::system::error_code ec) { + auto createIpHandler = [asyncResp](const boost::system::error_code ec) { if (ec) { messages::internalError(asyncResp->res); @@ -1634,8 +1633,7 @@ class VlanNetworkInterfaceCollection : public Node // Get eth interface list, and call the below callback for JSON // preparation getEthernetIfaceList( - [this, asyncResp, - rootInterfaceName{std::string(rootInterfaceName)}]( + [asyncResp, rootInterfaceName{std::string(rootInterfaceName)}]( const bool &success, const std::vector<std::string> &iface_list) { if (!success) diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp index 3f181c7..e9120f3 100644 --- a/redfish-core/lib/managers.hpp +++ b/redfish-core/lib/managers.hpp @@ -166,7 +166,6 @@ static void asyncPopulatePid(const std::string& connection, configRoot["@odata.context"] = "/redfish/v1/$metadata#OemManager.Fan"; - bool propertyError = false; for (const auto& pathPair : managedObj) { for (const auto& intfPair : pathPair.second) @@ -945,7 +944,6 @@ class Manager : public Node "xyz.openbmc_project.Software.Version") { // Cut out everyting until last "/", ... - const std::string& iface_id = objpath.first; for (auto& property : interface.second) { if (property.first == "Version") @@ -1005,7 +1003,7 @@ class Manager : public Node return; } std::array< - std::pair<const char*, std::optional<nlohmann::json>*>, 4> + std::pair<std::string, std::optional<nlohmann::json>*>, 4> sections = { std::make_pair("PidControllers", &pidControllers), std::make_pair("FanControllers", &fanControllers), @@ -1020,7 +1018,7 @@ class Manager : public Node { continue; } - const char* type = containerPair.first; + std::string& type = containerPair.first; for (auto& record : container->items()) { @@ -1180,31 +1178,26 @@ class Manager : public Node if (oem) { - for (const auto& oemLevel : oem->items()) + std::optional<nlohmann::json> openbmc; + if (!redfish::json_util::readJson(*oem, res, "OpenBmc", openbmc)) { - std::optional<nlohmann::json> openbmc; - if (!redfish::json_util::readJson(*oem, res, "OpenBmc", - openbmc)) + BMCWEB_LOG_ERROR << "Line:" << __LINE__ << ", Illegal Property " + << oem->dump(); + return; + } + if (openbmc) + { + std::optional<nlohmann::json> fan; + if (!redfish::json_util::readJson(*openbmc, res, "Fan", fan)) { BMCWEB_LOG_ERROR << "Line:" << __LINE__ - << ", Illegal Property " << oem->dump(); + << ", Illegal Property " + << openbmc->dump(); return; } - if (openbmc) + if (fan) { - std::optional<nlohmann::json> fan; - if (!redfish::json_util::readJson(*openbmc, res, "Fan", - fan)) - { - BMCWEB_LOG_ERROR << "Line:" << __LINE__ - << ", Illegal Property " - << openbmc->dump(); - return; - } - if (fan) - { - setPidValues(response, *fan); - } + setPidValues(response, *fan); } } } diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp index 044d8d0..009be05 100644 --- a/redfish-core/lib/network_protocol.hpp +++ b/redfish-core/lib/network_protocol.hpp @@ -155,8 +155,7 @@ class NetworkProtocol : public Node "running"; crow::connections::systemBus->async_method_call( - [asyncResp, service{std::string(service)}, - socketPath]( + [asyncResp, service{std::string(service)}]( const boost::system::error_code ec, const std::variant<std::vector<std::tuple< std::string, std::string>>>& resp) { diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 28dc358..9fa5d88 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -50,8 +50,8 @@ class SensorsAsyncResp SensorsAsyncResp(crow::Response& response, const std::string& chassisId, const std::initializer_list<const char*> types, const std::string& subNode) : - chassisId(chassisId), - res(response), types(types), chassisSubNode(subNode) + res(response), + chassisId(chassisId), types(types), chassisSubNode(subNode) { res.jsonValue["@odata.id"] = "/redfish/v1/Chassis/" + chassisId + "/Thermal"; diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp index 5d5b3ea..9e6ea4f 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -116,7 +116,6 @@ class UpdateService : public Node auto callback = [&res](sdbusplus::message::message &m) { BMCWEB_LOG_DEBUG << "Match fired"; - bool flag = false; if (m.is_method_error()) { |

