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>
diff --git a/http/http2_connection.hpp b/http/http2_connection.hpp
index 7903ec9..749ac28 100644
--- a/http/http2_connection.hpp
+++ b/http/http2_connection.hpp
@@ -38,9 +38,9 @@
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 ee940d6..a3c8fd8 100644
--- a/http/http_request.hpp
+++ b/http/http_request.hpp
@@ -22,17 +22,17 @@
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 cb7f78e..fb72762 100644
--- a/include/sessions.hpp
+++ b/include/sessions.hpp
@@ -41,8 +41,8 @@
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 @@
}
}
- 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 881b090..fa2b4da 100644
--- a/redfish-core/include/utils/query_param.hpp
+++ b/redfish-core/include/utils/query_param.hpp
@@ -180,7 +180,10 @@
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 d897fcd..ab9048a 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -63,14 +63,14 @@
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 f68abdc..643fd52 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -763,7 +763,7 @@
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 @@
const std::shared_ptr<bmcweb::AsyncResp> asyncResp;
std::vector<std::vector<std::string>> readingParamsUris;
- ReadingParameters readingParams{};
+ ReadingParameters readingParams;
};
inline void