summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2024-12-16 13:39:36 +0100
committerOliver Reiche <oliver.reiche@huawei.com>2024-12-19 16:17:46 +0100
commite2b6d9d3c41d162517019ee0bf9147e398a5b1fa (patch)
tree248f0a50ec1183836a8257580779cac79ccf51f5 /src
parent827f05a53cb831bd54166ee812752ae3cce2b69b (diff)
downloadjustbuild-e2b6d9d3c41d162517019ee0bf9147e398a5b1fa.tar.gz
Fix cause of minor warnings
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/common/remote/port.hpp4
-rw-r--r--src/buildtool/common/remote/remote_common.hpp9
-rw-r--r--src/buildtool/execution_api/remote/bazel/bazel_api.cpp2
-rw-r--r--src/buildtool/execution_engine/executor/executor.hpp2
-rw-r--r--src/buildtool/file_system/file_system_manager.hpp9
-rw-r--r--src/buildtool/file_system/symlinks_map/resolve_symlinks_map.cpp2
-rw-r--r--src/buildtool/main/main.cpp14
-rw-r--r--src/buildtool/storage/config.hpp2
-rw-r--r--src/other_tools/just_mr/setup_utils.cpp2
-rw-r--r--src/other_tools/utils/content.hpp10
-rw-r--r--src/utils/cpp/transformed_range.hpp2
11 files changed, 28 insertions, 30 deletions
diff --git a/src/buildtool/common/remote/port.hpp b/src/buildtool/common/remote/port.hpp
index 3cba855d..bfd4fa80 100644
--- a/src/buildtool/common/remote/port.hpp
+++ b/src/buildtool/common/remote/port.hpp
@@ -30,7 +30,7 @@
struct PortTag : TypeSafeArithmeticTag<std::uint16_t> {};
using Port = TypeSafeArithmetic<PortTag>;
-[[nodiscard]] static auto ParsePort(int const port_num) noexcept
+[[nodiscard]] static inline auto ParsePort(int const port_num) noexcept
-> std::optional<Port> {
try {
static constexpr int kMaxPortNumber{
@@ -44,7 +44,7 @@ using Port = TypeSafeArithmetic<PortTag>;
return std::nullopt;
}
-[[nodiscard]] static auto ParsePort(std::string const& port) noexcept
+[[nodiscard]] static inline auto ParsePort(std::string const& port) noexcept
-> std::optional<Port> {
try {
auto port_num = std::stoi(port);
diff --git a/src/buildtool/common/remote/remote_common.hpp b/src/buildtool/common/remote/remote_common.hpp
index cf35d9fc..0d41ad95 100644
--- a/src/buildtool/common/remote/remote_common.hpp
+++ b/src/buildtool/common/remote/remote_common.hpp
@@ -43,8 +43,8 @@ struct ServerAddress {
using ExecutionProperties = std::map<std::string, std::string>;
using DispatchEndpoint = std::pair<ExecutionProperties, ServerAddress>;
-[[nodiscard]] static auto ParseAddress(std::string const& address) noexcept
- -> std::optional<ServerAddress> {
+[[nodiscard]] static inline auto ParseAddress(
+ std::string const& address) noexcept -> std::optional<ServerAddress> {
std::istringstream iss(address);
std::string host;
std::string port;
@@ -58,7 +58,8 @@ using DispatchEndpoint = std::pair<ExecutionProperties, ServerAddress>;
return std::nullopt;
}
-[[nodiscard]] static auto ParseProperty(std::string const& property) noexcept
+[[nodiscard]] static inline auto ParseProperty(
+ std::string const& property) noexcept
-> std::optional<std::pair<std::string, std::string>> {
std::istringstream pss(property);
std::string key;
@@ -69,7 +70,7 @@ using DispatchEndpoint = std::pair<ExecutionProperties, ServerAddress>;
return std::make_pair(key, val);
}
-[[nodiscard]] static auto ParseDispatch(
+[[nodiscard]] static inline auto ParseDispatch(
std::string const& dispatch_info) noexcept
-> expected<std::vector<DispatchEndpoint>, std::string> {
nlohmann::json dispatch;
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp
index d523fbed..3a5fd860 100644
--- a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp
+++ b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp
@@ -183,7 +183,7 @@ namespace {
return std::nullopt;
}
return BazelBlobContainer{std::move(blobs)};
-};
+}
} // namespace
diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp
index 6983a4ac..db204fe6 100644
--- a/src/buildtool/execution_engine/executor/executor.hpp
+++ b/src/buildtool/execution_engine/executor/executor.hpp
@@ -682,7 +682,7 @@ class ExecutorImpl {
}
auto const has_err = response->HasStdErr();
auto const has_out = response->HasStdOut();
- auto build_message = [has_err, has_out, &logger, &action, &response]() {
+ auto build_message = [has_err, has_out, &action, &response]() {
using namespace std::string_literals;
auto message = ""s;
bool has_both = has_err and has_out;
diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp
index e5e73415..47f39ee9 100644
--- a/src/buildtool/file_system/file_system_manager.hpp
+++ b/src/buildtool/file_system/file_system_manager.hpp
@@ -1229,9 +1229,10 @@ class FileSystemManager {
ssize_t wlen{};
ssize_t written_len{};
while (written_len < len and
- (wlen = write(out.fd,
- buf.data() + written_len, // NOLINT
- len - written_len)) > 0) {
+ (wlen = write(
+ out.fd,
+ buf.data() + written_len, // NOLINT
+ static_cast<std::size_t>(len - written_len))) > 0) {
written_len += wlen;
}
if (wlen < 0) {
@@ -1260,7 +1261,7 @@ class FileSystemManager {
if (len < 0) {
return PackError(ERROR_WRITE_OUTPUT, errno);
}
- pos += len;
+ pos += static_cast<std::size_t>(len);
}
return 0;
}
diff --git a/src/buildtool/file_system/symlinks_map/resolve_symlinks_map.cpp b/src/buildtool/file_system/symlinks_map/resolve_symlinks_map.cpp
index 16556153..eeca5800 100644
--- a/src/buildtool/file_system/symlinks_map/resolve_symlinks_map.cpp
+++ b/src/buildtool/file_system/symlinks_map/resolve_symlinks_map.cpp
@@ -198,7 +198,7 @@ void ResolveKnownEntry(GitObjectToResolve const& obj,
GitRepo::tree_entries_t entries{};
auto num = resolved_entries.size();
entries.reserve(num);
- for (auto i = 0; i < num; ++i) {
+ for (std::size_t i = 0; i < num; ++i) {
auto const& p = children_info[i].rel_path;
entries[*FromHexString(resolved_entries[i]->id)]
.emplace_back(
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index 14da6846..a7bd14f8 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -26,6 +26,7 @@
#include <optional>
#include <set>
#include <string>
+#include <tuple>
#include <utility>
#include <variant>
#include <vector>
@@ -97,7 +98,6 @@
#include "src/buildtool/serve_api/serve_service/serve_server_implementation.hpp"
#include "src/buildtool/storage/backend_description.hpp"
#include "src/buildtool/storage/garbage_collector.hpp"
-#include "src/utils/cpp/gsl.hpp"
#endif // BOOTSTRAP_BUILD_TOOL
namespace {
@@ -245,7 +245,6 @@ void SetupFileChunker() {
/// \brief Write backend description (which determines the target cache shard)
/// to CAS.
void StoreTargetCacheShard(
- StorageConfig const& storage_config, // NOLINT(misc-unused-parameters)
Storage const& storage,
RemoteExecutionConfig const& remote_exec_config) noexcept {
auto backend_description =
@@ -256,8 +255,7 @@ void StoreTargetCacheShard(
Logger::Log(LogLevel::Error, backend_description.error());
std::exit(kExitFailure);
}
- [[maybe_unused]] auto id = storage.CAS().StoreBlob(*backend_description);
- EnsuresAudit(id and id->hash() == storage_config.backend_description_id);
+ std::ignore = storage.CAS().StoreBlob(*backend_description);
}
#endif // BOOTSTRAP_BUILD_TOOL
@@ -815,8 +813,7 @@ auto main(int argc, char* argv[]) -> int {
return kExitFailure;
}
auto const storage = Storage::Create(&*storage_config);
- StoreTargetCacheShard(
- *storage_config, storage, remote_exec_config);
+ StoreTargetCacheShard(storage, remote_exec_config);
// pack the local context instances to be passed as needed
LocalContext const local_context{
@@ -882,8 +879,7 @@ auto main(int argc, char* argv[]) -> int {
return kExitFailure;
}
auto const storage = Storage::Create(&*storage_config);
- StoreTargetCacheShard(
- *storage_config, storage, *remote_exec_config);
+ StoreTargetCacheShard(storage, *remote_exec_config);
// pack the local context instances to be passed as needed
LocalContext const local_context{
@@ -965,7 +961,7 @@ auto main(int argc, char* argv[]) -> int {
auto const storage = Storage::Create(&*storage_config);
#ifndef BOOTSTRAP_BUILD_TOOL
- StoreTargetCacheShard(*storage_config, storage, *remote_exec_config);
+ StoreTargetCacheShard(storage, *remote_exec_config);
#endif // BOOTSTRAP_BUILD_TOOL
auto jobs = arguments.build.build_jobs > 0 ? arguments.build.build_jobs
diff --git a/src/buildtool/storage/config.hpp b/src/buildtool/storage/config.hpp
index 7d3f13c7..55f79339 100644
--- a/src/buildtool/storage/config.hpp
+++ b/src/buildtool/storage/config.hpp
@@ -36,7 +36,7 @@
#include "src/utils/cpp/gsl.hpp"
#include "src/utils/cpp/tmp_dir.hpp"
-class StorageConfig;
+struct StorageConfig;
struct GenerationConfig final {
gsl::not_null<StorageConfig const*> const storage_config;
diff --git a/src/other_tools/just_mr/setup_utils.cpp b/src/other_tools/just_mr/setup_utils.cpp
index 417984ea..2ab0ebfa 100644
--- a/src/other_tools/just_mr/setup_utils.cpp
+++ b/src/other_tools/just_mr/setup_utils.cpp
@@ -218,7 +218,7 @@ auto ReadConfiguration(
absent_file_opt->string());
std::exit(kExitConfigError);
}
- absent_set.insert(repo);
+ absent_set.insert(repo.get<std::string>());
}
auto new_repos = nlohmann::json::object();
auto repos = config.value("repositories", nlohmann::json::object());
diff --git a/src/other_tools/utils/content.hpp b/src/other_tools/utils/content.hpp
index a644f5bd..6d42e060 100644
--- a/src/other_tools/utils/content.hpp
+++ b/src/other_tools/utils/content.hpp
@@ -33,8 +33,8 @@
/// \brief Fetches a file from the internet and stores its content in memory.
/// \returns the content.
-[[nodiscard]] static auto NetworkFetch(std::string const& fetch_url,
- CAInfoPtr const& ca_info) noexcept
+[[nodiscard]] static inline auto NetworkFetch(std::string const& fetch_url,
+ CAInfoPtr const& ca_info) noexcept
-> std::optional<std::string> {
auto curl_handle = CurlEasyHandle::Create(
ca_info->no_ssl_verify, ca_info->ca_bundle, LogLevel::Debug);
@@ -47,7 +47,7 @@
/// \brief Fetches a file from the internet and stores its content in memory.
/// Tries not only a given remote, but also all associated remote locations.
/// \returns The fetched data on success or an unexpected error as string.
-[[nodiscard]] static auto NetworkFetchWithMirrors(
+[[nodiscard]] static inline auto NetworkFetchWithMirrors(
std::string const& fetch_url,
std::vector<std::string> const& mirrors,
CAInfoPtr const& ca_info,
@@ -89,8 +89,8 @@
}
template <Hasher::HashType kType>
-[[nodiscard]] static auto GetContentHash(std::string const& data) noexcept
- -> std::string {
+[[nodiscard]] static inline auto GetContentHash(
+ std::string const& data) noexcept -> std::string {
auto hasher = Hasher::Create(kType);
hasher->Update(data);
auto digest = std::move(*hasher).Finalize();
diff --git a/src/utils/cpp/transformed_range.hpp b/src/utils/cpp/transformed_range.hpp
index 3d064d9c..f63f2325 100644
--- a/src/utils/cpp/transformed_range.hpp
+++ b/src/utils/cpp/transformed_range.hpp
@@ -93,7 +93,7 @@ class TransformedRange final {
[[nodiscard]] auto ToVector() const -> std::vector<Result> {
std::vector<Result> result;
- result.reserve(size());
+ result.reserve(gsl::narrow<std::size_t>(size()));
for (auto item : *this) {
result.emplace_back(std::move(item));
}