summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2023-02-27 19:22:45 +0100
committerJoel Rosdahl <joel@rosdahl.net>2023-03-04 10:10:18 +0100
commit35ab50c4ad632f1404312d08c1338bb83afbf077 (patch)
tree1853ef6299f9ac6294059704298d8cdbf2c2b432
parent66c9735cc1944b9e23fa0dc60cee6d759b22cebe (diff)
downloadccache-35ab50c4ad632f1404312d08c1338bb83afbf077.tar.gz
chore: Enable and fix some more warnings
-rw-r--r--cmake/DevModeWarnings.cmake8
-rw-r--r--src/Util.cpp4
-rw-r--r--src/core/CacheEntry.cpp6
-rw-r--r--src/core/Manifest.cpp8
-rw-r--r--src/core/ResultRetriever.cpp6
5 files changed, 16 insertions, 16 deletions
diff --git a/cmake/DevModeWarnings.cmake b/cmake/DevModeWarnings.cmake
index acc32b79..f5f8e2a5 100644
--- a/cmake/DevModeWarnings.cmake
+++ b/cmake/DevModeWarnings.cmake
@@ -34,19 +34,19 @@ endmacro()
set(
_clang_gcc_warnings
+ -Wcast-align
-Wextra
-Wnon-virtual-dtor
- -Wcast-align
- -Wunused
+ -Wnull-dereference
-Woverloaded-virtual
-Wpedantic
+ -Wshadow
+ -Wunused
# Candidates for enabling in the future:
- # -Wshadow
# -Wold-style-cast
# -Wconversion
# -Wsign-conversion
- # -Wnull-dereference
# -Wformat=2
)
diff --git a/src/Util.cpp b/src/Util.cpp
index 82afba8d..e14d1b1e 100644
--- a/src/Util.cpp
+++ b/src/Util.cpp
@@ -862,9 +862,9 @@ make_relative_path(const std::string& base_dir,
const auto path_suffix = std::string(original_path.substr(path.length()));
const auto real_path = Util::real_path(std::string(path));
- const auto add_relpath_candidates = [&](auto path) {
+ const auto add_relpath_candidates = [&](auto p) {
const std::string normalized_path =
- Util::normalize_abstract_absolute_path(path);
+ Util::normalize_abstract_absolute_path(p);
relpath_candidates.push_back(
Util::get_relative_path(actual_cwd, normalized_path));
if (apparent_cwd != actual_cwd) {
diff --git a/src/core/CacheEntry.cpp b/src/core/CacheEntry.cpp
index 2f4730e0..fb1c1e3c 100644
--- a/src/core/CacheEntry.cpp
+++ b/src/core/CacheEntry.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 Joel Rosdahl and other contributors
+// Copyright (C) 2022-2023 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
@@ -80,10 +80,10 @@ namespace core {
const uint8_t CacheEntry::k_format_version = 1;
CacheEntry::Header::Header(const Config& config,
- core::CacheEntryType entry_type)
+ core::CacheEntryType entry_type_)
: magic(k_ccache_magic),
entry_format_version(k_format_version),
- entry_type(entry_type),
+ entry_type(entry_type_),
compression_type(compression_type_from_config(config)),
compression_level(compression_level_from_config(config)),
self_contained(entry_type != CacheEntryType::result
diff --git a/src/core/Manifest.cpp b/src/core/Manifest.cpp
index 19093c02..5ee94a75 100644
--- a/src/core/Manifest.cpp
+++ b/src/core/Manifest.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2022 Joel Rosdahl and other contributors
+// Copyright (C) 2009-2023 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
@@ -66,9 +66,9 @@ template<> struct hash<core::Manifest::FileInfo>
operator()(const core::Manifest::FileInfo& file_info) const
{
static_assert(sizeof(file_info) == 48); // No padding.
- util::XXH3_64 hash;
- hash.update(&file_info, sizeof(file_info));
- return hash.digest();
+ util::XXH3_64 h;
+ h.update(&file_info, sizeof(file_info));
+ return h.digest();
}
};
diff --git a/src/core/ResultRetriever.cpp b/src/core/ResultRetriever.cpp
index 0aecc17d..0a67cdca 100644
--- a/src/core/ResultRetriever.cpp
+++ b/src/core/ResultRetriever.cpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2022 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2023 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
@@ -201,8 +201,8 @@ ResultRetriever::write_dependency_file(const std::string& path,
throw WriteError(FMT("Failed to open {} for writing", path));
}
- auto write_data = [&](auto data, auto size) {
- util::throw_on_error<WriteError>(util::write_fd(*fd, data, size),
+ auto write_data = [&](auto d, auto s) {
+ util::throw_on_error<WriteError>(util::write_fd(*fd, d, s),
FMT("Failed to write to {}: ", path));
};