diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-04 11:21:11 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-04 16:05:08 +0200 |
commit | 74f53b444853850144c3e63593f83c424e84a768 (patch) | |
tree | 6bd2ca1c22f368c1f7c1b121ce205446a136fa45 /src/buildtool/execution_api/remote | |
parent | ce0f5420e60c4807cca3f57131ad24df8a6b9b4b (diff) | |
download | justbuild-74f53b444853850144c3e63593f83c424e84a768.tar.gz |
Mark more constructors 'explicit'
Since c++17 the 'explicit' keyword has use also for constructors
with more than one argument and it is recommended to use it by
default whereever implicit conversions are not expected bahaviour.
Diffstat (limited to 'src/buildtool/execution_api/remote')
7 files changed, 20 insertions, 18 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_ac_client.hpp b/src/buildtool/execution_api/remote/bazel/bazel_ac_client.hpp index 864d1254..8ec8b85f 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_ac_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_ac_client.hpp @@ -31,7 +31,7 @@ /// https://github.com/bazelbuild/remote-apis/blob/e1fe21be4c9ae76269a5a63215bb3c72ed9ab3f0/build/bazel/remote/execution/v2/remote_execution.proto#L144 class BazelAcClient { public: - BazelAcClient(std::string const& server, Port port) noexcept; + explicit BazelAcClient(std::string const& server, Port port) noexcept; [[nodiscard]] auto GetActionResult( std::string const& instance_name, diff --git a/src/buildtool/execution_api/remote/bazel/bazel_action.hpp b/src/buildtool/execution_api/remote/bazel/bazel_action.hpp index 5abfe57b..58e5965f 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_action.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_action.hpp @@ -50,13 +50,14 @@ class BazelAction final : public IExecutionAction { CacheFlag cache_flag_{CacheFlag::CacheOutput}; std::chrono::milliseconds timeout_{kDefaultTimeout}; - BazelAction(std::shared_ptr<BazelNetwork> network, - bazel_re::Digest root_digest, - std::vector<std::string> command, - std::vector<std::string> output_files, - std::vector<std::string> output_dirs, - std::map<std::string, std::string> const& env_vars, - std::map<std::string, std::string> const& properties) noexcept; + explicit BazelAction( + std::shared_ptr<BazelNetwork> network, + bazel_re::Digest root_digest, + std::vector<std::string> command, + std::vector<std::string> output_files, + std::vector<std::string> output_dirs, + std::map<std::string, std::string> const& env_vars, + std::map<std::string, std::string> const& properties) noexcept; [[nodiscard]] auto CreateBundlesForAction(BazelBlobContainer* blobs, bazel_re::Digest const& exec_dir, 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 391de317..69ee45d4 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_cas_client.hpp @@ -37,7 +37,7 @@ /// https://github.com/bazelbuild/remote-apis/blob/e1fe21be4c9ae76269a5a63215bb3c72ed9ab3f0/build/bazel/remote/execution/v2/remote_execution.proto#L317 class BazelCasClient { public: - BazelCasClient(std::string const& server, Port port) noexcept; + explicit BazelCasClient(std::string const& server, Port port) noexcept; /// \brief Find missing blobs /// \param[in] instance_name Name of the CAS instance 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 f2f25b71..cb933b99 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.hpp @@ -54,7 +54,8 @@ class BazelExecutionClient { } }; - BazelExecutionClient(std::string const& server, Port port) noexcept; + explicit BazelExecutionClient(std::string const& server, + Port port) noexcept; [[nodiscard]] auto Execute(std::string const& instance_name, bazel_re::Digest const& action_digest, diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network.hpp b/src/buildtool/execution_api/remote/bazel/bazel_network.hpp index 853efa41..a55fa064 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_network.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_network.hpp @@ -35,10 +35,10 @@ /// \brief Contains all network clients and is responsible for all network IO. class BazelNetwork { public: - BazelNetwork(std::string instance_name, - std::string const& host, - Port port, - ExecutionConfiguration const& exec_config) noexcept; + explicit BazelNetwork(std::string instance_name, + std::string const& host, + Port port, + ExecutionConfiguration const& exec_config) noexcept; /// \brief Check if digest exists in CAS /// \param[in] digest The digest to look up diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.hpp b/src/buildtool/execution_api/remote/bazel/bazel_response.hpp index 41957255..30a70d7f 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_response.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_response.hpp @@ -70,9 +70,9 @@ class BazelResponse final : public IExecutionResponse { DirSymlinks dir_symlinks_{}; bool populated_{false}; - BazelResponse(std::string action_id, - std::shared_ptr<BazelNetwork> network, - BazelExecutionClient::ExecutionOutput output) + explicit BazelResponse(std::string action_id, + std::shared_ptr<BazelNetwork> network, + BazelExecutionClient::ExecutionOutput output) : action_id_{std::move(action_id)}, network_{std::move(network)}, output_{std::move(output)} {} diff --git a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp index a6516e47..908f6e2a 100644 --- a/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp +++ b/src/buildtool/execution_api/remote/bazel/bytestream_client.hpp @@ -80,7 +80,7 @@ class ByteStreamClient { } }; - ByteStreamClient(std::string const& server, Port port) noexcept { + explicit ByteStreamClient(std::string const& server, Port port) noexcept { stub_ = google::bytestream::ByteStream::NewStub( CreateChannelWithCredentials(server, port)); } |