From 8c760266c8c736bff62055c008ab74d78f3ed82a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 19 Nov 2024 22:42:44 +0000 Subject: Tag hidden acquire classes as final for devirtualization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gcc reports `warning: Declaring type ‘class X’ final would enable devirtualization of Y calls [-Wsuggest-final-types]`. Not that this would massively improve performance, but it shouldn't hurt telling the compiler what is obvious for a human. --- methods/connect.cc | 4 ++-- methods/copy.cc | 2 +- methods/file.cc | 2 +- methods/http.cc | 2 +- methods/http.h | 4 ++-- methods/rred.cc | 2 +- methods/store.cc | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) (limited to 'methods') diff --git a/methods/connect.cc b/methods/connect.cc index f3e199d0a..12847c594 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -85,7 +85,7 @@ static bool ConnectionAllowed(char const * const Service, std::string const &Hos /*}}}*/ // File Descriptor based Fd /*{{{*/ -struct FdFd : public MethodFd +struct FdFd final : public MethodFd { int fd = -1; int Fd() APT_OVERRIDE { return fd; } @@ -805,7 +805,7 @@ ResultState UnwrapSocks(std::string Host, int Port, URI Proxy, std::unique_ptr UnderlyingFd; gnutls_session_t session; diff --git a/methods/copy.cc b/methods/copy.cc index 82eed150c..44205e4cd 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -24,7 +24,7 @@ #include /*}}}*/ -class CopyMethod : public aptMethod +class CopyMethod final : public aptMethod { virtual bool Fetch(FetchItem *Itm) APT_OVERRIDE; diff --git a/methods/file.cc b/methods/file.cc index b2fe133f2..0a76c0c94 100644 --- a/methods/file.cc +++ b/methods/file.cc @@ -27,7 +27,7 @@ #include /*}}}*/ -class FileMethod : public aptMethod +class FileMethod final : public aptMethod { virtual bool Fetch(FetchItem *Itm) APT_OVERRIDE; diff --git a/methods/http.cc b/methods/http.cc index 4d0e60d93..1e76a1f57 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -279,7 +279,7 @@ CircleBuf::~CircleBuf() /*{{{*/ // UnwrapHTTPConnect - Does the HTTP CONNECT handshake /*{{{*/ // --------------------------------------------------------------------- /* Performs a TLS handshake on the socket */ -struct HttpConnectFd : public MethodFd +struct HttpConnectFd final : public MethodFd { std::unique_ptr UnderlyingFd; std::string Buffer; diff --git a/methods/http.h b/methods/http.h index cae579afe..5bfcbc8a2 100644 --- a/methods/http.h +++ b/methods/http.h @@ -90,7 +90,7 @@ class CircleBuf ~CircleBuf(); }; -struct HttpServerState: public ServerState +struct HttpServerState final : public ServerState { // This is the connection itself. Output is data FROM the server CircleBuf In; @@ -121,7 +121,7 @@ struct HttpServerState: public ServerState virtual ~HttpServerState() {Close();}; }; -class HttpMethod : public BaseHttpMethod +class HttpMethod final : public BaseHttpMethod { public: virtual void SendReq(FetchItem *Itm) APT_OVERRIDE; diff --git a/methods/rred.cc b/methods/rred.cc index aeefea5a2..bef2e969e 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -598,7 +598,7 @@ class Patch { }; #ifndef APT_EXCLUDE_RRED_METHOD_CODE -class RredMethod : public aptMethod { +class RredMethod final : public aptMethod { private: bool Debug; diff --git a/methods/store.cc b/methods/store.cc index 23d6b43d0..ed2eb3fe1 100644 --- a/methods/store.cc +++ b/methods/store.cc @@ -31,7 +31,7 @@ #include /*}}}*/ -class StoreMethod : public aptMethod +class StoreMethod final : public aptMethod { virtual bool Fetch(FetchItem *Itm) APT_OVERRIDE; -- cgit v1.2.3-70-g09d2