diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c0eeaf567e..3336960177 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ # repos: - repo: https://github.com/pre-commit/mirrors-clang-format - rev: 'v17.0.3' + rev: 'v18.1.8' hooks: - id: clang-format types_or: @@ -26,7 +26,6 @@ repos: rev: v0.6.13 hooks: - id: cmake-format - exclude: '^auxil/.*$' - repo: https://github.com/crate-ci/typos rev: v1.16.21 diff --git a/CHANGES b/CHANGES index a178e52314..fbb656d9c5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,20 @@ +7.1.0-dev.236 | 2024-09-03 10:18:32 +0200 + + * Remove pre-commit exclusions for clang-format (Benjamin Bannier, Corelight) + + We previously would ignore any files under `auxil/`. Since pre-commit + only formats files tracked in this repo, and `auxil/` today contains + only submodules this exclusion did not exclude anything; if however we + ever end up adding C++ files under `auxil/` we would like them to be + formatted consistently. + + * Bump clang-format (Benjamin Bannier, Corelight) + + This patch contains a bump of the configured clang-format version from + 17.0.3 to 18.1.8 and automatically generated C++ source updates. The + main difference we are seeing from this is fixes for previously + incomplete reformats. + 7.1.0-dev.233 | 2024-09-03 10:02:59 +0200 * Bump zeek-aux for zeek/zeek-aux#57 (Arne Welzel, Corelight) diff --git a/VERSION b/VERSION index 3f01442f9d..317eb9ef3e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.1.0-dev.233 +7.1.0-dev.236 diff --git a/src/DNS_Mgr.h b/src/DNS_Mgr.h index 7e063b28a3..8a2ea88831 100644 --- a/src/DNS_Mgr.h +++ b/src/DNS_Mgr.h @@ -77,14 +77,14 @@ public: * * @param name The resulting name from the lookup. */ - virtual void Resolved(const std::string& name){}; + virtual void Resolved(const std::string& name) {}; /** * Called when a name lookup finishes. * * @param addrs A table of the resulting addresses from the lookup. */ - virtual void Resolved(TableValPtr addrs){}; + virtual void Resolved(TableValPtr addrs) {}; /** * Generic callback method for all request types. diff --git a/src/IPAddr.h b/src/IPAddr.h index 4395954eab..70c5b2ce61 100644 --- a/src/IPAddr.h +++ b/src/IPAddr.h @@ -130,7 +130,7 @@ public: /** * Copy constructor. */ - IPAddr(const IPAddr& other) : in6(other.in6){}; + IPAddr(const IPAddr& other) : in6(other.in6) {}; /** * Destructor. diff --git a/src/Obj.h b/src/Obj.h index 492679cf3e..661527f3bf 100644 --- a/src/Obj.h +++ b/src/Obj.h @@ -104,7 +104,7 @@ public: [[noreturn]] void Internal(const char* msg) const; void InternalWarning(const char* msg) const; - virtual void Describe(ODesc* d) const {/* FIXME: Add code */}; + virtual void Describe(ODesc* d) const { /* FIXME: Add code */ }; void AddLocation(ODesc* d) const; diff --git a/src/Type.h b/src/Type.h index e832cda652..f8c9e385f7 100644 --- a/src/Type.h +++ b/src/Type.h @@ -794,7 +794,7 @@ class OpaqueType final : public Type { public: explicit OpaqueType(const std::string& name); TypePtr ShallowClone() override { return make_intrusive(name); } - ~OpaqueType() override{}; + ~OpaqueType() override {}; const std::string& Name() const { return name; } diff --git a/src/analyzer/protocol/rpc/RPC.cc b/src/analyzer/protocol/rpc/RPC.cc index fb7520d130..8bc9c733cf 100644 --- a/src/analyzer/protocol/rpc/RPC.cc +++ b/src/analyzer/protocol/rpc/RPC.cc @@ -527,7 +527,7 @@ bool Contents_RPC::CheckResync(int& len, const u_char*& data, bool orig) { NeedResync(); return false; } // end switch - } // end while (len>0) + } // end while (len>0) return false; } @@ -623,7 +623,7 @@ void Contents_RPC::DeliverStream(int len, const u_char* data, bool orig) { // yet. } break; } // end switch - } // end while + } // end while } RPC_Analyzer::RPC_Analyzer(const char* name, Connection* conn, detail::RPC_Interpreter* arg_interp) diff --git a/src/file_analysis/analyzer/x509/X509Common.h b/src/file_analysis/analyzer/x509/X509Common.h index 1a301fd088..d310a20758 100644 --- a/src/file_analysis/analyzer/x509/X509Common.h +++ b/src/file_analysis/analyzer/x509/X509Common.h @@ -27,7 +27,7 @@ namespace detail { class X509Common : public file_analysis::Analyzer { public: - ~X509Common() override{}; + ~X509Common() override {}; /** * Retrieve an X509 extension value from an OpenSSL BIO to which it was diff --git a/src/fuzzers/generic-analyzer-fuzzer.cc b/src/fuzzers/generic-analyzer-fuzzer.cc index de465f42e5..d00273bda6 100644 --- a/src/fuzzers/generic-analyzer-fuzzer.cc +++ b/src/fuzzers/generic-analyzer-fuzzer.cc @@ -33,7 +33,7 @@ class Fuzzer { public: Fuzzer(TransportProto proto, const zeek::Tag& analyzer_tag) : proto{proto}, analyzer_tag{analyzer_tag} {} - virtual ~Fuzzer(){}; + virtual ~Fuzzer() {}; zeek::Connection* AddConnection() { static constexpr double network_time_start = 1439471031; diff --git a/src/logging/writers/none/None.h b/src/logging/writers/none/None.h index a32305d318..25f1724348 100644 --- a/src/logging/writers/none/None.h +++ b/src/logging/writers/none/None.h @@ -11,7 +11,7 @@ namespace zeek::logging::writer::detail { class None : public WriterBackend { public: explicit None(WriterFrontend* frontend) : WriterBackend(frontend) {} - ~None() override{}; + ~None() override {}; static WriterBackend* Instantiate(WriterFrontend* frontend) { return new None(frontend); } diff --git a/src/packet_analysis/Dispatcher.h b/src/packet_analysis/Dispatcher.h index cf1b25ec91..7068d9e808 100644 --- a/src/packet_analysis/Dispatcher.h +++ b/src/packet_analysis/Dispatcher.h @@ -19,7 +19,7 @@ namespace detail { */ class Dispatcher { public: - Dispatcher() : table(std::vector(1, nullptr)){}; + Dispatcher() : table(std::vector(1, nullptr)) {}; ~Dispatcher(); /** diff --git a/src/script_opt/CPP/RuntimeInitSupport.h b/src/script_opt/CPP/RuntimeInitSupport.h index 6f400a8d98..33625ea613 100644 --- a/src/script_opt/CPP/RuntimeInitSupport.h +++ b/src/script_opt/CPP/RuntimeInitSupport.h @@ -19,7 +19,7 @@ namespace detail { // with recursive types. class CPPTableType : public TableType { public: - CPPTableType() : TableType(nullptr, nullptr){}; + CPPTableType() : TableType(nullptr, nullptr) {}; void SetIndexAndYield(TypeListPtr ind, TypePtr yield) { indices = std::move(ind); diff --git a/src/util.cc b/src/util.cc index f20fab0453..a83d6d8d3e 100644 --- a/src/util.cc +++ b/src/util.cc @@ -1645,36 +1645,34 @@ FILE* open_file(const string& path, const string& mode) { return rval; } -TEST_CASE("util path ops"){ +TEST_CASE("util path ops") { #ifdef _MSC_VER // TODO: adapt these tests to Windows paths #else - SUBCASE("SafeDirname"){SafeDirname d("/this/is/a/path", false); -CHECK(d.result == "/this/is/a"); + SUBCASE("SafeDirname") { + SafeDirname d("/this/is/a/path", false); + CHECK(d.result == "/this/is/a"); -SafeDirname d2("invalid", false); -CHECK(d2.result == "."); + SafeDirname d2("invalid", false); + CHECK(d2.result == "."); -SafeDirname d3("./filename", false); -CHECK(d2.result == "."); -} + SafeDirname d3("./filename", false); + CHECK(d2.result == "."); + } -SUBCASE("SafeBasename") { - SafeBasename b("/this/is/a/path", false); - CHECK(b.result == "path"); - CHECK(! b.error); + SUBCASE("SafeBasename") { + SafeBasename b("/this/is/a/path", false); + CHECK(b.result == "path"); + CHECK(! b.error); - SafeBasename b2("justafile", false); - CHECK(b2.result == "justafile"); - CHECK(! b2.error); -} + SafeBasename b2("justafile", false); + CHECK(b2.result == "justafile"); + CHECK(! b2.error); + } #endif } -SafeDirname::SafeDirname(const char* path, bool error_aborts) - : SafePathOp() { - DoFunc(path ? path : "", error_aborts); -} +SafeDirname::SafeDirname(const char* path, bool error_aborts) : SafePathOp() { DoFunc(path ? path : "", error_aborts); } SafeDirname::SafeDirname(const string& path, bool error_aborts) : SafePathOp() { DoFunc(path, error_aborts); } @@ -2303,8 +2301,7 @@ static void strerror_r_helper(char* result, char* buf, size_t buflen) { buf[buflen - 1] = 0; } -static void strerror_r_helper(int result, char* buf, size_t buflen) { /* XSI flavor of strerror_r, no-op. */ -} +static void strerror_r_helper(int result, char* buf, size_t buflen) { /* XSI flavor of strerror_r, no-op. */ } void zeek_strerror_r(int zeek_errno, char* buf, size_t buflen) { #ifdef _MSC_VER