From c78ecdf579c0bf0a75ed0f9641ffef8d89c17ec8 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 25 Jan 2019 02:52:11 +0000 Subject: Replace the override macro with the override keyword. --- include/commands/cmd_whowas.h | 2 +- include/compat.h | 26 ------------------------- include/configreader.h | 2 +- include/ctables.h | 4 ++-- include/event.h | 4 ++-- include/extensible.h | 28 +++++++++++++-------------- include/filelogger.h | 2 +- include/inspsocket.h | 14 +++++++------- include/listmode.h | 10 +++++----- include/mode.h | 14 +++++++------- include/modules.h | 2 +- include/modules/cap.h | 8 ++++---- include/modules/dns.h | 2 +- include/modules/ircv3.h | 6 +++--- include/modules/shun.h | 6 +++--- include/parammode.h | 6 +++--- include/socket.h | 2 +- include/threadengine.h | 4 ++-- include/users.h | 28 +++++++++++++-------------- include/xline.h | 44 +++++++++++++++++++++---------------------- 20 files changed, 94 insertions(+), 120 deletions(-) (limited to 'include') diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h index dfeae1886..6da168eb0 100644 --- a/include/commands/cmd_whowas.h +++ b/include/commands/cmd_whowas.h @@ -203,5 +203,5 @@ class CommandWhowas : public Command * @param user The user issuing the command * @return A value from CmdResult to indicate command success or failure. */ - CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE; + CmdResult Handle(User* user, const Params& parameters) override; }; diff --git a/include/compat.h b/include/compat.h index 13ce70ac0..903a45b23 100644 --- a/include/compat.h +++ b/include/compat.h @@ -32,32 +32,6 @@ # define CUSTOM_PRINTF(stringpos, firstpos) #endif -/** - * These macros enable the use of the C++11 override control keywords in - * compilers which support them. - */ -#if __cplusplus >= 201103L -# define HAS_CXX11_FINAL_OVERRIDE -#elif defined __clang__ -# if __has_feature(cxx_override_control) -# define HAS_CXX11_FINAL_OVERRIDE -# endif -#elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) -# if defined __GXX_EXPERIMENTAL_CXX0X__ -# define HAS_CXX11_FINAL_OVERRIDE -# endif -#elif _MSC_VER >= 1700 -# define HAS_CXX11_FINAL_OVERRIDE -#endif - -#if defined HAS_CXX11_FINAL_OVERRIDE -# define CXX11_FINAL final -# define CXX11_OVERRIDE override -#else -# define CXX11_FINAL -# define CXX11_OVERRIDE -#endif - /** * Windows is very different to UNIX so we have to wrap certain features in * order to build on Windows correctly. diff --git a/include/configreader.h b/include/configreader.h index d701c2d4b..0f4758246 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -484,7 +484,7 @@ class CoreExport ConfigReaderThread : public Thread delete Config; } - void Run() CXX11_OVERRIDE; + void Run() override; /** Run in the main thread to apply the configuration */ void Finish(); bool IsDone() { return done; } diff --git a/include/ctables.h b/include/ctables.h index 1c7d5b4bd..1d620de17 100644 --- a/include/ctables.h +++ b/include/ctables.h @@ -237,7 +237,7 @@ class CoreExport Command : public CommandBase /** Register this object in the CommandParser */ - void RegisterService() CXX11_OVERRIDE; + void RegisterService() override; /** Destructor * Removes this command from the command parser @@ -250,7 +250,7 @@ class CoreExport SplitCommand : public Command public: SplitCommand(Module* me, const std::string &cmd, unsigned int minpara = 0, unsigned int maxpara = 0) : Command(me, cmd, minpara, maxpara) {} - CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE; + CmdResult Handle(User* user, const Params& parameters) override; virtual CmdResult HandleLocal(LocalUser* user, const Params& parameters); virtual CmdResult HandleRemote(RemoteUser* user, const Params& parameters); virtual CmdResult HandleServer(FakeUser* user, const Params& parameters); diff --git a/include/event.h b/include/event.h index 1bcb0a5ed..0251ec4ac 100644 --- a/include/event.h +++ b/include/event.h @@ -60,7 +60,7 @@ class Events::ModuleEventProvider : public ServiceProvider, private dynamic_refe friend class ModuleEventListener; private: - void OnCapture() CXX11_OVERRIDE + void OnCapture() override { // If someone else holds the list from now on, clear mine. See below for more info. if (*prov != this) @@ -93,7 +93,7 @@ class Events::ModuleEventListener : private dynamic_reference_base::CaptureHook /** Called by the dynref when the event provider becomes available */ - void OnCapture() CXX11_OVERRIDE + void OnCapture() override { prov->subscribers.insert(this); } diff --git a/include/extensible.h b/include/extensible.h index f88ede461..5874b460c 100644 --- a/include/extensible.h +++ b/include/extensible.h @@ -69,7 +69,7 @@ class CoreExport ExtensionItem : public ServiceProvider, public usecountbase /** Register this object in the ExtensionManager */ - void RegisterService() CXX11_OVERRIDE; + void RegisterService() override; protected: /** Get the item from the internal map */ @@ -111,7 +111,7 @@ class CoreExport Extensible : public classbase inline const ExtensibleStore& GetExtList() const { return extensions; } Extensible(); - CullResult cull() CXX11_OVERRIDE; + CullResult cull() override; virtual ~Extensible(); void doUnhookExtensions(const std::vector >& toRemove); @@ -145,9 +145,9 @@ class CoreExport LocalExtItem : public ExtensionItem public: LocalExtItem(const std::string& key, ExtensibleType exttype, Module* owner); virtual ~LocalExtItem(); - std::string serialize(SerializeFormat format, const Extensible* container, void* item) const CXX11_OVERRIDE; - void unserialize(SerializeFormat format, Extensible* container, const std::string& value) CXX11_OVERRIDE; - void free(Extensible* container, void* item) CXX11_OVERRIDE = 0; + std::string serialize(SerializeFormat format, const Extensible* container, void* item) const override; + void unserialize(SerializeFormat format, Extensible* container, const std::string& value) override; + void free(Extensible* container, void* item) override = 0; }; template > @@ -190,7 +190,7 @@ class SimpleExtItem : public LocalExtItem del(old); } - void free(Extensible* container, void* item) CXX11_OVERRIDE + void free(Extensible* container, void* item) override { Del del; del(static_cast(item)); @@ -202,8 +202,8 @@ class CoreExport LocalStringExt : public SimpleExtItem public: LocalStringExt(const std::string& key, ExtensibleType exttype, Module* owner); virtual ~LocalStringExt(); - std::string serialize(SerializeFormat format, const Extensible* container, void* item) const CXX11_OVERRIDE; - void unserialize(SerializeFormat format, Extensible* container, const std::string& value) CXX11_OVERRIDE; + std::string serialize(SerializeFormat format, const Extensible* container, void* item) const override; + void unserialize(SerializeFormat format, Extensible* container, const std::string& value) override; }; class CoreExport LocalIntExt : public LocalExtItem @@ -211,12 +211,12 @@ class CoreExport LocalIntExt : public LocalExtItem public: LocalIntExt(const std::string& key, ExtensibleType exttype, Module* owner); virtual ~LocalIntExt(); - std::string serialize(SerializeFormat format, const Extensible* container, void* item) const CXX11_OVERRIDE; - void unserialize(SerializeFormat format, Extensible* container, const std::string& value) CXX11_OVERRIDE; + std::string serialize(SerializeFormat format, const Extensible* container, void* item) const override; + void unserialize(SerializeFormat format, Extensible* container, const std::string& value) override; intptr_t get(const Extensible* container) const; intptr_t set(Extensible* container, intptr_t value); void unset(Extensible* container) { set(container, 0); } - void free(Extensible* container, void* item) CXX11_OVERRIDE; + void free(Extensible* container, void* item) override; }; class CoreExport StringExtItem : public ExtensionItem @@ -225,9 +225,9 @@ class CoreExport StringExtItem : public ExtensionItem StringExtItem(const std::string& key, ExtensibleType exttype, Module* owner); virtual ~StringExtItem(); std::string* get(const Extensible* container) const; - std::string serialize(SerializeFormat format, const Extensible* container, void* item) const CXX11_OVERRIDE; - void unserialize(SerializeFormat format, Extensible* container, const std::string& value) CXX11_OVERRIDE; + std::string serialize(SerializeFormat format, const Extensible* container, void* item) const override; + void unserialize(SerializeFormat format, Extensible* container, const std::string& value) override; void set(Extensible* container, const std::string& value); void unset(Extensible* container); - void free(Extensible* container, void* item) CXX11_OVERRIDE; + void free(Extensible* container, void* item) override; }; diff --git a/include/filelogger.h b/include/filelogger.h index af43a6d90..c6217f7cd 100644 --- a/include/filelogger.h +++ b/include/filelogger.h @@ -33,5 +33,5 @@ class CoreExport FileLogStream : public LogStream virtual ~FileLogStream(); - void OnLog(LogLevel loglevel, const std::string& type, const std::string& msg) CXX11_OVERRIDE; + void OnLog(LogLevel loglevel, const std::string& type, const std::string& msg) override; }; diff --git a/include/inspsocket.h b/include/inspsocket.h index 69fdaac8b..34a5a6c9b 100644 --- a/include/inspsocket.h +++ b/include/inspsocket.h @@ -98,7 +98,7 @@ class CoreExport SocketTimeout : public Timer /** Handle tick event */ - bool Tick(time_t now) CXX11_OVERRIDE; + bool Tick(time_t now) override; }; /** @@ -287,16 +287,16 @@ class CoreExport StreamSocket : public EventHandler /** Called by the socket engine on a read event */ - void OnEventHandlerRead() CXX11_OVERRIDE; + void OnEventHandlerRead() override; /** Called by the socket engine on a write event */ - void OnEventHandlerWrite() CXX11_OVERRIDE; + void OnEventHandlerWrite() override; /** Called by the socket engine on error * @param errcode Error */ - void OnEventHandlerError(int errcode) CXX11_OVERRIDE; + void OnEventHandlerError(int errcode) override; /** Sets the error message for this socket. Once set, the socket is dead. */ void SetError(const std::string& err) { if (error.empty()) error = err; } @@ -335,7 +335,7 @@ class CoreExport StreamSocket : public EventHandler */ virtual void Close(); /** This ensures that close is called prior to destructor */ - CullResult cull() CXX11_OVERRIDE; + CullResult cull() override; /** Get the IOHook of a module attached to this socket * @param mod Module whose IOHook to return @@ -395,7 +395,7 @@ class CoreExport BufferedSocket : public StreamSocket /** When there is data waiting to be read on a socket, the OnDataReady() * method is called. */ - void OnDataReady() CXX11_OVERRIDE = 0; + void OnDataReady() override = 0; /** * When an outbound connection fails, and the attempt times out, you @@ -410,7 +410,7 @@ class CoreExport BufferedSocket : public StreamSocket virtual ~BufferedSocket(); protected: - void OnEventHandlerWrite() CXX11_OVERRIDE; + void OnEventHandlerWrite() override; BufferedSocketError BeginConnect(const irc::sockets::sockaddrs& dest, const irc::sockets::sockaddrs& bind, unsigned int timeout); BufferedSocketError BeginConnect(const std::string& ipaddr, int aport, unsigned int maxtime, const std::string& connectbindip); }; diff --git a/include/listmode.h b/include/listmode.h index febef0bd2..07d860680 100644 --- a/include/listmode.h +++ b/include/listmode.h @@ -141,7 +141,7 @@ class CoreExport ListModeBase : public ModeHandler * @param user The user to send the list to * @param channel The channel the user is requesting the list for */ - void DisplayList(User* user, Channel* channel) CXX11_OVERRIDE; + void DisplayList(User* user, Channel* channel) override; /** Tell a user that a list contains no elements. * Sends 'eolnum' numeric with text 'eolstr', unless overridden (see constructor) @@ -149,7 +149,7 @@ class CoreExport ListModeBase : public ModeHandler * @param channel The channel that has the empty list * See mode.h */ - void DisplayEmptyList(User* user, Channel* channel) CXX11_OVERRIDE; + void DisplayEmptyList(User* user, Channel* channel) override; /** Remove all instances of the mode from a channel. * Populates the given modestack with modes that remove every instance of @@ -158,7 +158,7 @@ class CoreExport ListModeBase : public ModeHandler * @param channel The channel to remove all instances of the mode from * @param changelist Mode change list to populate with the removal of this mode */ - void RemoveMode(Channel* channel, Modes::ChangeList& changelist) CXX11_OVERRIDE; + void RemoveMode(Channel* channel, Modes::ChangeList& changelist) override; /** Perform a rehash of this mode's configuration data */ @@ -167,7 +167,7 @@ class CoreExport ListModeBase : public ModeHandler /** Handle the list mode. * See mode.h */ - ModeAction OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, bool adding) CXX11_OVERRIDE; + ModeAction OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, bool adding) override; /** Validate parameters. * Overridden by implementing module. @@ -185,7 +185,7 @@ class CoreExport ListModeBase : public ModeHandler * @param channel For channel mode changes, the target of the mode. For user mode changes, NULL. * See mode.h */ - virtual void OnParameterMissing(User* user, User* dest, Channel* channel) CXX11_OVERRIDE; + virtual void OnParameterMissing(User* user, User* dest, Channel* channel) override; /** Tell the user the list is too long. * Overridden by implementing module. diff --git a/include/mode.h b/include/mode.h index a9442d180..f1f461321 100644 --- a/include/mode.h +++ b/include/mode.h @@ -167,12 +167,12 @@ class CoreExport ModeHandler : public ServiceProvider * @param mclass The object type of this mode handler, one of ModeHandler::Class */ ModeHandler(Module* me, const std::string& name, char modeletter, ParamSpec params, ModeType type, Class mclass = MC_OTHER); - CullResult cull() CXX11_OVERRIDE; + CullResult cull() override; virtual ~ModeHandler(); /** Register this object in the ModeParser */ - void RegisterService() CXX11_OVERRIDE; + void RegisterService() override; /** * Returns true if the mode is a list mode @@ -381,7 +381,7 @@ class CoreExport PrefixMode : public ModeHandler * @param adding This value is true when the mode is being set, or false when it is being unset. * @return allow, deny, or passthru to check against the required level */ - ModResult AccessCheck(User* source, Channel* channel, std::string ¶meter, bool adding) CXX11_OVERRIDE; + ModResult AccessCheck(User* source, Channel* channel, std::string ¶meter, bool adding) override; /** * Handles setting and unsetting the prefix mode. @@ -396,7 +396,7 @@ class CoreExport PrefixMode : public ModeHandler * The latter occurs either when the member cannot be found or when the member already has this prefix set * (when setting) or doesn't have this prefix set (when unsetting). */ - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& param, bool adding) CXX11_OVERRIDE; + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& param, bool adding) override; /** * Updates the configuration of this prefix. @@ -412,7 +412,7 @@ class CoreExport PrefixMode : public ModeHandler * @param channel The channel which the server wants to remove your mode from * @param changelist Mode change list to populate with the removal of this mode */ - void RemoveMode(Channel* channel, Modes::ChangeList& changelist) CXX11_OVERRIDE; + void RemoveMode(Channel* channel, Modes::ChangeList& changelist) override; /** @@ -447,7 +447,7 @@ class CoreExport SimpleUserModeHandler : public ModeHandler public: SimpleUserModeHandler(Module* Creator, const std::string& Name, char modeletter) : ModeHandler(Creator, Name, modeletter, PARAM_NONE, MODETYPE_USER) {} - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) CXX11_OVERRIDE; + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) override; }; /** A prebuilt mode handler which handles a simple channel mode, e.g. no parameters, usable by any user, with no extra @@ -460,7 +460,7 @@ class CoreExport SimpleChannelModeHandler : public ModeHandler public: SimpleChannelModeHandler(Module* Creator, const std::string& Name, char modeletter) : ModeHandler(Creator, Name, modeletter, PARAM_NONE, MODETYPE_CHANNEL) {} - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) CXX11_OVERRIDE; + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding) override; }; /** diff --git a/include/modules.h b/include/modules.h index b8c860fbc..c9ddde575 100644 --- a/include/modules.h +++ b/include/modules.h @@ -275,7 +275,7 @@ class CoreExport Module : public classbase, public usecountbase /** Clean up prior to destruction * If you override, you must call this AFTER your module's cleanup */ - CullResult cull() CXX11_OVERRIDE; + CullResult cull() override; /** Default destructor. * destroys a module class diff --git a/include/modules/cap.h b/include/modules/cap.h index 6dcb9f3bc..658aefe5c 100644 --- a/include/modules/cap.h +++ b/include/modules/cap.h @@ -32,8 +32,8 @@ namespace Cap { public: ExtItem(Module* mod); - std::string serialize(SerializeFormat format, const Extensible* container, void* item) const CXX11_OVERRIDE; - void unserialize(SerializeFormat format, Extensible* container, const std::string& value) CXX11_OVERRIDE; + std::string serialize(SerializeFormat format, const Extensible* container, void* item) const override; + void unserialize(SerializeFormat format, Extensible* container, const std::string& value) override; }; class Capability; @@ -134,7 +134,7 @@ namespace Cap */ dynamic_reference manager; - void OnCapture() CXX11_OVERRIDE + void OnCapture() override { if (active) SetActive(true); @@ -181,7 +181,7 @@ namespace Cap SetActive(false); } - void RegisterService() CXX11_OVERRIDE + void RegisterService() override { manager.SetCaptureHook(this); SetActive(true); diff --git a/include/modules/dns.h b/include/modules/dns.h index 3db651798..9f58acce4 100644 --- a/include/modules/dns.h +++ b/include/modules/dns.h @@ -191,7 +191,7 @@ namespace DNS /** Used to time out the query, calls OnError and asks the TimerManager * to delete this request */ - bool Tick(time_t now) CXX11_OVERRIDE + bool Tick(time_t now) override { Query rr(this->question); rr.error = ERROR_TIMEDOUT; diff --git a/include/modules/ircv3.h b/include/modules/ircv3.h index 338abdeba..5ca12eec6 100644 --- a/include/modules/ircv3.h +++ b/include/modules/ircv3.h @@ -33,7 +33,7 @@ class IRCv3::WriteNeighborsWithCap : public User::ForEachNeighborHandler const Cap::Capability& cap; ClientProtocol::Event& protoev; - void Execute(LocalUser* user) CXX11_OVERRIDE + void Execute(LocalUser* user) override { if (cap.get(user)) user->Send(protoev); @@ -70,12 +70,12 @@ class IRCv3::CapTag : public ClientProtocol::MessageTagProvider Cap::Capability cap; const std::string tagname; - bool ShouldSendTag(LocalUser* user, const ClientProtocol::MessageTagData& tagdata) CXX11_OVERRIDE + bool ShouldSendTag(LocalUser* user, const ClientProtocol::MessageTagData& tagdata) override { return cap.get(user); } - void OnClientProtocolPopulateTags(ClientProtocol::Message& msg) CXX11_OVERRIDE + void OnClientProtocolPopulateTags(ClientProtocol::Message& msg) override { T& tag = static_cast(*this); const std::string* const val = tag.GetValue(msg); diff --git a/include/modules/shun.h b/include/modules/shun.h index 1c35e3a74..e2308134e 100644 --- a/include/modules/shun.h +++ b/include/modules/shun.h @@ -39,7 +39,7 @@ class Shun : public XLine { } - bool Matches(User* u) CXX11_OVERRIDE + bool Matches(User* u) override { LocalUser* lu = IS_LOCAL(u); if (lu && lu->exempt) @@ -54,12 +54,12 @@ class Shun : public XLine return false; } - bool Matches(const std::string& str) CXX11_OVERRIDE + bool Matches(const std::string& str) override { return (matchtext == str); } - const std::string& Displayable() CXX11_OVERRIDE + const std::string& Displayable() override { return matchtext; } diff --git a/include/parammode.h b/include/parammode.h index c79d11b6b..072b8307d 100644 --- a/include/parammode.h +++ b/include/parammode.h @@ -28,7 +28,7 @@ class CoreExport ParamModeBase : public ModeHandler ParamModeBase(Module* Creator, const std::string& Name, char modeletter, ParamSpec ps) : ModeHandler(Creator, Name, modeletter, ps, MODETYPE_CHANNEL, MC_PARAM) { } - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& param, bool adding) CXX11_OVERRIDE; + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& param, bool adding) override; // Does nothing by default virtual void OnUnset(User* source, Channel* chan) { } @@ -60,13 +60,13 @@ class ParamMode : public ParamModeBase { } - void OnUnsetInternal(User* source, Channel* chan) CXX11_OVERRIDE + void OnUnsetInternal(User* source, Channel* chan) override { this->OnUnset(source, chan); ext.unset(chan); } - void GetParameter(Channel* chan, std::string& out) CXX11_OVERRIDE + void GetParameter(Channel* chan, std::string& out) override { T* mh = static_cast(this); mh->SerializeParam(chan, ext.get(chan), out); diff --git a/include/socket.h b/include/socket.h index ed0e4a801..81b273e94 100644 --- a/include/socket.h +++ b/include/socket.h @@ -162,7 +162,7 @@ class CoreExport ListenSocket : public EventHandler /** Handles new connections, called by the socket engine */ - void OnEventHandlerRead() CXX11_OVERRIDE; + void OnEventHandlerRead() override; /** Inspects the bind block belonging to this socket to set the name of the IO hook * provider which this socket will use for incoming connections. diff --git a/include/threadengine.h b/include/threadengine.h index 964b8d796..0b816e27c 100644 --- a/include/threadengine.h +++ b/include/threadengine.h @@ -108,7 +108,7 @@ class CoreExport QueuedThread : public Thread queue.Wakeup(); queue.Unlock(); } - void SetExitFlag() CXX11_OVERRIDE + void SetExitFlag() override { queue.Lock(); Thread::SetExitFlag(); @@ -157,7 +157,7 @@ class CoreExport SocketThread : public Thread queue.Wakeup(); queue.Unlock(); } - void SetExitFlag() CXX11_OVERRIDE + void SetExitFlag() override { queue.Lock(); Thread::SetExitFlag(); diff --git a/include/users.h b/include/users.h index 3937f74aa..4b3503fb4 100644 --- a/include/users.h +++ b/include/users.h @@ -676,7 +676,7 @@ class CoreExport User : public Extensible /** Default destructor */ virtual ~User(); - CullResult cull() CXX11_OVERRIDE; + CullResult cull() override; }; class CoreExport UserIOHandler : public StreamSocket @@ -691,9 +691,9 @@ class CoreExport UserIOHandler : public StreamSocket , user(me) { } - void OnDataReady() CXX11_OVERRIDE; - bool OnSetEndPoint(const irc::sockets::sockaddrs& local, const irc::sockets::sockaddrs& remote) CXX11_OVERRIDE; - void OnError(BufferedSocketError error) CXX11_OVERRIDE; + void OnDataReady() override; + bool OnSetEndPoint(const irc::sockets::sockaddrs& local, const irc::sockets::sockaddrs& remote) override; + void OnError(BufferedSocketError error) override; /** Adds to the user's write buffer. * You may add any amount of text up to this users sendq value, if you exceed the @@ -725,7 +725,7 @@ class CoreExport LocalUser : public User, public insp::intrusive_list_node