]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
chore: Enable and fix some more warnings
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 27 Feb 2023 18:22:45 +0000 (19:22 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 4 Mar 2023 09:10:18 +0000 (10:10 +0100)
cmake/DevModeWarnings.cmake
src/Util.cpp
src/core/CacheEntry.cpp
src/core/Manifest.cpp
src/core/ResultRetriever.cpp

index acc32b79807b9787e95fc07243c9f622dae26b89..f5f8e2a52f1bdf285ba161cc442db3e806ea0b87 100644 (file)
@@ -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
 )
 
index 82afba8d8264837703dc1a9b7b5abb6224b5b5ac..e14d1b1e947689ed96aa4372405667a9bcc032f9 100644 (file)
@@ -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) {
index 2f4730e0ae2fda72d682a5203de0dd18a3949f7d..fb1c1e3c18dfb21ce5628da0c100d1ee0168c41c 100644 (file)
@@ -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
index 19093c0290e40ec559a2f0b897ac348139b9f2cd..5ee94a750ffd4e46b7ad931b644943cd056ed6a7 100644 (file)
@@ -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();
   }
 };
 
index 0aecc17d1b256158dc9a52d807ffb7775cb48bad..0a67cdcae5dea40d052cbdb62f412eb9cc534165 100644 (file)
@@ -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));
   };