From 827f05a53cb831bd54166ee812752ae3cce2b69b Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Mon, 16 Dec 2024 13:38:09 +0100 Subject: Fix struct member initialization --- src/buildtool/common/repository_config.hpp | 2 +- src/buildtool/execution_api/remote/bazel/bazel_action.cpp | 3 ++- .../execution_api/remote/bazel/bazel_cas_client.hpp | 4 ++-- .../execution_api/remote/bazel/bazel_execution_client.hpp | 6 +++--- src/buildtool/file_system/git_repo.cpp | 4 ++-- src/other_tools/utils/parse_git_tree.cpp | 13 ++++++------- src/utils/automata/dfa_minimizer.hpp | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/buildtool/common/repository_config.hpp b/src/buildtool/common/repository_config.hpp index 218cd14d..1d4a7ce6 100644 --- a/src/buildtool/common/repository_config.hpp +++ b/src/buildtool/common/repository_config.hpp @@ -43,7 +43,7 @@ class RepositoryConfig { FileRoot target_root{workspace_root}; FileRoot rule_root{target_root}; FileRoot expression_root{rule_root}; - std::map name_mapping; + std::map name_mapping{}; std::string target_file_name{"TARGETS"}; std::string rule_file_name{"RULES"}; std::string expression_file_name{"EXPRESSIONS"}; diff --git a/src/buildtool/execution_api/remote/bazel/bazel_action.cpp b/src/buildtool/execution_api/remote/bazel/bazel_action.cpp index 62df5b6a..17ad10a2 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_action.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_action.cpp @@ -101,7 +101,8 @@ auto BazelAction::Execute(Logger const* logger) noexcept logger, action->hash(), network_, - BazelExecutionClient::ExecutionOutput{*result, true}); + BazelExecutionClient::ExecutionOutput{ + .action_result = *result, .cached_result = true}); } } } diff --git a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp index 69e575e5..eca24d9c 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp @@ -189,9 +189,9 @@ class BazelCasClient { template struct RetryProcessBatchResponse { bool ok{false}; - std::vector result; + std::vector result{}; bool exit_retry_loop{false}; - std::optional error_msg; + std::optional error_msg{}; }; // If this function is defined in the .cpp file, clang raises an error diff --git a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp index 889ca7a3..872ab110 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp @@ -41,9 +41,9 @@ class BazelExecutionClient { struct ExecutionOutput { bazel_re::ActionResult action_result; bool cached_result{}; - grpc::Status status; - std::unordered_map server_logs; - std::string message; + grpc::Status status{}; + std::unordered_map server_logs{}; + std::string message{}; }; struct ExecutionResponse { diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp index fd49775d..12613007 100644 --- a/src/buildtool/file_system/git_repo.cpp +++ b/src/buildtool/file_system/git_repo.cpp @@ -197,8 +197,8 @@ std::unordered_set const kNonSpecialGitFileModes{ struct InMemoryODBBackend { git_odb_backend parent; - GitRepo::tree_entries_t const* entries{nullptr}; // object headers - std::unordered_map trees; // solid tree objects + GitRepo::tree_entries_t const* entries{nullptr}; // object headers + std::unordered_map trees{}; // solid tree objects }; [[nodiscard]] auto backend_read_header(size_t* len_p, diff --git a/src/other_tools/utils/parse_git_tree.cpp b/src/other_tools/utils/parse_git_tree.cpp index c14f4c55..c8cd23e7 100644 --- a/src/other_tools/utils/parse_git_tree.cpp +++ b/src/other_tools/utils/parse_git_tree.cpp @@ -106,12 +106,11 @@ } } // populate struct - auto info = GitTreeInfo{.tree_hash = *std::move(repo_desc_hash_info), - .env_vars = std::move(env), - .inherit_env = std::move(inherit_env), - .command = std::move(cmd)}; - if (origin) { - info.origin = *std::move(origin); - } + auto info = + GitTreeInfo{.tree_hash = *std::move(repo_desc_hash_info), + .env_vars = std::move(env), + .inherit_env = std::move(inherit_env), + .command = std::move(cmd), + .origin = origin ? std::move(*origin) : std::string{}}; return info; } diff --git a/src/utils/automata/dfa_minimizer.hpp b/src/utils/automata/dfa_minimizer.hpp index af0da1c9..c4201c97 100644 --- a/src/utils/automata/dfa_minimizer.hpp +++ b/src/utils/automata/dfa_minimizer.hpp @@ -48,7 +48,7 @@ class DFAMinimizer { // Bucket of states with equal local properties (content and acceptance) struct Bucket { std::vector symbols; - states_t states; + states_t states{}; }; // Key used for state pairs. Reordering names will result in the same key. -- cgit v1.2.3