summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2024-03-19 22:18:06 +0300
committerEd Tanous <ed@tanous.net>2024-03-25 21:29:19 +0300
commit47f2934cc509e420e5617a96158e76829746b835 (patch)
treedd73fdb8eb071886f4de28a0a911972d6ce4940f
parent0501696e3663eafb3e497120b85f0f0a8194a97b (diff)
downloadbmcweb-47f2934cc509e420e5617a96158e76829746b835.tar.xz
Fix redundant init issues
clang-tidy-18 must've fixed their checking for these in headers. Resolve as the robot commands. Tested: Noop changes made by tidy. Code compiles. Change-Id: I1de7686c597deffb0df91c30dae1a29f9ba7900e Signed-off-by: Ed Tanous <ed@tanous.net>
-rw-r--r--http/http2_connection.hpp4
-rw-r--r--http/http_request.hpp8
-rw-r--r--include/sessions.hpp22
-rw-r--r--redfish-core/include/utils/query_param.hpp5
-rw-r--r--redfish-core/lib/account_service.hpp14
-rw-r--r--redfish-core/lib/metric_report_definition.hpp4
6 files changed, 34 insertions, 23 deletions
diff --git a/http/http2_connection.hpp b/http/http2_connection.hpp
index 7903ec93b1..749ac282ef 100644
--- a/http/http2_connection.hpp
+++ b/http/http2_connection.hpp
@@ -38,9 +38,9 @@ namespace crow
struct Http2StreamData
{
- Request req{};
+ Request req;
std::optional<bmcweb::HttpBody::reader> reqReader;
- Response res{};
+ Response res;
std::optional<bmcweb::HttpBody::writer> writer;
};
diff --git a/http/http_request.hpp b/http/http_request.hpp
index ee940d658b..a3c8fd8d0e 100644
--- a/http/http_request.hpp
+++ b/http/http_request.hpp
@@ -22,17 +22,17 @@ struct Request
boost::beast::http::request<bmcweb::HttpBody> req;
private:
- boost::urls::url urlBase{};
+ boost::urls::url urlBase;
public:
bool isSecure{false};
- boost::asio::io_context* ioService{};
- boost::asio::ip::address ipAddress{};
+ boost::asio::io_context* ioService = nullptr;
+ boost::asio::ip::address ipAddress;
std::shared_ptr<persistent_data::UserSession> session;
- std::string userRole{};
+ std::string userRole;
Request(boost::beast::http::request<bmcweb::HttpBody> reqIn,
std::error_code& ec) :
req(std::move(reqIn))
diff --git a/include/sessions.hpp b/include/sessions.hpp
index cb7f78e78a..fb7276212c 100644
--- a/include/sessions.hpp
+++ b/include/sessions.hpp
@@ -41,8 +41,8 @@ struct UserSession
PersistenceType persistence{PersistenceType::TIMEOUT};
bool cookieAuth = false;
bool isConfigureSelfOnly = false;
- std::string userRole{};
- std::vector<std::string> userGroups{};
+ std::string userRole;
+ std::vector<std::string> userGroups;
// There are two sources of truth for isConfigureSelfOnly:
// 1. When pamAuthenticateUser() returns PAM_NEW_AUTHTOK_REQD.
@@ -256,11 +256,19 @@ class SessionStore
}
}
- auto session = std::make_shared<UserSession>(UserSession{
- uniqueId, sessionToken, std::string(username), csrfToken, clientId,
- redfish::ip_util::toString(clientIp),
- std::chrono::steady_clock::now(), persistence, false,
- isConfigureSelfOnly});
+ auto session = std::make_shared<UserSession>(
+ UserSession{uniqueId,
+ sessionToken,
+ std::string(username),
+ csrfToken,
+ clientId,
+ redfish::ip_util::toString(clientIp),
+ std::chrono::steady_clock::now(),
+ persistence,
+ false,
+ isConfigureSelfOnly,
+ "",
+ {}});
auto it = authTokens.emplace(sessionToken, session);
// Only need to write to disk if session isn't about to be destroyed.
needWrite = persistence == PersistenceType::TIMEOUT;
diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp
index 881b09052f..fa2b4dae60 100644
--- a/redfish-core/include/utils/query_param.hpp
+++ b/redfish-core/include/utils/query_param.hpp
@@ -180,7 +180,10 @@ struct Query
std::optional<size_t> top = std::nullopt;
// Select
- SelectTrie selectTrie = {};
+ // Unclear how to make this use structured initialization without this.
+ // Might be a tidy bug? Ignore for now
+ // NOLINTNEXTLINE(readability-redundant-member-init)
+ SelectTrie selectTrie{};
};
// The struct defines how resource handlers in redfish-core/lib/ can handle
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index d897fcdb8d..ab9048a435 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -63,14 +63,14 @@ struct LDAPRoleMapData
struct LDAPConfigData
{
- std::string uri{};
- std::string bindDN{};
- std::string baseDN{};
- std::string searchScope{};
- std::string serverType{};
+ std::string uri;
+ std::string bindDN;
+ std::string baseDN;
+ std::string searchScope;
+ std::string serverType;
bool serviceEnabled = false;
- std::string userNameAttribute{};
- std::string groupAttribute{};
+ std::string userNameAttribute;
+ std::string groupAttribute;
std::vector<std::pair<std::string, LDAPRoleMapData>> groupRoleList;
};
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
index f68abdc92d..643fd52a08 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -763,7 +763,7 @@ class AddReport
private:
std::shared_ptr<bmcweb::AsyncResp> asyncResp;
AddReportArgs args;
- boost::container::flat_map<std::string, std::string> uriToDbus{};
+ boost::container::flat_map<std::string, std::string> uriToDbus;
};
class UpdateMetrics
@@ -881,7 +881,7 @@ class UpdateMetrics
const std::shared_ptr<bmcweb::AsyncResp> asyncResp;
std::vector<std::vector<std::string>> readingParamsUris;
- ReadingParameters readingParams{};
+ ReadingParameters readingParams;
};
inline void