From 35ab50c4ad632f1404312d08c1338bb83afbf077 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Mon, 27 Feb 2023 19:22:45 +0100 Subject: chore: Enable and fix some more warnings --- cmake/DevModeWarnings.cmake | 8 ++++---- src/Util.cpp | 4 ++-- src/core/CacheEntry.cpp | 6 +++--- src/core/Manifest.cpp | 8 ++++---- src/core/ResultRetriever.cpp | 6 +++--- 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 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(util::write_fd(*fd, data, size), + auto write_data = [&](auto d, auto s) { + util::throw_on_error(util::write_fd(*fd, d, s), FMT("Failed to write to {}: ", path)); }; -- cgit v1.2.1