diff options
78 files changed, 286 insertions, 285 deletions
diff --git a/.clang-tidy b/.clang-tidy index 2b866f78..e1b14f15 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -11,5 +11,6 @@ WarningsAsErrors: >- modernize-*,-modernize-return-braced-init-list, performance-*,-performance-avoid-endl, portability-*, + readability-redundant-member-init, CheckOptions: - { key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic, value: '1' } diff --git a/src/buildtool/auth/authentication.hpp b/src/buildtool/auth/authentication.hpp index 80fe5886..ace2e60d 100644 --- a/src/buildtool/auth/authentication.hpp +++ b/src/buildtool/auth/authentication.hpp @@ -35,18 +35,18 @@ struct Auth final { class Builder; // CA certificate bundle - std::string const ca_cert = {}; + std::string const ca_cert; // Client-side signed certificate - std::string const client_cert = {}; + std::string const client_cert; // Client-side private key - std::string const client_key = {}; + std::string const client_key; // Server-side signed certificate - std::string const server_cert = {}; + std::string const server_cert; // Server-side private key - std::string const server_key = {}; + std::string const server_key; }; - std::variant<std::monostate, TLS> method = {}; + std::variant<std::monostate, TLS> method; }; class Auth::TLS::Builder final { diff --git a/src/buildtool/build_engine/base_maps/entity_name_data.hpp b/src/buildtool/build_engine/base_maps/entity_name_data.hpp index a8d207ac..52ac1490 100644 --- a/src/buildtool/build_engine/base_maps/entity_name_data.hpp +++ b/src/buildtool/build_engine/base_maps/entity_name_data.hpp @@ -48,9 +48,9 @@ enum class ReferenceType : std::int8_t { }; struct NamedTarget { - std::string repository{}; - std::string module{}; - std::string name{}; + std::string repository; + std::string module; + std::string name; ReferenceType reference_t{ReferenceType::kTarget}; NamedTarget() = default; NamedTarget(std::string repository, diff --git a/src/buildtool/build_engine/base_maps/expression_function.hpp b/src/buildtool/build_engine/base_maps/expression_function.hpp index a5235807..379da7c2 100644 --- a/src/buildtool/build_engine/base_maps/expression_function.hpp +++ b/src/buildtool/build_engine/base_maps/expression_function.hpp @@ -112,9 +112,9 @@ class ExpressionFunction { Expression::FromJson(R"([{"type": "empty_map"}])"_json)); private: - std::vector<std::string> vars_{}; - imports_t imports_{}; - ExpressionPtr expr_{}; + std::vector<std::string> vars_; + imports_t imports_; + ExpressionPtr expr_; }; using ExpressionFunctionPtr = ExpressionFunction::Ptr; diff --git a/src/buildtool/build_engine/base_maps/module_name.hpp b/src/buildtool/build_engine/base_maps/module_name.hpp index 495254d8..58498240 100644 --- a/src/buildtool/build_engine/base_maps/module_name.hpp +++ b/src/buildtool/build_engine/base_maps/module_name.hpp @@ -24,8 +24,8 @@ namespace BuildMaps::Base { struct ModuleName { - std::string repository{}; - std::string module{}; + std::string repository; + std::string module; ModuleName(std::string repository, std::string module) : repository{std::move(repository)}, module{std::move(module)} {} diff --git a/src/buildtool/build_engine/base_maps/user_rule.hpp b/src/buildtool/build_engine/base_maps/user_rule.hpp index c8f5dc06..263dd30c 100644 --- a/src/buildtool/build_engine/base_maps/user_rule.hpp +++ b/src/buildtool/build_engine/base_maps/user_rule.hpp @@ -324,16 +324,16 @@ class UserRule { return expected_entries; } - std::vector<std::string> target_fields_{}; - std::vector<std::string> string_fields_{}; - std::vector<std::string> config_fields_{}; - implicit_t implicit_targets_{}; - implicit_exp_t implicit_target_exp_{}; - anonymous_defs_t anonymous_defs_{}; - std::vector<std::string> config_vars_{}; - std::set<std::string> tainted_{}; - config_trans_t config_transitions_{}; - ExpressionFunctionPtr expr_{}; + std::vector<std::string> target_fields_; + std::vector<std::string> string_fields_; + std::vector<std::string> config_fields_; + implicit_t implicit_targets_; + implicit_exp_t implicit_target_exp_; + anonymous_defs_t anonymous_defs_; + std::vector<std::string> config_vars_; + std::set<std::string> tainted_; + config_trans_t config_transitions_; + ExpressionFunctionPtr expr_; std::unordered_set<std::string> expected_entries_{ ComputeExpectedEntries(target_fields_, string_fields_, config_fields_)}; }; diff --git a/src/buildtool/build_engine/expression/expression.hpp b/src/buildtool/build_engine/expression/expression.hpp index eb2a3ca3..b28fec51 100644 --- a/src/buildtool/build_engine/expression/expression.hpp +++ b/src/buildtool/build_engine/expression/expression.hpp @@ -265,8 +265,8 @@ class Expression { map_t> data_{none_t{}}; - AtomicValue<std::string> hash_{}; - AtomicValue<bool> is_cachable_{}; + AtomicValue<std::string> hash_; + AtomicValue<bool> is_cachable_; template <class T, std::size_t kIndex = 0> requires(IsValidType<T>()) diff --git a/src/buildtool/build_engine/expression/target_result.hpp b/src/buildtool/build_engine/expression/target_result.hpp index eba780c4..4a698fc4 100644 --- a/src/buildtool/build_engine/expression/target_result.hpp +++ b/src/buildtool/build_engine/expression/target_result.hpp @@ -26,9 +26,9 @@ #include "src/utils/cpp/hash_combine.hpp" struct TargetResult { - ExpressionPtr artifact_stage{}; - ExpressionPtr provides{}; - ExpressionPtr runfiles{}; + ExpressionPtr artifact_stage; + ExpressionPtr provides; + ExpressionPtr runfiles; bool is_cacheable{provides.IsCacheable()}; [[nodiscard]] static auto FromJson(HashFunction::Type hash_type, diff --git a/src/buildtool/build_engine/target_map/result_map.hpp b/src/buildtool/build_engine/target_map/result_map.hpp index b73cdd48..c0babcb2 100644 --- a/src/buildtool/build_engine/target_map/result_map.hpp +++ b/src/buildtool/build_engine/target_map/result_map.hpp @@ -55,9 +55,9 @@ class ResultTargetMap { template <bool kIncludeOrigins = false> struct ResultType { - std::vector<ActionDescription::Ptr> actions{}; - std::vector<std::string> blobs{}; - std::vector<Tree::Ptr> trees{}; + std::vector<ActionDescription::Ptr> actions; + std::vector<std::string> blobs; + std::vector<Tree::Ptr> trees; }; explicit ResultTargetMap(std::size_t jobs) : width_{ComputeWidth(jobs)} {} @@ -398,9 +398,9 @@ class ResultTargetMap { template <> struct ResultTargetMap::ResultType</*kIncludeOrigins=*/true> { - std::vector<ActionWithOrigin> actions{}; - std::vector<std::string> blobs{}; - std::vector<Tree::Ptr> trees{}; + std::vector<ActionWithOrigin> actions; + std::vector<std::string> blobs; + std::vector<Tree::Ptr> trees; }; } // namespace BuildMaps::Target diff --git a/src/buildtool/common/action.hpp b/src/buildtool/common/action.hpp index c134ae25..4a4be183 100644 --- a/src/buildtool/common/action.hpp +++ b/src/buildtool/common/action.hpp @@ -110,15 +110,15 @@ class Action { } private: - ActionIdentifier id_{}; - std::vector<std::string> command_{}; - std::string cwd_{}; - std::map<std::string, std::string> env_{}; + ActionIdentifier id_; + std::vector<std::string> command_; + std::string cwd_; + std::map<std::string, std::string> env_; bool is_tree_{}; - std::optional<std::string> may_fail_{}; + std::optional<std::string> may_fail_; bool no_cache_{}; double timeout_scale_{}; - std::map<std::string, std::string> execution_properties_{}; + std::map<std::string, std::string> execution_properties_; explicit Action(ActionIdentifier id) noexcept : id_{std::move(id)}, is_tree_{true} {} diff --git a/src/buildtool/common/artifact.hpp b/src/buildtool/common/artifact.hpp index 1ef169d3..07c508c2 100644 --- a/src/buildtool/common/artifact.hpp +++ b/src/buildtool/common/artifact.hpp @@ -37,7 +37,7 @@ class Artifact { public: struct ObjectInfo { - ArtifactDigest digest{}; + ArtifactDigest digest; ObjectType type{}; bool failed{}; @@ -199,10 +199,10 @@ class Artifact { } private: - ArtifactIdentifier id_{}; - std::optional<std::filesystem::path> file_path_{}; - std::string repo_{}; - mutable std::optional<ObjectInfo> object_info_{}; + ArtifactIdentifier id_; + std::optional<std::filesystem::path> file_path_; + std::string repo_; + mutable std::optional<ObjectInfo> object_info_; Artifact(ArtifactIdentifier id, std::filesystem::path const& file_path, diff --git a/src/buildtool/common/artifact_digest.hpp b/src/buildtool/common/artifact_digest.hpp index f02b161d..3bd59e07 100644 --- a/src/buildtool/common/artifact_digest.hpp +++ b/src/buildtool/common/artifact_digest.hpp @@ -51,7 +51,7 @@ class ArtifactDigest final { } private: - HashInfo hash_info_{}; + HashInfo hash_info_; std::size_t size_ = 0; }; diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index 520b8ff3..0571acb8 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -43,36 +43,36 @@ inline constexpr auto kMaxOpCacheExponent = std::uint8_t{63}; /// \brief Arguments common to all commands. struct CommonArguments { - std::optional<std::filesystem::path> workspace_root{}; - std::optional<std::filesystem::path> repository_config{}; - std::optional<std::string> main{}; + std::optional<std::filesystem::path> workspace_root; + std::optional<std::filesystem::path> repository_config; + std::optional<std::string> main; std::size_t jobs{std::max(1U, std::thread::hardware_concurrency())}; }; struct LogArguments { - std::vector<std::filesystem::path> log_files{}; + std::vector<std::filesystem::path> log_files; LogLevel log_limit{kDefaultLogLevel}; - std::optional<LogLevel> restrict_stderr_log_limit{}; + std::optional<LogLevel> restrict_stderr_log_limit; bool plain_log{false}; bool log_append{false}; }; /// \brief Arguments required for analysing targets. struct AnalysisArguments { - std::optional<std::size_t> expression_log_limit{}; - std::vector<std::string> defines{}; - std::filesystem::path config_file{}; - std::optional<nlohmann::json> target{}; - std::optional<std::string> request_action_input{}; - std::optional<std::string> target_file_name{}; - std::optional<std::string> rule_file_name{}; - std::optional<std::string> expression_file_name{}; - std::optional<std::filesystem::path> target_root{}; - std::optional<std::filesystem::path> rule_root{}; - std::optional<std::filesystem::path> expression_root{}; - std::optional<std::filesystem::path> graph_file{}; - std::optional<std::filesystem::path> artifacts_to_build_file{}; - std::optional<std::filesystem::path> serve_errors_file{}; + std::optional<std::size_t> expression_log_limit; + std::vector<std::string> defines; + std::filesystem::path config_file; + std::optional<nlohmann::json> target; + std::optional<std::string> request_action_input; + std::optional<std::string> target_file_name; + std::optional<std::string> rule_file_name; + std::optional<std::string> expression_file_name; + std::optional<std::filesystem::path> target_root; + std::optional<std::filesystem::path> rule_root; + std::optional<std::filesystem::path> expression_root; + std::optional<std::filesystem::path> graph_file; + std::optional<std::filesystem::path> artifacts_to_build_file; + std::optional<std::filesystem::path> serve_errors_file; }; /// \brief Arguments required for describing targets/rules. @@ -98,10 +98,10 @@ struct DiagnosticArguments { /// \brief Arguments required for specifying build endpoint. struct EndpointArguments { - std::optional<std::filesystem::path> local_root{}; + std::optional<std::filesystem::path> local_root; std::optional<std::string> remote_execution_address; std::vector<std::string> platform_properties; - std::optional<std::filesystem::path> remote_execution_dispatch_file{}; + std::optional<std::filesystem::path> remote_execution_dispatch_file; }; /// \brief Arguments required for building. @@ -122,21 +122,21 @@ struct TCArguments { /// \brief Arguments required for staging. struct StageArguments { - std::filesystem::path output_dir{}; + std::filesystem::path output_dir; bool remember{false}; }; /// \brief Arguments required for rebuilding. struct RebuildArguments { - std::optional<std::string> cache_endpoint{}; - std::optional<std::filesystem::path> dump_flaky{}; + std::optional<std::string> cache_endpoint; + std::optional<std::filesystem::path> dump_flaky; }; /// \brief Arguments for fetching artifacts from CAS. struct FetchArguments { - std::string object_id{}; - std::optional<std::filesystem::path> output_path{}; - std::optional<std::filesystem::path> sub_path{}; + std::string object_id; + std::optional<std::filesystem::path> output_path; + std::optional<std::filesystem::path> sub_path; bool remember{false}; bool raw_tree{}; bool archive{}; @@ -144,9 +144,9 @@ struct FetchArguments { /// \brief Arguments required for running from graph file. struct GraphArguments { - nlohmann::json artifacts{}; - std::filesystem::path graph_file{}; - std::optional<std::filesystem::path> git_cas{}; + nlohmann::json artifacts; + std::filesystem::path graph_file; + std::optional<std::filesystem::path> git_cas; }; // Arguments for authentication methods. @@ -177,10 +177,10 @@ struct ServiceArguments { }; struct ServeArguments { - std::filesystem::path config{}; - std::optional<std::string> remote_serve_address{}; + std::filesystem::path config; + std::optional<std::string> remote_serve_address; // repositories populated from just-serve config file - std::vector<std::filesystem::path> repositories{}; + std::vector<std::filesystem::path> repositories; }; struct GcArguments { @@ -188,7 +188,7 @@ struct GcArguments { }; struct ToAddArguments { - std::filesystem::path location{}; + std::filesystem::path location; bool follow_symlinks{}; }; diff --git a/src/buildtool/common/git_hashes_converter.hpp b/src/buildtool/common/git_hashes_converter.hpp index c856b749..d1180244 100644 --- a/src/buildtool/common/git_hashes_converter.hpp +++ b/src/buildtool/common/git_hashes_converter.hpp @@ -76,8 +76,8 @@ class GitHashesConverter final { private: explicit GitHashesConverter() noexcept = default; - GitToCompatibleMap git_to_compatible_{}; - CompatibleToGitMap compatible_to_git_{}; + GitToCompatibleMap git_to_compatible_; + CompatibleToGitMap compatible_to_git_; std::shared_mutex mutex_; }; diff --git a/src/buildtool/common/remote/remote_common.hpp b/src/buildtool/common/remote/remote_common.hpp index 9df0db5c..675f41b2 100644 --- a/src/buildtool/common/remote/remote_common.hpp +++ b/src/buildtool/common/remote/remote_common.hpp @@ -28,8 +28,8 @@ #include "src/utils/cpp/expected.hpp" struct ServerAddress { - std::string host{}; - Port port{}; + std::string host; + Port port; [[nodiscard]] auto ToJson() const noexcept -> nlohmann::json { return nlohmann::json( diff --git a/src/buildtool/common/repository_config.hpp b/src/buildtool/common/repository_config.hpp index a9d01e34..25d5ce4f 100644 --- a/src/buildtool/common/repository_config.hpp +++ b/src/buildtool/common/repository_config.hpp @@ -40,7 +40,7 @@ class RepositoryConfig { FileRoot target_root{workspace_root}; FileRoot rule_root{target_root}; FileRoot expression_root{rule_root}; - std::map<std::string, std::string> name_mapping{}; + std::map<std::string, std::string> name_mapping; std::string target_file_name{"TARGETS"}; std::string rule_file_name{"RULES"}; std::string expression_file_name{"EXPRESSIONS"}; @@ -158,14 +158,14 @@ class RepositoryConfig { // Info structure (roots, file names, bindings) RepositoryInfo info{}; // Base description if content-fixed - std::optional<nlohmann::json> base_desc{}; + std::optional<nlohmann::json> base_desc; // Cache key if content-fixed - AtomicValue<std::optional<ArtifactDigest>> key{}; + AtomicValue<std::optional<ArtifactDigest>> key; }; std::unordered_map<std::string, RepositoryData> repos_; GitCASPtr git_cas_; - AtomicValue<duplicates_t> duplicates_{}; + AtomicValue<duplicates_t> duplicates_; template <class T> [[nodiscard]] auto Get(std::string const& repo, diff --git a/src/buildtool/common/retry_cli.hpp b/src/buildtool/common/retry_cli.hpp index a78c360e..5e6417ee 100644 --- a/src/buildtool/common/retry_cli.hpp +++ b/src/buildtool/common/retry_cli.hpp @@ -22,9 +22,9 @@ /// \brief Arguments required for tuning the retry strategy. struct RetryArguments { - std::optional<unsigned int> max_attempts{}; - std::optional<unsigned int> initial_backoff_seconds{}; - std::optional<unsigned int> max_backoff_seconds{}; + std::optional<unsigned int> max_attempts; + std::optional<unsigned int> initial_backoff_seconds; + std::optional<unsigned int> max_backoff_seconds; }; static inline void SetupRetryArguments( diff --git a/src/buildtool/common/statistics.hpp b/src/buildtool/common/statistics.hpp index ed2c3afb..7bbd8d8b 100644 --- a/src/buildtool/common/statistics.hpp +++ b/src/buildtool/common/statistics.hpp @@ -91,19 +91,19 @@ class Statistics { } private: - std::atomic<int> num_actions_queued_{}; - std::atomic<int> num_actions_executed_{}; - std::atomic<int> num_actions_cached_{}; - std::atomic<int> num_actions_flaky_{}; - std::atomic<int> num_actions_flaky_tainted_{}; - std::atomic<int> num_rebuilt_actions_missing_{}; - std::atomic<int> num_rebuilt_actions_compared_{}; - std::atomic<int> num_exports_cached_{}; - std::atomic<int> num_exports_uncached_{}; - std::atomic<int> num_exports_not_eligible_{}; - std::atomic<int> num_exports_found_{}; - std::atomic<int> num_exports_served_{}; - std::atomic<int> num_trees_analysed_{}; + std::atomic<int> num_actions_queued_; + std::atomic<int> num_actions_executed_; + std::atomic<int> num_actions_cached_; + std::atomic<int> num_actions_flaky_; + std::atomic<int> num_actions_flaky_tainted_; + std::atomic<int> num_rebuilt_actions_missing_; + std::atomic<int> num_rebuilt_actions_compared_; + std::atomic<int> num_exports_cached_; + std::atomic<int> num_exports_uncached_; + std::atomic<int> num_exports_not_eligible_; + std::atomic<int> num_exports_found_; + std::atomic<int> num_exports_served_; + std::atomic<int> num_trees_analysed_; }; #endif // INCLUDED_SRC_BUILDTOOL_COMMON_STATISTICS_HPP diff --git a/src/buildtool/common/user_structs.hpp b/src/buildtool/common/user_structs.hpp index bebd8fab..019d5925 100644 --- a/src/buildtool/common/user_structs.hpp +++ b/src/buildtool/common/user_structs.hpp @@ -57,8 +57,8 @@ struct LocalPaths { path = path.parent_path(); } }()}; - nlohmann::json git_checkout_locations{}; - std::vector<std::filesystem::path> distdirs{}; + nlohmann::json git_checkout_locations; + std::vector<std::filesystem::path> distdirs; }; struct CAInfo { diff --git a/src/buildtool/crypto/hasher.hpp b/src/buildtool/crypto/hasher.hpp index 4987f7bb..49e9eeec 100644 --- a/src/buildtool/crypto/hasher.hpp +++ b/src/buildtool/crypto/hasher.hpp @@ -61,7 +61,7 @@ class Hasher final { } private: - std::string bytes_{}; + std::string bytes_; explicit HashDigest(std::string bytes) : bytes_{std::move(bytes)} {} }; diff --git a/src/buildtool/execution_api/common/content_blob_container.hpp b/src/buildtool/execution_api/common/content_blob_container.hpp index f15187f1..1788d229 100644 --- a/src/buildtool/execution_api/common/content_blob_container.hpp +++ b/src/buildtool/execution_api/common/content_blob_container.hpp @@ -37,9 +37,9 @@ struct ContentBlob final { bool is_exec) noexcept : digest{std::move(mydigest)}, data(mydata), is_exec{is_exec} {} - TDigest digest{}; - std::shared_ptr<std::string> data{}; - bool is_exec{}; + TDigest digest; + std::shared_ptr<std::string> data; + bool is_exec = false; }; template <typename TDigest> diff --git a/src/buildtool/execution_api/execution_service/server_implementation.hpp b/src/buildtool/execution_api/execution_service/server_implementation.hpp index 0236b17d..1a5db508 100644 --- a/src/buildtool/execution_api/execution_service/server_implementation.hpp +++ b/src/buildtool/execution_api/execution_service/server_implementation.hpp @@ -58,8 +58,8 @@ class ServerImpl final { std::string interface_{"127.0.0.1"}; int port_{0}; - std::string info_file_{}; - std::string pid_file_{}; + std::string info_file_; + std::string pid_file_; }; #endif // SERVER_IMPLEMENATION_HPP diff --git a/src/buildtool/execution_api/local/local_action.cpp b/src/buildtool/execution_api/local/local_action.cpp index e2ee373c..85c0254b 100644 --- a/src/buildtool/execution_api/local/local_action.cpp +++ b/src/buildtool/execution_api/local/local_action.cpp @@ -53,7 +53,7 @@ class BuildCleanupAnchor { } private: - std::filesystem::path const build_path{}; + std::filesystem::path const build_path; }; [[nodiscard]] auto CreateDigestFromLocalOwnedTree( diff --git a/src/buildtool/execution_api/local/local_action.hpp b/src/buildtool/execution_api/local/local_action.hpp index d6ab0e58..96541f58 100644 --- a/src/buildtool/execution_api/local/local_action.hpp +++ b/src/buildtool/execution_api/local/local_action.hpp @@ -42,7 +42,7 @@ class LocalAction final : public IExecutionAction { public: struct Output { - bazel_re::ActionResult action{}; + bazel_re::ActionResult action; bool is_cached{}; }; @@ -65,12 +65,12 @@ class LocalAction final : public IExecutionAction { private: Logger logger_{"LocalExecution"}; LocalContext const& local_context_; - ArtifactDigest const root_digest_{}; - std::vector<std::string> const cmdline_{}; - std::string const cwd_{}; - std::vector<std::string> output_files_{}; - std::vector<std::string> output_dirs_{}; - std::map<std::string, std::string> const env_vars_{}; + ArtifactDigest const root_digest_; + std::vector<std::string> const cmdline_; + std::string const cwd_; + std::vector<std::string> output_files_; + std::vector<std::string> output_dirs_; + std::map<std::string, std::string> const env_vars_; std::vector<bazel_re::Platform_Property> const properties_; std::chrono::milliseconds timeout_{kDefaultTimeout}; CacheFlag cache_flag_{CacheFlag::CacheOutput}; diff --git a/src/buildtool/execution_api/local/local_response.hpp b/src/buildtool/execution_api/local/local_response.hpp index 1bb2480b..fbb58b28 100644 --- a/src/buildtool/execution_api/local/local_response.hpp +++ b/src/buildtool/execution_api/local/local_response.hpp @@ -92,7 +92,7 @@ class LocalResponse final : public IExecutionResponse { } private: - std::string action_id_{}; + std::string action_id_; LocalAction::Output output_{}; Storage const& storage_; ArtifactInfos artifacts_; 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 8378dd70..3d23c235 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp @@ -152,7 +152,7 @@ class BazelCasClient { std::string const& instance_name) const noexcept -> bool; private: - std::unique_ptr<ByteStreamClient> stream_{}; + std::unique_ptr<ByteStreamClient> stream_; RetryConfig const& retry_config_; std::unique_ptr<bazel_re::ContentAddressableStorage::Stub> stub_; Logger logger_{"RemoteCasClient"}; @@ -188,9 +188,9 @@ class BazelCasClient { template <typename T_Content> struct RetryProcessBatchResponse { bool ok{false}; - std::vector<T_Content> result{}; + std::vector<T_Content> result; bool exit_retry_loop{false}; - std::optional<std::string> error_msg{}; + std::optional<std::string> 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 cc423428..fd1ff5c1 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp @@ -37,11 +37,11 @@ class BazelExecutionClient { public: struct ExecutionOutput { - bazel_re::ActionResult action_result{}; + bazel_re::ActionResult action_result; bool cached_result{}; - grpc::Status status{}; - std::unordered_map<std::string, bazel_re::Digest> server_logs{}; - std::string message{}; + grpc::Status status; + std::unordered_map<std::string, bazel_re::Digest> server_logs; + std::string message; }; struct ExecutionResponse { @@ -53,7 +53,7 @@ class BazelExecutionClient { Retry }; - std::string execution_handle{}; + std::string execution_handle; State state{State::Unknown}; std::optional<ExecutionOutput> output{std::nullopt}; diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network.hpp b/src/buildtool/execution_api/remote/bazel/bazel_network.hpp index a744daaf..9a9f6139 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_network.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_network.hpp @@ -92,10 +92,10 @@ class BazelNetwork { -> std::optional<bazel_re::ActionResult>; private: - std::string const instance_name_{}; - std::unique_ptr<BazelCasClient> cas_{}; - std::unique_ptr<BazelAcClient> ac_{}; - std::unique_ptr<BazelExecutionClient> exec_{}; + std::string const instance_name_; + std::unique_ptr<BazelCasClient> cas_; + std::unique_ptr<BazelAcClient> ac_; + std::unique_ptr<BazelExecutionClient> exec_; ExecutionConfiguration exec_config_{}; HashFunction const& hash_function_; diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.hpp b/src/buildtool/execution_api/remote/bazel/bazel_response.hpp index 7c095645..86e7491c 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_response.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_response.hpp @@ -66,8 +66,8 @@ class BazelResponse final : public IExecutionResponse { -> expected<gsl::not_null<DirSymlinks const*>, std::string> final; private: - std::string action_id_{}; - std::shared_ptr<BazelNetwork> const network_{}; + std::string action_id_; + std::shared_ptr<BazelNetwork> const network_; BazelExecutionClient::ExecutionOutput output_{}; ArtifactInfos artifacts_; DirSymlinks dir_symlinks_; diff --git a/src/buildtool/execution_api/remote/config.cpp b/src/buildtool/execution_api/remote/config.cpp index c2832c1b..7a73eaa1 100644 --- a/src/buildtool/execution_api/remote/config.cpp +++ b/src/buildtool/execution_api/remote/config.cpp @@ -27,7 +27,7 @@ auto RemoteExecutionConfig::Builder::Build() const noexcept -> expected<RemoteExecutionConfig, std::string> { // To not duplicate default arguments in builder, create a default config // and copy arguments from there. - RemoteExecutionConfig const default_config; + RemoteExecutionConfig const default_config{}; // Set remote endpoint. auto remote_address = default_config.remote_address; diff --git a/src/buildtool/execution_api/remote/config.hpp b/src/buildtool/execution_api/remote/config.hpp index 45420c80..36e83fdd 100644 --- a/src/buildtool/execution_api/remote/config.hpp +++ b/src/buildtool/execution_api/remote/config.hpp @@ -29,16 +29,16 @@ struct RemoteExecutionConfig final { class Builder; // Server address of remote execution. - std::optional<ServerAddress> const remote_address = {}; + std::optional<ServerAddress> const remote_address; // Server dispatch data - std::vector<DispatchEndpoint> const dispatch = {}; + std::vector<DispatchEndpoint> const dispatch; // Server address of cache endpoint for rebuild. - std::optional<ServerAddress> const cache_address = {}; + std::optional<ServerAddress> const cache_address; // Platform properties for execution. - ExecutionProperties const platform_properties = {}; + ExecutionProperties const platform_properties; }; class RemoteExecutionConfig::Builder final { @@ -80,16 +80,16 @@ class RemoteExecutionConfig::Builder final { private: // Server address of remote execution; needs parsing. - std::optional<std::string> remote_address_raw_{}; + std::optional<std::string> remote_address_raw_; // Server dispatch data file; needs parsing. - std::optional<std::filesystem::path> dispatch_file_{}; + std::optional<std::filesystem::path> dispatch_file_; // Server address of cache endpoint for rebuild; needs parsing. - std::optional<std::string> cache_address_raw_{}; + std::optional<std::string> cache_address_raw_; // Platform properties for execution; needs parsing. - std::vector<std::string> platform_properties_raw_{}; + std::vector<std::string> platform_properties_raw_; }; #endif // INCLUDED_SRC_BUILDTOOL_EXECUTION_API_REMOTE_CONFIG_HPP diff --git a/src/buildtool/execution_engine/dag/dag.hpp b/src/buildtool/execution_engine/dag/dag.hpp index a61143f6..cd75fde4 100644 --- a/src/buildtool/execution_engine/dag/dag.hpp +++ b/src/buildtool/execution_engine/dag/dag.hpp @@ -490,17 +490,17 @@ class DependencyGraph : DirectedAcyclicGraph { private: // List of action nodes we already created - std::vector<ActionNode::Ptr> action_nodes_{}; + std::vector<ActionNode::Ptr> action_nodes_; // List of artifact nodes we already created - std::vector<ArtifactNode::Ptr> artifact_nodes_{}; + std::vector<ArtifactNode::Ptr> artifact_nodes_; // Associates global action identifier to local node id - std::unordered_map<ActionIdentifier, ActionNodeIdentifier> action_ids_{}; + std::unordered_map<ActionIdentifier, ActionNodeIdentifier> action_ids_; // Associates global artifact identifier to local node id std::unordered_map<ArtifactIdentifier, ArtifactNodeIdentifier> - artifact_ids_{}; + artifact_ids_; [[nodiscard]] auto CreateOutputArtifactNodes( std::string const& action_id, diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp index 3a416cfb..66790696 100644 --- a/src/buildtool/execution_engine/executor/executor.hpp +++ b/src/buildtool/execution_engine/executor/executor.hpp @@ -951,13 +951,13 @@ class Rebuilder { gsl::not_null<IExecutionApi::Ptr> const api_cached_; std::chrono::milliseconds timeout_; mutable std::mutex m_; - mutable std::vector<std::string> cache_misses_{}; + mutable std::vector<std::string> cache_misses_; mutable std::unordered_map< std::string, std::unordered_map< std::string, std::pair<Artifact::ObjectInfo, Artifact::ObjectInfo>>> - flaky_actions_{}; + flaky_actions_; [[nodiscard]] auto DetectFlakyAction( IExecutionResponse::Ptr const& response, diff --git a/src/buildtool/execution_engine/traverser/traverser.hpp b/src/buildtool/execution_engine/traverser/traverser.hpp index 8cfb991f..17ab7ac6 100644 --- a/src/buildtool/execution_engine/traverser/traverser.hpp +++ b/src/buildtool/execution_engine/traverser/traverser.hpp @@ -72,7 +72,7 @@ class Traverser { Executor const& runner_{}; DependencyGraph const& graph_; gsl::not_null<std::atomic<bool>*> failed_; - TaskSystem tasker_{}; // THIS SHOULD BE THE LAST MEMBER VARIABLE + TaskSystem tasker_; // THIS SHOULD BE THE LAST MEMBER VARIABLE // Visits discover nodes and queue visits to their children nodes. void Visit(gsl::not_null<DependencyGraph::ArtifactNode const*> diff --git a/src/buildtool/file_system/file_storage.hpp b/src/buildtool/file_system/file_storage.hpp index 221fe1dd..80aac0e0 100644 --- a/src/buildtool/file_system/file_storage.hpp +++ b/src/buildtool/file_system/file_storage.hpp @@ -90,7 +90,7 @@ class FileStorage { private: static constexpr bool kFdLess{kType == ObjectType::Executable}; - std::filesystem::path storage_root_{}; + std::filesystem::path storage_root_; /// \brief Add file to storage from file path via link or copy and rename. /// If a race-condition occurs, the winning thread will be the one diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp index 39dd3cf7..6e65fb59 100644 --- a/src/buildtool/file_system/file_system_manager.hpp +++ b/src/buildtool/file_system/file_system_manager.hpp @@ -93,7 +93,7 @@ class FileSystemManager { } private: - std::filesystem::path const kRestorePath{}; + std::filesystem::path const kRestorePath; DirectoryAnchor() : kRestorePath{FileSystemManager::GetCurrentDirectory()} {} diff --git a/src/buildtool/file_system/git_cas.hpp b/src/buildtool/file_system/git_cas.hpp index c1223411..e6eed664 100644 --- a/src/buildtool/file_system/git_cas.hpp +++ b/src/buildtool/file_system/git_cas.hpp @@ -64,12 +64,12 @@ class GitCAS { private: std::unique_ptr<git_odb, decltype(&odb_closer)> odb_{nullptr, odb_closer}; // git folder path of repo - std::filesystem::path git_path_{}; + std::filesystem::path git_path_; // mutex to guard odb while setting up a "fake" repository; it needs to be // uniquely owned while wrapping the odb, but then git operations are free // to share it. - mutable std::shared_mutex mutex_{}; + mutable std::shared_mutex mutex_; [[nodiscard]] auto OpenODB(std::filesystem::path const& repo_path) noexcept -> bool; diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp index 481c0461..4d5dfcb9 100644 --- a/src/buildtool/file_system/git_repo.cpp +++ b/src/buildtool/file_system/git_repo.cpp @@ -205,8 +205,8 @@ std::unordered_set<git_filemode_t> const kNonSpecialGitFileModes{ struct InMemoryODBBackend { git_odb_backend parent; - GitRepo::tree_entries_t const* entries{nullptr}; // object headers - std::unordered_map<std::string, std::string> trees{}; // solid tree objects + GitRepo::tree_entries_t const* entries{nullptr}; // object headers + std::unordered_map<std::string, std::string> trees; // solid tree objects }; [[nodiscard]] auto backend_read_header(size_t* len_p, diff --git a/src/buildtool/file_system/git_repo.hpp b/src/buildtool/file_system/git_repo.hpp index 942e97b7..0127c604 100644 --- a/src/buildtool/file_system/git_repo.hpp +++ b/src/buildtool/file_system/git_repo.hpp @@ -63,7 +63,7 @@ class GitRepo { // Stores the info of an object read by its path. struct TreeEntryInfo { - std::string id{}; + std::string id; ObjectType type; // if type is symlink, read it in advance std::optional<std::string> symlink_content{std::nullopt}; diff --git a/src/buildtool/file_system/git_tree.hpp b/src/buildtool/file_system/git_tree.hpp index f928b7d7..ac14e239 100644 --- a/src/buildtool/file_system/git_tree.hpp +++ b/src/buildtool/file_system/git_tree.hpp @@ -158,7 +158,7 @@ class GitTreeEntry { gsl::not_null<GitCASPtr> cas_; std::string raw_id_; ObjectType type_; - AtomicValue<std::optional<GitTree>> tree_cached_{}; + AtomicValue<std::optional<GitTree>> tree_cached_; }; using GitTreePtr = std::shared_ptr<GitTree const>; diff --git a/src/buildtool/file_system/symlinks_map/resolve_symlinks_map.hpp b/src/buildtool/file_system/symlinks_map/resolve_symlinks_map.hpp index fc706268..8145097d 100644 --- a/src/buildtool/file_system/symlinks_map/resolve_symlinks_map.hpp +++ b/src/buildtool/file_system/symlinks_map/resolve_symlinks_map.hpp @@ -37,7 +37,7 @@ /// resolved entries being made available in the target Git repository. struct GitObjectToResolve { // hash of the root tree - std::string root_tree_id{}; /* key */ + std::string root_tree_id; /* key */ // path of this object relative to root tree, in normal form std::filesystem::path rel_path{"."}; /* key */ // how the tree should be resolved @@ -47,11 +47,11 @@ struct GitObjectToResolve { std::optional<GitRepo::TreeEntryInfo> known_info{std::nullopt}; // object db to use as source of unresolved entries; it is guaranteed that // this repository is treated as read-only if it differs from target_cas - GitCASPtr source_cas{}; + GitCASPtr source_cas; // object db to use as target for resolved entries; can be the same as // source_cas and usually it is the Git cache; as the caller has access to // such a pointer, it reduces the overhead from opening the Git cache often - GitCASPtr target_cas{}; + GitCASPtr target_cas; GitObjectToResolve() = default; // needed for cycle detection only! diff --git a/src/buildtool/logging/log_config.hpp b/src/buildtool/logging/log_config.hpp index c37fc535..341189ce 100644 --- a/src/buildtool/logging/log_config.hpp +++ b/src/buildtool/logging/log_config.hpp @@ -26,10 +26,10 @@ /// The entire class is thread-safe. class LogConfig { struct ConfigData { - std::mutex mutex{}; + std::mutex mutex; LogLevel log_limit{LogLevel::Info}; - std::vector<ILogSink::Ptr> sinks{}; - std::vector<LogSinkFactory> factories{}; + std::vector<ILogSink::Ptr> sinks; + std::vector<LogSinkFactory> factories; }; public: diff --git a/src/buildtool/logging/log_sink_cmdline.hpp b/src/buildtool/logging/log_sink_cmdline.hpp index a30aee56..3740eb16 100644 --- a/src/buildtool/logging/log_sink_cmdline.hpp +++ b/src/buildtool/logging/log_sink_cmdline.hpp @@ -91,7 +91,7 @@ class LogSinkCmdLine final : public ILogSink { private: bool colored_{}; - std::optional<LogLevel> restrict_level_{}; + std::optional<LogLevel> restrict_level_; [[nodiscard]] auto FormatPrefix(LogLevel level, std::string const& prefix) const noexcept -> std::string { diff --git a/src/buildtool/logging/log_sink_file.hpp b/src/buildtool/logging/log_sink_file.hpp index 20bae2e6..f4d16099 100644 --- a/src/buildtool/logging/log_sink_file.hpp +++ b/src/buildtool/logging/log_sink_file.hpp @@ -59,8 +59,8 @@ class MutexMap { } private: - std::mutex mutex_{}; - std::unordered_map<T_Key, std::mutex> map_{}; + std::mutex mutex_; + std::unordered_map<T_Key, std::mutex> map_; }; class LogSinkFile final : public ILogSink { @@ -140,7 +140,7 @@ class LogSinkFile final : public ILogSink { } private: - std::string file_path_{}; + std::string file_path_; [[nodiscard]] static auto FileMutexes() noexcept -> MutexMap<std::string>& { static MutexMap<std::string> instance{}; diff --git a/src/buildtool/logging/logger.hpp b/src/buildtool/logging/logger.hpp index bc380e6a..32fd9fb0 100644 --- a/src/buildtool/logging/logger.hpp +++ b/src/buildtool/logging/logger.hpp @@ -148,9 +148,9 @@ class Logger { } private: - std::string name_{}; + std::string name_; LogLevel log_limit_{}; - std::vector<ILogSink::Ptr> sinks_{}; + std::vector<ILogSink::Ptr> sinks_; /// \brief Format message and forward to sinks. template <class... T_Args> diff --git a/src/buildtool/multithreading/async_map_consumer.hpp b/src/buildtool/multithreading/async_map_consumer.hpp index bc7f33ac..1f06b52f 100644 --- a/src/buildtool/multithreading/async_map_consumer.hpp +++ b/src/buildtool/multithreading/async_map_consumer.hpp @@ -142,10 +142,10 @@ class AsyncMapConsumer { private: using NodeRequests = std::unordered_map<Key, std::unordered_set<NodePtr>>; - std::shared_ptr<ValueCreator> value_creator_{}; - Map map_{}; - mutable std::shared_mutex requests_m_{}; - std::unordered_map<std::thread::id, NodeRequests> requests_by_thread_{}; + std::shared_ptr<ValueCreator> value_creator_; + Map map_; + mutable std::shared_mutex requests_m_; + std::unordered_map<std::thread::id, NodeRequests> requests_by_thread_; // Similar to previous methods, but in this case the logger and failure // function are already std::shared_ptr type. diff --git a/src/buildtool/multithreading/async_map_node.hpp b/src/buildtool/multithreading/async_map_node.hpp index 15687344..4cef35e9 100644 --- a/src/buildtool/multithreading/async_map_node.hpp +++ b/src/buildtool/multithreading/async_map_node.hpp @@ -170,10 +170,10 @@ class AsyncMapNode { private: Key key_; - std::optional<Value> value_{}; - std::vector<Task> awaiting_tasks_{}; - std::vector<Task> failure_tasks_{}; - std::mutex m_{}; + std::optional<Value> value_; + std::vector<Task> awaiting_tasks_; + std::vector<Task> failure_tasks_; + std::mutex m_; std::atomic<bool> is_queued_to_be_processed_{false}; bool failed_{false}; diff --git a/src/buildtool/multithreading/notification_queue.hpp b/src/buildtool/multithreading/notification_queue.hpp index f1c803e9..4483b5be 100644 --- a/src/buildtool/multithreading/notification_queue.hpp +++ b/src/buildtool/multithreading/notification_queue.hpp @@ -56,10 +56,10 @@ class WaitableZeroCounter { } private: - std::shared_mutex mutex_{}; - std::condition_variable_any cv_{}; - std::atomic<std::size_t> count_{}; - std::atomic<bool> done_{}; + std::shared_mutex mutex_; + std::condition_variable_any cv_; + std::atomic<std::size_t> count_; + std::atomic<bool> done_; [[nodiscard]] auto IsZero() noexcept -> bool { return count_ == 0 or done_; @@ -162,10 +162,10 @@ class NotificationQueue { } private: - std::deque<Task> queue_{}; + std::deque<Task> queue_; bool done_{false}; - std::mutex mutex_{}; - std::condition_variable ready_{}; + std::mutex mutex_; + std::condition_variable ready_; gsl::not_null<WaitableZeroCounter*> total_workload_; }; diff --git a/src/buildtool/multithreading/task.hpp b/src/buildtool/multithreading/task.hpp index a8c4591e..05331d75 100644 --- a/src/buildtool/multithreading/task.hpp +++ b/src/buildtool/multithreading/task.hpp @@ -47,7 +47,7 @@ class Task { explicit operator bool() const noexcept { return f_.operator bool(); } private: - TaskFunc f_{}; + TaskFunc f_; }; #endif // INCLUDED_SRC_BUILDTOOL_MULTITHREADING_TASK_HPP diff --git a/src/buildtool/multithreading/task_system.hpp b/src/buildtool/multithreading/task_system.hpp index 089dc3d8..95b4dedf 100644 --- a/src/buildtool/multithreading/task_system.hpp +++ b/src/buildtool/multithreading/task_system.hpp @@ -73,11 +73,11 @@ class TaskSystem { private: std::size_t const thread_count_{ std::max(1U, std::thread::hardware_concurrency())}; - std::vector<std::thread> threads_{}; - std::vector<NotificationQueue> queues_{}; + std::vector<std::thread> threads_; + std::vector<NotificationQueue> queues_; std::atomic<std::size_t> index_{0}; - std::atomic<bool> shutdown_{}; - WaitableZeroCounter total_workload_{}; + std::atomic<bool> shutdown_; + WaitableZeroCounter total_workload_; static constexpr std::size_t kNumberOfAttempts = 5; diff --git a/src/buildtool/progress_reporting/progress.hpp b/src/buildtool/progress_reporting/progress.hpp index f04a4657..21bd439b 100644 --- a/src/buildtool/progress_reporting/progress.hpp +++ b/src/buildtool/progress_reporting/progress.hpp @@ -47,7 +47,7 @@ class Progress { std::string, std::vector< std::pair<BuildMaps::Target::ConfiguredTarget, std::size_t>>> - origin_map_{}; + origin_map_; }; #endif // INCLUDED_SRC_BUILDTOOL_PROGRESS_REPORTING_PROGRESS_HPP diff --git a/src/buildtool/progress_reporting/task_tracker.hpp b/src/buildtool/progress_reporting/task_tracker.hpp index 7fdfce31..b02852d3 100644 --- a/src/buildtool/progress_reporting/task_tracker.hpp +++ b/src/buildtool/progress_reporting/task_tracker.hpp @@ -63,8 +63,8 @@ class TaskTracker { private: std::uint64_t prio_{}; - std::mutex m_{}; - std::unordered_map<std::string, std::uint64_t> running_{}; + std::mutex m_; + std::unordered_map<std::string, std::uint64_t> running_; }; #endif // INCLUDED_SRC_BUILDTOOL_PROGRESS_REPORTING_TASK_TRACKER_HPP diff --git a/src/buildtool/serve_api/remote/config.hpp b/src/buildtool/serve_api/remote/config.hpp index 005d56af..699f285a 100644 --- a/src/buildtool/serve_api/remote/config.hpp +++ b/src/buildtool/serve_api/remote/config.hpp @@ -34,10 +34,10 @@ struct RemoteServeConfig final { class Builder; // Server address of remote execution. - std::optional<ServerAddress> const remote_address{}; + std::optional<ServerAddress> const remote_address; // Known Git repositories to serve server. - std::vector<std::filesystem::path> const known_repositories{}; + std::vector<std::filesystem::path> const known_repositories; // Number of jobs std::size_t const jobs = 0; @@ -98,7 +98,7 @@ class RemoteServeConfig::Builder final { -> expected<RemoteServeConfig, std::string> { // To not duplicate default arguments of RemoteServeConfig in builder, // create a default config and copy default arguments from there. - RemoteServeConfig const default_config; + RemoteServeConfig const default_config{}; auto remote_address = default_config.remote_address; if (remote_address_.has_value()) { diff --git a/src/buildtool/serve_api/serve_service/serve_server_implementation.hpp b/src/buildtool/serve_api/serve_service/serve_server_implementation.hpp index 4e169696..b272628a 100644 --- a/src/buildtool/serve_api/serve_service/serve_server_implementation.hpp +++ b/src/buildtool/serve_api/serve_service/serve_server_implementation.hpp @@ -63,8 +63,8 @@ class ServeServerImpl final { std::string interface_{"127.0.0.1"}; int port_{0}; - std::string info_file_{}; - std::string pid_file_{}; + std::string info_file_; + std::string pid_file_; }; #endif // SERVE_SERVER_IMPLEMENTATION_HPP diff --git a/src/buildtool/storage/file_chunker.hpp b/src/buildtool/storage/file_chunker.hpp index 914de3f0..4a7e99e4 100644 --- a/src/buildtool/storage/file_chunker.hpp +++ b/src/buildtool/storage/file_chunker.hpp @@ -83,10 +83,10 @@ class FileChunker { const std::uint32_t min_chunk_size_{}; const std::uint32_t average_chunk_size_{}; const std::uint32_t max_chunk_size_{}; - std::ifstream stream_{}; // File stream to be splitted. - std::string buffer_{}; // Buffer for the file content. - std::size_t size_{0}; // Current size of the buffer. - std::size_t pos_{0}; // Current read position within the buffer. + std::ifstream stream_; // File stream to be splitted. + std::string buffer_; // Buffer for the file content. + std::size_t size_{0}; // Current size of the buffer. + std::size_t pos_{0}; // Current read position within the buffer. /// @brief Find the next chunk boundary from the current read position /// within the buffer. diff --git a/src/other_tools/git_operations/git_ops_types.hpp b/src/other_tools/git_operations/git_ops_types.hpp index 0b9f50c4..f36c18c3 100644 --- a/src/other_tools/git_operations/git_ops_types.hpp +++ b/src/other_tools/git_operations/git_ops_types.hpp @@ -26,8 +26,8 @@ /// \brief Common parameters for all critical Git operations struct GitOpParams { - std::filesystem::path target_path{}; /*key*/ - std::string git_hash{}; /*key*/ + std::filesystem::path target_path; /*key*/ + std::string git_hash; /*key*/ std::optional<std::string> message{ std::nullopt}; // mandatory for commits and tags std::optional<std::filesystem::path> source_path{ diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp index c7243588..7652ce32 100644 --- a/src/other_tools/just_mr/cli.hpp +++ b/src/other_tools/just_mr/cli.hpp @@ -42,7 +42,7 @@ struct MultiRepoCommonArguments { std::optional<std::filesystem::path> repository_config{std::nullopt}; std::optional<std::filesystem::path> absent_repository_file{std::nullopt}; std::optional<std::filesystem::path> checkout_locations_file{std::nullopt}; - std::vector<std::string> explicit_distdirs{}; + std::vector<std::string> explicit_distdirs; LocalPathsPtr just_mr_paths = std::make_shared<LocalPaths>(); MirrorsPtr alternative_mirrors = std::make_shared<Mirrors>(); std::optional<std::vector<std::string>> local_launcher{std::nullopt}; @@ -54,7 +54,7 @@ struct MultiRepoCommonArguments { std::optional<std::filesystem::path> dump_rc{std::nullopt}; bool norc{false}; std::size_t jobs{std::max(1U, std::thread::hardware_concurrency())}; - std::vector<std::string> defines{}; + std::vector<std::string> defines; std::optional<std::string> remote_execution_address; bool compatible{false}; std::optional<std::string> remote_serve_address; @@ -62,9 +62,9 @@ struct MultiRepoCommonArguments { }; struct MultiRepoLogArguments { - std::vector<std::filesystem::path> log_files{}; - std::optional<LogLevel> log_limit{}; - std::optional<LogLevel> restrict_stderr_log_limit{}; + std::vector<std::filesystem::path> log_files; + std::optional<LogLevel> log_limit; + std::optional<LogLevel> restrict_stderr_log_limit; bool plain_log{false}; bool log_append{false}; }; @@ -80,15 +80,15 @@ struct MultiRepoFetchArguments { }; struct MultiRepoUpdateArguments { - std::vector<std::string> repos_to_update{}; + std::vector<std::string> repos_to_update; }; struct MultiRepoJustSubCmdsArguments { std::optional<std::string> subcmd_name{std::nullopt}; - std::vector<std::string> additional_just_args{}; - std::unordered_map<std::string, std::vector<std::string>> just_args{}; - std::optional<std::filesystem::path> config{}; - std::optional<std::filesystem::path> endpoint_configuration{}; + std::vector<std::string> additional_just_args; + std::unordered_map<std::string, std::vector<std::string>> just_args; + std::optional<std::filesystem::path> config; + std::optional<std::filesystem::path> endpoint_configuration; }; // corresponding to the similarly-named arguments in 'just' @@ -99,7 +99,7 @@ struct MultiRepoRemoteAuthArguments { }; struct ForwardOnlyArguments { - std::vector<std::string> remote_execution_properties{}; + std::vector<std::string> remote_execution_properties; }; enum class SubCommand : std::uint8_t { diff --git a/src/other_tools/just_mr/mirrors.hpp b/src/other_tools/just_mr/mirrors.hpp index f3fa8b14..2e512e8c 100644 --- a/src/other_tools/just_mr/mirrors.hpp +++ b/src/other_tools/just_mr/mirrors.hpp @@ -27,8 +27,8 @@ #include "src/other_tools/utils/curl_url_handle.hpp" struct Mirrors { - nlohmann::json local_mirrors{}; // maps URLs to list of local mirrors - nlohmann::json preferred_hostnames{}; // list of mirror hostnames + nlohmann::json local_mirrors; // maps URLs to list of local mirrors + nlohmann::json preferred_hostnames; // list of mirror hostnames }; using MirrorsPtr = std::shared_ptr<Mirrors>; diff --git a/src/other_tools/ops_maps/content_cas_map.hpp b/src/other_tools/ops_maps/content_cas_map.hpp index 69f10dbc..ff5bf22c 100644 --- a/src/other_tools/ops_maps/content_cas_map.hpp +++ b/src/other_tools/ops_maps/content_cas_map.hpp @@ -35,14 +35,14 @@ #include "src/utils/cpp/hash_combine.hpp" struct ArchiveContent { - HashInfo content_hash{}; /* key */ + HashInfo content_hash; /* key */ std::optional<std::string> distfile{std::nullopt}; - std::string fetch_url{}; - std::vector<std::string> mirrors{}; + std::string fetch_url; + std::vector<std::string> mirrors; std::optional<std::string> sha256{std::nullopt}; std::optional<std::string> sha512{std::nullopt}; // name of repository for which work is done; used in progress reporting - std::string origin{}; + std::string origin; [[nodiscard]] auto operator==(const ArchiveContent& other) const -> bool { return content_hash.Hash() == other.content_hash.Hash(); @@ -51,9 +51,9 @@ struct ArchiveContent { // Used in callers of ContentCASMap which need extra fields struct ArchiveRepoInfo { - ArchiveContent archive{}; /* key */ - std::string repo_type{}; /* key */ - std::string subdir{}; /* key */ + ArchiveContent archive; /* key */ + std::string repo_type; /* key */ + std::string subdir; /* key */ // create root based on "special" pragma value std::optional<PragmaSpecial> pragma_special{std::nullopt}; /* key */ // create an absent root @@ -68,10 +68,10 @@ struct ArchiveRepoInfo { }; struct ForeignFileInfo { - ArchiveContent archive{}; /* key */ - std::string name{}; /* key */ - bool executable{}; /* key */ - bool absent{}; /* key */ + ArchiveContent archive; /* key */ + std::string name; /* key */ + bool executable{}; /* key */ + bool absent{}; /* key */ [[nodiscard]] auto operator==(const ForeignFileInfo& other) const -> bool { return archive == other.archive and name == other.name and diff --git a/src/other_tools/ops_maps/critical_git_op_map.hpp b/src/other_tools/ops_maps/critical_git_op_map.hpp index 8c75874c..73ee6a70 100644 --- a/src/other_tools/ops_maps/critical_git_op_map.hpp +++ b/src/other_tools/ops_maps/critical_git_op_map.hpp @@ -84,7 +84,7 @@ class CriticalGitOpGuard { } private: - std::unordered_map<size_t, GitOpKey> curr_critical_key_{}; + std::unordered_map<size_t, GitOpKey> curr_critical_key_; std::mutex critical_key_mutex_; }; diff --git a/src/other_tools/ops_maps/git_tree_fetch_map.hpp b/src/other_tools/ops_maps/git_tree_fetch_map.hpp index 04d28ea2..e5949099 100644 --- a/src/other_tools/ops_maps/git_tree_fetch_map.hpp +++ b/src/other_tools/ops_maps/git_tree_fetch_map.hpp @@ -33,12 +33,12 @@ // Stores all the information needed to make a Git tree available struct GitTreeInfo { - HashInfo tree_hash{}; /* key */ - std::map<std::string, std::string> env_vars{}; - std::vector<std::string> inherit_env{}; - std::vector<std::string> command{}; + HashInfo tree_hash; /* key */ + std::map<std::string, std::string> env_vars; + std::vector<std::string> inherit_env; + std::vector<std::string> command; // name of repository for which work is done; used in progress reporting - std::string origin{}; + std::string origin; [[nodiscard]] auto operator==(const GitTreeInfo& other) const -> bool { return tree_hash.Hash() == other.tree_hash.Hash(); diff --git a/src/other_tools/ops_maps/git_update_map.hpp b/src/other_tools/ops_maps/git_update_map.hpp index d30ebe07..3c36a4b4 100644 --- a/src/other_tools/ops_maps/git_update_map.hpp +++ b/src/other_tools/ops_maps/git_update_map.hpp @@ -30,9 +30,9 @@ #include "src/utils/cpp/hash_combine.hpp" struct RepoDescriptionForUpdating { - std::string repo{}; - std::string branch{}; - std::vector<std::string> inherit_env{}; /*non-key!*/ + std::string repo; + std::string branch; + std::vector<std::string> inherit_env; /*non-key!*/ [[nodiscard]] auto operator==(const RepoDescriptionForUpdating& other) const -> bool { diff --git a/src/other_tools/ops_maps/import_to_git_map.hpp b/src/other_tools/ops_maps/import_to_git_map.hpp index cd6fdbef..d0a59f3c 100644 --- a/src/other_tools/ops_maps/import_to_git_map.hpp +++ b/src/other_tools/ops_maps/import_to_git_map.hpp @@ -28,9 +28,9 @@ #include "src/utils/cpp/path_hash.hpp" struct CommitInfo { - std::filesystem::path target_path{}; /*key*/ - std::string repo_type{}; - std::string content{}; // hash or path + std::filesystem::path target_path; /*key*/ + std::string repo_type; + std::string content; // hash or path CommitInfo(std::filesystem::path const& target_path_, std::string repo_type_, diff --git a/src/other_tools/root_maps/commit_git_map.hpp b/src/other_tools/root_maps/commit_git_map.hpp index 1916ce13..1c5e9f6b 100644 --- a/src/other_tools/root_maps/commit_git_map.hpp +++ b/src/other_tools/root_maps/commit_git_map.hpp @@ -35,14 +35,14 @@ struct GitRepoInfo { // hash can be a commit or tree - std::string hash{}; /* key */ - std::string repo_url{}; - std::string branch{}; - std::string subdir{}; /* key */ - std::vector<std::string> inherit_env{}; - std::vector<std::string> mirrors{}; + std::string hash; /* key */ + std::string repo_url; + std::string branch; + std::string subdir; /* key */ + std::vector<std::string> inherit_env; + std::vector<std::string> mirrors; // name of repository for which work is done; used in progress reporting - std::string origin{}; + std::string origin; // create root that ignores symlinks bool ignore_special{}; /* key */ // create an absent root diff --git a/src/other_tools/root_maps/fpath_git_map.hpp b/src/other_tools/root_maps/fpath_git_map.hpp index d116496f..bfdfc384 100644 --- a/src/other_tools/root_maps/fpath_git_map.hpp +++ b/src/other_tools/root_maps/fpath_git_map.hpp @@ -33,7 +33,7 @@ #include "src/utils/cpp/path_hash.hpp" struct FpathInfo { - std::filesystem::path fpath{}; /* key */ + std::filesystem::path fpath; /* key */ // create root based on "special" pragma value std::optional<PragmaSpecial> pragma_special{std::nullopt}; /* key */ // create an absent root diff --git a/src/other_tools/root_maps/tree_id_git_map.hpp b/src/other_tools/root_maps/tree_id_git_map.hpp index 4276d143..faec4379 100644 --- a/src/other_tools/root_maps/tree_id_git_map.hpp +++ b/src/other_tools/root_maps/tree_id_git_map.hpp @@ -32,7 +32,7 @@ #include "src/utils/cpp/hash_combine.hpp" struct TreeIdInfo { - GitTreeInfo tree_info{}; /* key */ + GitTreeInfo tree_info; /* key */ // create root that ignores symlinks bool ignore_special{}; /* key */ // create an absent root diff --git a/src/other_tools/utils/curl_easy_handle.hpp b/src/other_tools/utils/curl_easy_handle.hpp index 81bcbed8..a3dd6e06 100644 --- a/src/other_tools/utils/curl_easy_handle.hpp +++ b/src/other_tools/utils/curl_easy_handle.hpp @@ -72,7 +72,7 @@ class CurlEasyHandle { private: // IMPORTANT: the CurlContext must to be initialized before any curl object! - CurlContext curl_context_{}; + CurlContext curl_context_; std::unique_ptr<CURL, decltype(&curl_easy_closer)> handle_{ nullptr, curl_easy_closer}; diff --git a/src/other_tools/utils/curl_url_handle.hpp b/src/other_tools/utils/curl_url_handle.hpp index 476277f3..6a7a7917 100644 --- a/src/other_tools/utils/curl_url_handle.hpp +++ b/src/other_tools/utils/curl_url_handle.hpp @@ -70,7 +70,7 @@ struct ConfigKeyMatchDegree { struct NoproxyPattern { // stores the substrings of the host portion of the pattern, obtained by // splitting with delimiter '.' - std::vector<std::string> host_tokens{}; + std::vector<std::string> host_tokens; // port number as string, or nullopt if port missing std::optional<std::string> port; }; @@ -163,7 +163,7 @@ class CurlURLHandle { private: // IMPORTANT: the CurlContext must be initialized before any curl // object! - CurlContext curl_context_{}; + CurlContext curl_context_; std::unique_ptr<CURLU, decltype(&curl_url_closer)> handle_{nullptr, curl_url_closer}; diff --git a/src/utils/automata/dfa_minimizer.hpp b/src/utils/automata/dfa_minimizer.hpp index 950635ac..5017b635 100644 --- a/src/utils/automata/dfa_minimizer.hpp +++ b/src/utils/automata/dfa_minimizer.hpp @@ -44,8 +44,8 @@ class DFAMinimizer { // Bucket of states with equal local properties (content and acceptance) struct Bucket { - std::vector<std::string> symbols{}; - states_t states{}; + std::vector<std::string> symbols; + states_t states; }; // Key used for state pairs. Reordering names will result in the same key. @@ -85,7 +85,7 @@ class DFAMinimizer { // Value of state pairs. struct StatePairValue { // Parent pairs depending on this pair's distinguishability - std::vector<StatePairValue*> parents{}; + std::vector<StatePairValue*> parents; // Distinguishability flag (true means distinguishable) bool marked{}; }; @@ -170,8 +170,8 @@ class DFAMinimizer { } private: - std::unordered_map<std::string, Bucket> buckets_{}; - std::unordered_map<std::string, std::string> buckets_by_state_{}; + std::unordered_map<std::string, Bucket> buckets_; + std::unordered_map<std::string, std::string> buckets_by_state_; template <class M, class K = typename M::key_type> [[nodiscard]] static auto GetKeys(M const& map) -> std::vector<K> { diff --git a/src/utils/cpp/atomic.hpp b/src/utils/cpp/atomic.hpp index b610a350..ec1c7dc0 100644 --- a/src/utils/cpp/atomic.hpp +++ b/src/utils/cpp/atomic.hpp @@ -88,8 +88,8 @@ class atomic { private: std::atomic<T> value_{}; - mutable std::shared_mutex mutex_{}; - mutable std::condition_variable_any cv_{}; + mutable std::shared_mutex mutex_; + mutable std::condition_variable_any cv_; }; // Atomic shared_pointer with notify/wait capabilities. @@ -134,8 +134,8 @@ class atomic_shared_ptr { private: ptr_t value_{}; - mutable std::shared_mutex mutex_{}; - mutable std::condition_variable_any cv_{}; + mutable std::shared_mutex mutex_; + mutable std::condition_variable_any cv_; }; #endif // INCLUDED_SRC_UTILS_CPP_ATOMIC_HPP diff --git a/src/utils/cpp/file_locking.hpp b/src/utils/cpp/file_locking.hpp index f8ac1443..abcca121 100644 --- a/src/utils/cpp/file_locking.hpp +++ b/src/utils/cpp/file_locking.hpp @@ -50,7 +50,7 @@ class LockFile { private: gsl::owner<FILE*> file_handle_{nullptr}; - std::filesystem::path lock_file_{}; + std::filesystem::path lock_file_; /// \brief Private ctor. Instances are only created by Acquire method. explicit LockFile(gsl::owner<FILE*> file_handle, diff --git a/src/utils/cpp/tmp_dir.hpp b/src/utils/cpp/tmp_dir.hpp index 9188fa60..bff73916 100644 --- a/src/utils/cpp/tmp_dir.hpp +++ b/src/utils/cpp/tmp_dir.hpp @@ -51,7 +51,7 @@ class TmpDir { -> TmpDirPtr; private: - std::filesystem::path tmp_dir_{}; + std::filesystem::path tmp_dir_; }; #endif // INCLUDED_SRC_OTHER_TOOLS_TMP_DIR_HPP diff --git a/test/buildtool/build_engine/expression/linked_map.test.cpp b/test/buildtool/build_engine/expression/linked_map.test.cpp index 4d0bf993..f6c3bd58 100644 --- a/test/buildtool/build_engine/expression/linked_map.test.cpp +++ b/test/buildtool/build_engine/expression/linked_map.test.cpp @@ -113,7 +113,7 @@ class CopyCounter { private: // all copies of this object share the same counter - std::shared_ptr<std::size_t> count_{}; + std::shared_ptr<std::size_t> count_; }; TEST_CASE("Zero copies", "[linked_map]") { @@ -218,7 +218,7 @@ class CustomContainer { [[nodiscard]] auto Map() & noexcept -> linked_map_t& { return map_; } private: - linked_map_t map_{}; + linked_map_t map_; }; TEST_CASE("Custom NextPtr", "[linked_map]") { diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp index 7eeee78f..59b06648 100644 --- a/test/buildtool/execution_engine/executor/executor.test.cpp +++ b/test/buildtool/execution_engine/executor/executor.test.cpp @@ -52,7 +52,7 @@ struct TestApiConfig { struct TestExecutionConfig { bool failed{}; - std::vector<std::string> outputs{}; + std::vector<std::string> outputs; }; struct TestResponseConfig { @@ -60,7 +60,7 @@ struct TestApiConfig { int exit_code{}; }; - std::unordered_map<std::string, TestArtifactConfig> artifacts{}; + std::unordered_map<std::string, TestArtifactConfig> artifacts; TestExecutionConfig execution; TestResponseConfig response; }; diff --git a/test/buildtool/execution_engine/traverser/traverser.test.cpp b/test/buildtool/execution_engine/traverser/traverser.test.cpp index 3fb57871..a6fb2c85 100644 --- a/test/buildtool/execution_engine/traverser/traverser.test.cpp +++ b/test/buildtool/execution_engine/traverser/traverser.test.cpp @@ -95,11 +95,11 @@ class TestBuildInfo { } private: - std::unordered_set<ArtifactIdentifier> correctly_built_{}; - std::unordered_set<ArtifactIdentifier> incorrectly_built_{}; - std::unordered_set<ArtifactIdentifier> artifacts_uploaded_{}; - std::unordered_set<ArtifactIdentifier> uploaded_more_than_once_{}; - std::string name_{}; + std::unordered_set<ArtifactIdentifier> correctly_built_; + std::unordered_set<ArtifactIdentifier> incorrectly_built_; + std::unordered_set<ArtifactIdentifier> artifacts_uploaded_; + std::unordered_set<ArtifactIdentifier> uploaded_more_than_once_; + std::string name_; std::mutex mutex_; }; @@ -218,9 +218,9 @@ class TestProject { } private: - std::vector<ActionDescription> graph_full_description_{}; - std::unordered_set<ArtifactIdentifier> artifacts_to_be_built_{}; - std::unordered_set<ArtifactIdentifier> local_artifacts_{}; + std::vector<ActionDescription> graph_full_description_; + std::unordered_set<ArtifactIdentifier> artifacts_to_be_built_; + std::unordered_set<ArtifactIdentifier> local_artifacts_; }; } // namespace diff --git a/test/buildtool/graph_traverser/graph_traverser.test.hpp b/test/buildtool/graph_traverser/graph_traverser.test.hpp index cb9cb57c..a9839638 100644 --- a/test/buildtool/graph_traverser/graph_traverser.test.hpp +++ b/test/buildtool/graph_traverser/graph_traverser.test.hpp @@ -56,8 +56,8 @@ class TestProject { public: struct CommandLineArguments { GraphTraverser::CommandLineArguments gtargs; - nlohmann::json artifacts{}; - std::filesystem::path graph_description{}; + nlohmann::json artifacts; + std::filesystem::path graph_description; explicit CommandLineArguments( GraphTraverser::CommandLineArguments gtargs) @@ -111,8 +111,8 @@ class TestProject { "test/buildtool/graph_traverser/data/"; static inline std::string const kDefaultEntryPointsFileName = "_entry_points"; - std::string example_name_{}; - std::filesystem::path root_dir_{}; + std::string example_name_; + std::filesystem::path root_dir_; RepositoryConfig repo_config_{}; void SetupConfig() { diff --git a/test/buildtool/logging/logger.test.cpp b/test/buildtool/logging/logger.test.cpp index 474a656f..e0abd13a 100644 --- a/test/buildtool/logging/logger.test.cpp +++ b/test/buildtool/logging/logger.test.cpp @@ -27,8 +27,8 @@ // Stores prints from test sink instances class TestPrints { struct PrintData { - std::atomic<int> counter{}; - std::unordered_map<int, std::vector<std::string>> prints{}; + std::atomic<int> counter; + std::unordered_map<int, std::vector<std::string>> prints; }; public: diff --git a/test/buildtool/multithreading/task_system.test.cpp b/test/buildtool/multithreading/task_system.test.cpp index fb6bbd1f..36b1cc14 100644 --- a/test/buildtool/multithreading/task_system.test.cpp +++ b/test/buildtool/multithreading/task_system.test.cpp @@ -92,10 +92,10 @@ TEST_CASE("Side effects of tasks are reflected out of ts", "[task_system]") { SECTION("Lambda capturing `this` inside struct") { std::string ext_name{}; struct Wrapper { - std::string name{}; + std::string name; // ts must be second, otherwise name will get destroyed before the // task system is finished. - TaskSystem ts{}; + TaskSystem ts; explicit Wrapper(std::string n) : name{std::move(n)} {} |