]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
chore: Build with -Wextra-semi/-Wextra-semi-stmt and fix issues
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 1 Apr 2025 19:45:05 +0000 (21:45 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 1 Apr 2025 19:45:05 +0000 (21:45 +0200)
cmake/DevModeWarnings.cmake
src/ccache/ccache.cpp
src/ccache/core/exceptions.hpp
src/ccache/util/lockfile.cpp
src/ccache/util/logging.hpp
src/ccache/util/string.cpp

index f7f1b0c4513f81540f89619fa388aac6963c3ad9..cd89b7c973e0c690f205a508d504d06237a00219 100644 (file)
@@ -3,6 +3,7 @@ set(
   -Wcast-align
   -Wdouble-promotion
   -Wextra
+  -Wextra-semi
   -Wnon-virtual-dtor
   -Wnull-dereference
   -Woverloaded-virtual
@@ -33,6 +34,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
     )
   endif()
 
+  add_compile_flag_if_supported(CCACHE_COMPILER_WARNINGS "-Wextra-semi-stmt")
+
   # If compiler supports -Wshadow-field-in-constructor, disable only that.
   # Otherwise disable shadow.
   add_compile_flag_if_supported_ex(
index 97f296ec3fb86e596d697bc9799f736621c5e490..65ed0c7df7660af5c2f61ef09fd9c0975b2ae40b 100644 (file)
@@ -1882,7 +1882,7 @@ hash_argument(const Context& ctx,
       auto p = compopt_prefix_takes_path(args[i]);
       if (p) {
         path = *p;
-      };
+      }
     }
     if (path) {
       hash.hash_delimiter("path exists");
index b67bb153e1685e0735d8f6e819e29abb5c860c64..da0e28808e482fece963a5f091e0592c7bec2210 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2019-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2019-2025 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -57,6 +57,7 @@ class Fatal : public ErrorBase
     if (_result != 0) {                                                        \
       throw core::Fatal(FMT(#function " failed: {}", strerror(_result)));      \
     }                                                                          \
-  }
+  }                                                                            \
+  static_assert(true) /* allow semicolon after macro */
 
 } // namespace core
index 37afa1565bcc6e1ab3e9862ffa007d4c863d6a65..69388b9602efa2962bd0512bf79aa75017b31da0 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2025 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -64,7 +64,7 @@ public:
   get()
   {
     return m_distribution(m_random_engine);
-  };
+  }
 
 private:
   std::random_device m_random_device;
index f4a72f4107e584cb6cef33608324e31ad5a30ea8..51cfbb42df34a3b97d9122a88f0cb7e2642b8a03 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2024 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2025 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -42,7 +42,7 @@
 // least one placeholder without flushing and with a reused timestamp. `format`
 // is checked at compile time.
 #define BULK_LOG(logger_, format_, ...)                                        \
-  logger_.log(fmt::format(FMT_STRING(format_), __VA_ARGS__));
+  logger_.log(fmt::format(FMT_STRING(format_), __VA_ARGS__))
 
 namespace util::logging {
 
index b19d3aaef428d942d2a30ba4b670c25391be5362..4f63edb43084d9f23bfa7d0b35a59cb1afaab3b3 100644 (file)
@@ -243,7 +243,7 @@ parse_duration(std::string_view duration)
   auto value = parse_unsigned(duration.substr(0, duration.length() - 1));
   if (!value) {
     return value;
-  };
+  }
   return factor * *value;
 }