Bump clang-format

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.
This commit is contained in:
Benjamin Bannier 2024-09-02 16:46:59 +02:00
parent c27e18631c
commit db42b2cfe5
12 changed files with 32 additions and 35 deletions

View file

@ -3,7 +3,7 @@
# #
repos: repos:
- repo: https://github.com/pre-commit/mirrors-clang-format - repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v17.0.3' rev: 'v18.1.8'
hooks: hooks:
- id: clang-format - id: clang-format
types_or: types_or:

View file

@ -77,14 +77,14 @@ public:
* *
* @param name The resulting name from the lookup. * @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. * Called when a name lookup finishes.
* *
* @param addrs A table of the resulting addresses from the lookup. * @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. * Generic callback method for all request types.

View file

@ -130,7 +130,7 @@ public:
/** /**
* Copy constructor. * Copy constructor.
*/ */
IPAddr(const IPAddr& other) : in6(other.in6){}; IPAddr(const IPAddr& other) : in6(other.in6) {};
/** /**
* Destructor. * Destructor.

View file

@ -104,7 +104,7 @@ public:
[[noreturn]] void Internal(const char* msg) const; [[noreturn]] void Internal(const char* msg) const;
void InternalWarning(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; void AddLocation(ODesc* d) const;

View file

@ -794,7 +794,7 @@ class OpaqueType final : public Type {
public: public:
explicit OpaqueType(const std::string& name); explicit OpaqueType(const std::string& name);
TypePtr ShallowClone() override { return make_intrusive<OpaqueType>(name); } TypePtr ShallowClone() override { return make_intrusive<OpaqueType>(name); }
~OpaqueType() override{}; ~OpaqueType() override {};
const std::string& Name() const { return name; } const std::string& Name() const { return name; }

View file

@ -527,7 +527,7 @@ bool Contents_RPC::CheckResync(int& len, const u_char*& data, bool orig) {
NeedResync(); NeedResync();
return false; return false;
} // end switch } // end switch
} // end while (len>0) } // end while (len>0)
return false; return false;
} }
@ -623,7 +623,7 @@ void Contents_RPC::DeliverStream(int len, const u_char* data, bool orig) {
// yet. // yet.
} break; } break;
} // end switch } // end switch
} // end while } // end while
} }
RPC_Analyzer::RPC_Analyzer(const char* name, Connection* conn, detail::RPC_Interpreter* arg_interp) RPC_Analyzer::RPC_Analyzer(const char* name, Connection* conn, detail::RPC_Interpreter* arg_interp)

View file

@ -27,7 +27,7 @@ namespace detail {
class X509Common : public file_analysis::Analyzer { class X509Common : public file_analysis::Analyzer {
public: public:
~X509Common() override{}; ~X509Common() override {};
/** /**
* Retrieve an X509 extension value from an OpenSSL BIO to which it was * Retrieve an X509 extension value from an OpenSSL BIO to which it was

View file

@ -33,7 +33,7 @@ class Fuzzer {
public: public:
Fuzzer(TransportProto proto, const zeek::Tag& analyzer_tag) : proto{proto}, analyzer_tag{analyzer_tag} {} Fuzzer(TransportProto proto, const zeek::Tag& analyzer_tag) : proto{proto}, analyzer_tag{analyzer_tag} {}
virtual ~Fuzzer(){}; virtual ~Fuzzer() {};
zeek::Connection* AddConnection() { zeek::Connection* AddConnection() {
static constexpr double network_time_start = 1439471031; static constexpr double network_time_start = 1439471031;

View file

@ -11,7 +11,7 @@ namespace zeek::logging::writer::detail {
class None : public WriterBackend { class None : public WriterBackend {
public: public:
explicit None(WriterFrontend* frontend) : WriterBackend(frontend) {} explicit None(WriterFrontend* frontend) : WriterBackend(frontend) {}
~None() override{}; ~None() override {};
static WriterBackend* Instantiate(WriterFrontend* frontend) { return new None(frontend); } static WriterBackend* Instantiate(WriterFrontend* frontend) { return new None(frontend); }

View file

@ -19,7 +19,7 @@ namespace detail {
*/ */
class Dispatcher { class Dispatcher {
public: public:
Dispatcher() : table(std::vector<AnalyzerPtr>(1, nullptr)){}; Dispatcher() : table(std::vector<AnalyzerPtr>(1, nullptr)) {};
~Dispatcher(); ~Dispatcher();
/** /**

View file

@ -19,7 +19,7 @@ namespace detail {
// with recursive types. // with recursive types.
class CPPTableType : public TableType { class CPPTableType : public TableType {
public: public:
CPPTableType() : TableType(nullptr, nullptr){}; CPPTableType() : TableType(nullptr, nullptr) {};
void SetIndexAndYield(TypeListPtr ind, TypePtr yield) { void SetIndexAndYield(TypeListPtr ind, TypePtr yield) {
indices = std::move(ind); indices = std::move(ind);

View file

@ -1645,36 +1645,34 @@ FILE* open_file(const string& path, const string& mode) {
return rval; return rval;
} }
TEST_CASE("util path ops"){ TEST_CASE("util path ops") {
#ifdef _MSC_VER #ifdef _MSC_VER
// TODO: adapt these tests to Windows paths // TODO: adapt these tests to Windows paths
#else #else
SUBCASE("SafeDirname"){SafeDirname d("/this/is/a/path", false); SUBCASE("SafeDirname") {
CHECK(d.result == "/this/is/a"); SafeDirname d("/this/is/a/path", false);
CHECK(d.result == "/this/is/a");
SafeDirname d2("invalid", false); SafeDirname d2("invalid", false);
CHECK(d2.result == "."); CHECK(d2.result == ".");
SafeDirname d3("./filename", false); SafeDirname d3("./filename", false);
CHECK(d2.result == "."); CHECK(d2.result == ".");
} }
SUBCASE("SafeBasename") { SUBCASE("SafeBasename") {
SafeBasename b("/this/is/a/path", false); SafeBasename b("/this/is/a/path", false);
CHECK(b.result == "path"); CHECK(b.result == "path");
CHECK(! b.error); CHECK(! b.error);
SafeBasename b2("justafile", false); SafeBasename b2("justafile", false);
CHECK(b2.result == "justafile"); CHECK(b2.result == "justafile");
CHECK(! b2.error); CHECK(! b2.error);
} }
#endif #endif
} }
SafeDirname::SafeDirname(const char* path, bool error_aborts) SafeDirname::SafeDirname(const char* path, bool error_aborts) : SafePathOp() { DoFunc(path ? path : "", error_aborts); }
: SafePathOp() {
DoFunc(path ? path : "", error_aborts);
}
SafeDirname::SafeDirname(const string& path, bool error_aborts) : SafePathOp() { DoFunc(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; 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) { void zeek_strerror_r(int zeek_errno, char* buf, size_t buflen) {
#ifdef _MSC_VER #ifdef _MSC_VER