Skip to content

Commit

Permalink
virtual d'tors: use '= default' instead of empty body
Browse files Browse the repository at this point in the history
Signed-off-by: Heiko Hund <[email protected]>
  • Loading branch information
d12fk committed Aug 13, 2024
1 parent f5db521 commit 3936778
Show file tree
Hide file tree
Showing 23 changed files with 27 additions and 81 deletions.
4 changes: 1 addition & 3 deletions client/ovpncli.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,7 @@ struct LogInfo
struct LogReceiver
{
virtual void log(const LogInfo &) = 0;
virtual ~LogReceiver()
{
}
virtual ~LogReceiver() = default;
};

// used to pass stats for an interface
Expand Down
4 changes: 1 addition & 3 deletions openvpn/apple/cf/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ class CFException : public std::exception
return errtxt;
}

virtual ~CFException() noexcept
{
}
virtual ~CFException() noexcept = default;

private:
void set_errtxt(const std::string &text, const OSStatus status)
Expand Down
4 changes: 1 addition & 3 deletions openvpn/apple/reach.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ struct ReachabilityInterface
virtual Status reachable() const = 0;
virtual bool reachableVia(const std::string &net_type) const = 0;
virtual std::string to_string() const = 0;
virtual ~ReachabilityInterface()
{
}
virtual ~ReachabilityInterface() = default;
};
} // namespace openvpn
#endif
4 changes: 1 addition & 3 deletions openvpn/apple/reachable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,7 @@ class ReachabilityBase
virtual Type vtype() const = 0;
virtual Status vstatus(const SCNetworkReachabilityFlags flags) const = 0;

virtual ~ReachabilityBase()
{
}
virtual ~ReachabilityBase() = default;

CF::NetworkReachability reach;
};
Expand Down
4 changes: 1 addition & 3 deletions openvpn/aws/awsrest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,7 @@ class REST
return date.substr(0, 8) + '/' + region + '/' + service + "/aws4_request";
}

virtual ~QueryBuilder()
{
}
virtual ~QueryBuilder() = default;
};
};
} // namespace openvpn::AWS
4 changes: 1 addition & 3 deletions openvpn/common/action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ struct Action : public RC<thread_unsafe_refcount>
throw Exception("Action::to_json() virtual method not implemented");
}
#endif
virtual ~Action()
{
}
virtual ~Action() = default;
};

class ActionList : public std::vector<Action::Ptr>, public DestructorBase
Expand Down
4 changes: 1 addition & 3 deletions openvpn/common/destruct.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ struct DestructorBase : public RC<thread_unsafe_refcount>
{
typedef RCPtr<DestructorBase> Ptr;
virtual void destroy(std::ostream &os) = 0;
virtual ~DestructorBase()
{
}
virtual ~DestructorBase() = default;
};

} // namespace openvpn
Expand Down
12 changes: 4 additions & 8 deletions openvpn/common/rc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,8 +989,8 @@ template <typename RCImpl>
class RCCopyable
{
public:
virtual ~RCCopyable(){};
RCCopyable() noexcept {};
virtual ~RCCopyable() = default;
RCCopyable() noexcept = default;
RCCopyable(const RCCopyable &) noexcept;
RCCopyable(RCCopyable &&) noexcept;
RCCopyable &operator=(const RCCopyable &) noexcept;
Expand Down Expand Up @@ -1318,13 +1318,9 @@ template <typename RCImpl>
class RCWeak<RCImpl>::NotifyBase
{
public:
NotifyBase() noexcept
{
}
NotifyBase() noexcept = default;
virtual void call() noexcept = 0;
virtual ~NotifyBase()
{
}
virtual ~NotifyBase() = default;
NotifyBase *next = nullptr;

private:
Expand Down
4 changes: 1 addition & 3 deletions openvpn/common/redir.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ struct RedirectBase
OPENVPN_EXCEPTION(redirect_std_err);
virtual void redirect() = 0;
virtual void close() = 0;
virtual ~RedirectBase()
{
}
virtual ~RedirectBase() = default;
};

struct RedirectStdFD : public RedirectBase
Expand Down
4 changes: 1 addition & 3 deletions openvpn/common/usergroup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ class SetUserGroup
}
}

virtual ~SetUserGroup()
{
}
virtual ~SetUserGroup() = default;

const std::string &user() const
{
Expand Down
8 changes: 2 additions & 6 deletions openvpn/error/excode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ class ExceptionCode : public std::exception
return code_ != 0;
}

virtual ~ExceptionCode() noexcept
{
}
virtual ~ExceptionCode() noexcept = default;

private:
static unsigned int mkcode(const Error::Type code, const bool fatal)
Expand All @@ -104,9 +102,7 @@ class ErrorCode : public ExceptionCode
return err_.c_str();
}

virtual ~ErrorCode() noexcept
{
}
virtual ~ErrorCode() noexcept = default;

private:
std::string err_;
Expand Down
6 changes: 1 addition & 5 deletions openvpn/ovpnagent/mac/ovpnagent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,9 @@ class MyClientInstance : public WS::Server::Listener::Client
MyClientInstance(WS::Server::Listener::Client::Initializer &ci)
: WS::Server::Listener::Client(ci)
{
// OPENVPN_LOG("INSTANCE START");
}

virtual ~MyClientInstance()
{
// OPENVPN_LOG("INSTANCE DESTRUCT");
}
virtual ~MyClientInstance() = default;

private:
void generate_reply(const Json::Value &jout)
Expand Down
6 changes: 1 addition & 5 deletions openvpn/ovpnagent/win/ovpnagent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,13 +549,9 @@ class MyClientInstance : public WS::Server::Listener::Client
MyClientInstance(WS::Server::Listener::Client::Initializer &ci)
: WS::Server::Listener::Client(ci)
{
// OPENVPN_LOG("INSTANCE START");
}

virtual ~MyClientInstance()
{
// OPENVPN_LOG("INSTANCE DESTRUCT");
}
virtual ~MyClientInstance() = default;

private:
void generate_reply(const Json::Value &jout)
Expand Down
4 changes: 1 addition & 3 deletions openvpn/pki/epkibase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ class ExternalPKIBase
// Return true on success or false on error.
virtual bool sign(const std::string &alias, const std::string &data, std::string &sig, const std::string &algorithm, const std::string &hashalg, const std::string &saltlen) = 0;

virtual ~ExternalPKIBase()
{
}
virtual ~ExternalPKIBase() = default;
};

class ExternalPKIImpl
Expand Down
4 changes: 1 addition & 3 deletions openvpn/ssl/proto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3949,9 +3949,7 @@ class ProtoContext : public logging::LoggingMixin<OPENVPN_DEBUG_PROTO,
return bool(primary);
}

virtual ~ProtoContext()
{
}
virtual ~ProtoContext() = default;

// return the PacketType of an incoming network packet
PacketType packet_type(const Buffer &buf)
Expand Down
4 changes: 1 addition & 3 deletions openvpn/ssl/sess_ticket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,7 @@ class TLSSessionTicketBase
// return string that identifies the app
virtual std::string session_id_context() const = 0;

virtual ~TLSSessionTicketBase()
{
}
virtual ~TLSSessionTicketBase() = default;

private:
static void b64_to_key(const std::string &b64, const char *title, unsigned char *out, const size_t outlen)
Expand Down
4 changes: 1 addition & 3 deletions openvpn/ssl/sni_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ class HandlerBase
SSLConfigAPI::Ptr default_factory) const = 0;
// clang-format on

virtual ~HandlerBase()
{
}
virtual ~HandlerBase() = default;
};

} // namespace openvpn::SNI
4 changes: 1 addition & 3 deletions openvpn/transport/client/extern/fw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ struct Config;
struct Factory
{
virtual TransportClientFactory *new_transport_factory(const Config &conf) = 0;
virtual ~Factory()
{
}
virtual ~Factory() = default;
};
#else
struct Factory
Expand Down
4 changes: 1 addition & 3 deletions openvpn/transport/client/transbase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ struct TransportClientParent
unsigned int &keepalive_timeout) = 0;
// clang-format on

virtual ~TransportClientParent()
{
}
virtual ~TransportClientParent() = default;
};

// Factory for client transport object.
Expand Down
4 changes: 1 addition & 3 deletions openvpn/transport/gremlin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ struct DelayedQueue : public RC<thread_unsafe_refcount>
{
virtual void call() = 0;
virtual const Time &fire_time() = 0;
virtual ~EventBase()
{
}
virtual ~EventBase() = default;
};

template <class F>
Expand Down
4 changes: 1 addition & 3 deletions openvpn/tun/builder/base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,7 @@ class TunBuilderBase
{
}

virtual ~TunBuilderBase()
{
}
virtual ~TunBuilderBase() = default;

#ifdef ENABLE_OVPNDCO
/**
Expand Down
4 changes: 1 addition & 3 deletions openvpn/tun/builder/setup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ struct Config
virtual Json::Value to_json() = 0;
virtual void from_json(const Json::Value &root, const std::string &title) = 0;
#endif
virtual ~Config()
{
}
virtual ~Config() = default;
};

struct Base : public DestructorBase
Expand Down
4 changes: 1 addition & 3 deletions openvpn/tun/extern/fw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ struct Config; // defined in config.hpp
struct Factory
{
virtual TunClientFactory *new_tun_factory(const Config &conf, const OptionList &opt) = 0;
virtual ~Factory()
{
}
virtual ~Factory() = default;
};
} // namespace ExternalTun

Expand Down

0 comments on commit 3936778

Please sign in to comment.