From 44637154da89028a99920bd6ead5d917d8a894a4 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 1 Apr 2014 22:24:50 -0400 Subject: Require cmake 2.8 and C++11 support --- include/CMakeLists.txt | 44 +-- include/access.h | 7 +- include/account.h | 9 +- include/anope.h | 11 +- include/base.h | 5 +- include/bots.h | 4 +- include/channels.h | 4 +- include/commands.h | 4 +- include/config.h | 4 +- include/extensible.h | 20 +- include/hashcomp.h | 19 +- include/lists.h | 5 +- include/logger.h | 5 +- include/mail.h | 6 +- include/memo.h | 6 +- include/messages.h | 41 ++- include/modes.h | 17 +- include/module.h | 4 +- include/modules.h | 7 +- include/modules/dns.h | 2 +- include/modules/os_session.h | 4 +- include/modules/sasl.h | 4 +- include/modules/sql.h | 10 +- include/opertype.h | 4 +- include/protocol.h | 4 +- include/pstdint.h | 800 ------------------------------------------- include/regchannel.h | 8 +- include/regexpr.h | 5 +- include/serialize.h | 4 +- include/servers.h | 4 +- include/service.h | 7 +- include/services.h | 16 +- include/socketengine.h | 4 +- include/sockets.h | 22 +- include/sysconf.h.cmake | 41 +-- include/threadengine.h | 4 +- include/timers.h | 4 +- include/uplink.h | 11 +- include/users.h | 6 +- include/xline.h | 6 +- 40 files changed, 109 insertions(+), 1083 deletions(-) delete mode 100644 include/pstdint.h (limited to 'include') diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 6170cde27..7476edfe7 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -17,47 +17,5 @@ if(NOT WIN32) add_to_cpack_ignored_files("version.h$" TRUE) endif(NOT WIN32) -set(PCH_SOURCES_GCH "") -if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX) - string(REPLACE " " ";" PCH_CXXFLAGS "${CXXFLAGS} ${CMAKE_CXX_FLAGS}") - - file(GLOB PCH_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h") - sort_list(PCH_SOURCES) - - foreach(PCH_SOURCE ${PCH_SOURCES}) - find_includes(${PCH_SOURCE} INCLUDES) - set(INCLUDES_LIST) - append_to_list(INCLUDES_LIST ${PCH_SOURCE}) - foreach(INCLUDE ${INCLUDES}) - # Extract the filename from the #include line - extract_include_filename(${INCLUDE} FILENAME QUOTE_TYPE) - if(QUOTE_TYPE STREQUAL "quotes") - find_in_list(PCH_SOURCES "${FILENAME}" FOUND) - if(NOT FOUND EQUAL -1) - append_to_list(INCLUDES_LIST ${FILENAME}) - endif(NOT FOUND EQUAL -1) - endif(QUOTE_TYPE STREQUAL "quotes") - endforeach(INCLUDE) - - set(PCH_EXTRAFLAGS "") - if(DEBUG_BUILD) - set(PCH_EXTRAFLAGS "-g") - endif(DEBUG_BUILD) - if(PCH_SOURCE STREQUAL "module.h") - set(PCH_EXTRAFLAGS ${PCH_EXTRAFLAGS} -fPIC) - endif(PCH_SOURCE STREQUAL "module.h") - if(GETTEXT_INCLUDE) - set(PCH_GETTEXT_INCLUDE "-I${GETTEXT_INCLUDE}") - endif(GETTEXT_INCLUDE) - - set(PCH_SOURCES_GCH "${PCH_SOURCES_GCH};${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch") - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch - COMMAND ${CMAKE_CXX_COMPILER} ARGS ${PCH_CXXFLAGS} ${PCH_EXTRAFLAGS} - ${PCH_GETTEXT_INCLUDE} -I${CMAKE_CURRENT_BINARY_DIR} -I${Anope_SOURCE_DIR}/modules/pseudoclients ${CMAKE_CURRENT_SOURCE_DIR}/${PCH_SOURCE} -o ${CMAKE_CURRENT_BINARY_DIR}/${PCH_SOURCE}.gch - DEPENDS ${INCLUDES_LIST} VERBATIM - ) - endforeach(PCH_SOURCE ${PCH_SOURCES}) -endif(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX) - # Add a custom target to the above file -add_custom_target(headers DEPENDS version ${CMAKE_CURRENT_BINARY_DIR}/version_build ${PCH_SOURCES_GCH}) +add_custom_target(headers DEPENDS version ${CMAKE_CURRENT_BINARY_DIR}/version_build) diff --git a/include/access.h b/include/access.h index 57229abab..292e95228 100644 --- a/include/access.h +++ b/include/access.h @@ -10,8 +10,7 @@ * */ -#ifndef ACCESS_H -#define ACCESS_H +#pragma once #include "services.h" #include "anope.h" @@ -96,7 +95,7 @@ class CoreExport ChanAccess : public Serializable ChanAccess(AccessProvider *p); virtual ~ChanAccess(); - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &); /** Check if this access entry matches the given user or account @@ -168,5 +167,3 @@ class CoreExport AccessGroup : public std::vector bool operator<=(const AccessGroup &other) const; }; -#endif - diff --git a/include/account.h b/include/account.h index 2c8c6ecb5..381047ac4 100644 --- a/include/account.h +++ b/include/account.h @@ -10,8 +10,7 @@ * */ -#ifndef ACCOUNT_H -#define ACCOUNT_H +#pragma once #include "extensible.h" #include "serialize.h" @@ -53,7 +52,7 @@ class CoreExport NickAlias : public Serializable, public Extensible NickAlias(const Anope::string &nickname, NickCore *nickcore); ~NickAlias(); - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &); /** Set a vhost for the user @@ -145,7 +144,7 @@ class CoreExport NickCore : public Serializable, public Extensible NickCore(const Anope::string &nickdisplay); ~NickCore(); - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &); /** Changes the display for this account @@ -278,5 +277,3 @@ class CoreExport IdentifyRequest static void ModuleUnload(Module *m); }; - -#endif // ACCOUNT_H diff --git a/include/anope.h b/include/anope.h index 638661440..bb20299e4 100644 --- a/include/anope.h +++ b/include/anope.h @@ -10,8 +10,7 @@ * */ -#ifndef ANOPE_H -#define ANOPE_H +#pragma once #include @@ -313,7 +312,7 @@ namespace Anope { inline size_t operator()(const string &s) const { - return TR1NS::hash()(s.lower().str()); + return std::hash()(s.lower().str()); } }; @@ -321,7 +320,7 @@ namespace Anope { inline size_t operator()(const string &s) const { - return TR1NS::hash()(s.str()); + return std::hash()(s.str()); } }; @@ -335,7 +334,7 @@ namespace Anope template class map : public std::map { }; template class multimap : public std::multimap { }; - template class hash_map : public TR1NS::unordered_map { }; + template class hash_map : public std::unordered_map { }; static const char *const compiled = __TIME__ " " __DATE__; @@ -776,5 +775,3 @@ template inline T anope_dynamic_static_cast(O ptr) return static_cast(ptr); } #endif - -#endif // ANOPE_H diff --git a/include/base.h b/include/base.h index e64af87a4..a28695c5f 100644 --- a/include/base.h +++ b/include/base.h @@ -7,8 +7,7 @@ * */ -#ifndef BASE_H -#define BASE_H +#pragma once #include "services.h" @@ -141,5 +140,3 @@ class Reference : public ReferenceBase } }; -#endif // BASE_H - diff --git a/include/bots.h b/include/bots.h index bab3931c5..353be89cb 100644 --- a/include/bots.h +++ b/include/bots.h @@ -7,8 +7,7 @@ * */ -#ifndef BOTS_H -#define BOTS_H +#pragma once #include "users.h" #include "anope.h" @@ -133,4 +132,3 @@ class CoreExport BotInfo : public User, public Serializable static BotInfo* Find(const Anope::string &nick, bool nick_only = false); }; -#endif // BOTS_H diff --git a/include/channels.h b/include/channels.h index 27119adf4..69d7ee787 100644 --- a/include/channels.h +++ b/include/channels.h @@ -7,8 +7,7 @@ * */ -#ifndef CHANNELS_H -#define CHANNELS_H +#pragma once #include "anope.h" #include "extensible.h" @@ -301,4 +300,3 @@ class CoreExport Channel : public Base, public Extensible static Channel *FindOrCreate(const Anope::string &name, bool &created, time_t ts = Anope::CurTime); }; -#endif // CHANNELS_H diff --git a/include/commands.h b/include/commands.h index f2b0592d4..2be64d00d 100644 --- a/include/commands.h +++ b/include/commands.h @@ -9,8 +9,7 @@ * Based on the original code of Services by Andy Church. */ -#ifndef COMMAND_H -#define COMMAND_H +#pragma once #include "service.h" #include "anope.h" @@ -180,4 +179,3 @@ class CoreExport Command : public Service static bool FindCommandFromService(const Anope::string &command_service, BotInfo* &bi, Anope::string &name); }; -#endif // COMMANDS_H diff --git a/include/config.h b/include/config.h index 308775e41..ccb04ce55 100644 --- a/include/config.h +++ b/include/config.h @@ -10,8 +10,7 @@ * */ -#ifndef CONFIG_H -#define CONFIG_H +#pragma once #include "account.h" #include "regchannel.h" @@ -177,4 +176,3 @@ class ConfigException : public CoreException extern Configuration::File ServicesConf; extern CoreExport Configuration::Conf *Config; -#endif // CONFIG_H diff --git a/include/extensible.h b/include/extensible.h index f33312393..ef429b919 100644 --- a/include/extensible.h +++ b/include/extensible.h @@ -7,8 +7,7 @@ * */ -#ifndef EXTENSIBLE_H -#define EXTENSIBLE_H +#pragma once #include "anope.h" #include "serialize.h" @@ -92,7 +91,7 @@ class BaseExtensibleItem : public ExtensibleBase return t; } - void Unset(Extensible *obj) anope_override + void Unset(Extensible *obj) override { T *value = Get(obj); items.erase(obj); @@ -127,7 +126,7 @@ template class ExtensibleItem : public BaseExtensibleItem { protected: - T* Create(Extensible *obj) anope_override + T* Create(Extensible *obj) override { return new T(obj); } @@ -139,7 +138,7 @@ template class PrimitiveExtensibleItem : public BaseExtensibleItem { protected: - T* Create(Extensible *obj) anope_override + T* Create(Extensible *obj) override { return new T(); } @@ -151,7 +150,7 @@ template<> class PrimitiveExtensibleItem : public BaseExtensibleItem { protected: - bool* Create(Extensible *) anope_override + bool* Create(Extensible *) override { return NULL; } @@ -165,13 +164,13 @@ class SerializableExtensibleItem : public PrimitiveExtensibleItem public: SerializableExtensibleItem(Module *m, const Anope::string &n) : PrimitiveExtensibleItem(m, n) { } - void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override + void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override { T* t = this->Get(e); data[this->name] << *t; } - void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override + void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override { T t; if (data[this->name] >> t) @@ -185,12 +184,12 @@ class SerializableExtensibleItem : public PrimitiveExtensibleItem public: SerializableExtensibleItem(Module *m, const Anope::string &n) : PrimitiveExtensibleItem(m, n) { } - void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override + void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const override { data[this->name] << true; } - void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override + void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) override { bool b = false; data[this->name] >> b; @@ -255,4 +254,3 @@ void Extensible::Shrink(const Anope::string &name) Log(LOG_DEBUG) << "Shrink for nonexistent type " << name << " on " << static_cast(this); } -#endif // EXTENSIBLE_H diff --git a/include/hashcomp.h b/include/hashcomp.h index 140131e72..2364975b9 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -7,19 +7,11 @@ * */ -#ifndef HASHCOMP_H -#define HASHCOMP_H +#pragma once #include #include - -#if defined _LIBCPP_VERSION || defined _WIN32 #include -#define TR1NS std -#else -#include -#define TR1NS std::tr1 -#endif #include "services.h" @@ -39,7 +31,7 @@ namespace Anope class ascii_ctype : public std::ctype { public: - char_type do_toupper(char_type c) const anope_override + char_type do_toupper(char_type c) const override { if (c >= 'a' && c <= 'z') return c - 32; @@ -47,7 +39,7 @@ namespace Anope return c; } - char_type do_tolower(char_type c) const anope_override + char_type do_tolower(char_type c) const override { if (c >= 'A' && c <= 'Z') return c + 32; @@ -61,7 +53,7 @@ namespace Anope class rfc1459_ctype : public ascii_ctype { public: - char_type do_toupper(char_type c) const anope_override + char_type do_toupper(char_type c) const override { if (c == '{' || c == '}' || c == '|') return c - 32; @@ -69,7 +61,7 @@ namespace Anope return ascii_ctype::do_toupper(c); } - char_type do_tolower(char_type c) const anope_override + char_type do_tolower(char_type c) const override { if (c == '[' || c == ']' || c == '\\') return c + 32; @@ -197,4 +189,3 @@ inline bool operator!=(const std::string &leftval, const ci::string &rightval) return !(leftval.c_str() == rightval); } -#endif // HASHCOMP_H diff --git a/include/lists.h b/include/lists.h index 980f8b533..36e5ae30d 100644 --- a/include/lists.h +++ b/include/lists.h @@ -10,8 +10,7 @@ * */ -#ifndef LISTS_H -#define LISTS_H +#pragma once #include "services.h" #include "anope.h" @@ -92,5 +91,3 @@ class CoreExport InfoFormatter void AddOption(const Anope::string &opt); }; -#endif // LISTS_H - diff --git a/include/logger.h b/include/logger.h index 31fd4f627..73180e66e 100644 --- a/include/logger.h +++ b/include/logger.h @@ -10,8 +10,7 @@ * */ -#ifndef LOGGER_H -#define LOGGER_H +#pragma once #include "anope.h" #include "defs.h" @@ -137,5 +136,3 @@ class CoreExport LogInfo void ProcessMessage(const Log *l); }; -#endif // LOGGER_H - diff --git a/include/mail.h b/include/mail.h index 5a355ab5f..2f59b5000 100644 --- a/include/mail.h +++ b/include/mail.h @@ -11,8 +11,7 @@ * */ -#ifndef MAIL_H -#define MAIL_H +#pragma once #include "anope.h" #include "threadengine.h" @@ -50,9 +49,8 @@ namespace Mail ~Message(); /* Called from within the thread to actually send the mail */ - void Run() anope_override; + void Run() override; }; } // namespace Mail -#endif // MAIL_H diff --git a/include/memo.h b/include/memo.h index 75691d89f..103f00ca1 100644 --- a/include/memo.h +++ b/include/memo.h @@ -10,8 +10,7 @@ * */ -#ifndef MEMO_H -#define MEMO_H +#pragma once #include "anope.h" #include "serialize.h" @@ -24,7 +23,7 @@ class CoreExport Memo : public Serializable Memo(); ~Memo(); - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &); Anope::string owner; @@ -52,4 +51,3 @@ struct CoreExport MemoInfo static MemoInfo *GetMemoInfo(const Anope::string &targ, bool &is_chan); }; -#endif // MEMO_H diff --git a/include/messages.h b/include/messages.h index e805903b3..070fcb84f 100644 --- a/include/messages.h +++ b/include/messages.h @@ -24,35 +24,35 @@ namespace Message { Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Capab : IRCDMessage { Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Error : IRCDMessage { Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 1) { } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Invite : IRCDMessage { Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Join : IRCDMessage { Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; typedef std::pair SJoinUser; @@ -70,106 +70,105 @@ namespace Message { Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Kill : IRCDMessage { Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 2) { } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Mode : IRCDMessage { Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport MOTD : IRCDMessage { MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 1) { } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Notice : IRCDMessage { Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Part : IRCDMessage { Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Ping : IRCDMessage { Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Privmsg : IRCDMessage { Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Quit : IRCDMessage { Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport SQuit : IRCDMessage { SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Stats : IRCDMessage { Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Time : IRCDMessage { Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Topic : IRCDMessage { Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Version : IRCDMessage { Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; struct CoreExport Whois : IRCDMessage { Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - void Run(MessageSource &source, const std::vector ¶ms) anope_override; + void Run(MessageSource &source, const std::vector ¶ms) override; }; } // namespace Message - diff --git a/include/modes.h b/include/modes.h index 8f67959e8..279d1dbc1 100644 --- a/include/modes.h +++ b/include/modes.h @@ -6,8 +6,7 @@ * Please read COPYING and README for further details. */ -#ifndef MODES_H -#define MODES_H +#pragma once #include "anope.h" #include "base.h" @@ -102,7 +101,7 @@ class CoreExport ChannelMode : public Mode */ ChannelMode(const Anope::string &name, char mc); - bool CanSet(User *u) const anope_override; + bool CanSet(User *u) const override; }; /** This is a mode for lists, eg b/e/I. These modes should inherit from this @@ -207,7 +206,7 @@ class CoreExport UserModeOperOnly : public UserMode public: UserModeOperOnly(const Anope::string &mname, char um) : UserMode(mname, um) { } - bool CanSet(User *u) const anope_override; + bool CanSet(User *u) const override; }; class CoreExport UserModeNoone : public UserMode @@ -215,7 +214,7 @@ class CoreExport UserModeNoone : public UserMode public: UserModeNoone(const Anope::string &mname, char um) : UserMode(mname, um) { } - bool CanSet(User *u) const anope_override; + bool CanSet(User *u) const override; }; /** Channel mode +k (key) @@ -225,7 +224,7 @@ class CoreExport ChannelModeKey : public ChannelModeParam public: ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { } - bool IsValid(const Anope::string &value) const anope_override; + bool IsValid(const Anope::string &value) const override; }; /** This class is used for oper only channel modes @@ -236,7 +235,7 @@ class CoreExport ChannelModeOperOnly : public ChannelMode ChannelModeOperOnly(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { } /* Opers only */ - bool CanSet(User *u) const anope_override; + bool CanSet(User *u) const override; }; /** This class is used for channel modes only servers may set @@ -246,7 +245,7 @@ class CoreExport ChannelModeNoone : public ChannelMode public: ChannelModeNoone(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { } - bool CanSet(User *u) const anope_override; + bool CanSet(User *u) const override; }; /** This is the mode manager @@ -384,5 +383,3 @@ class CoreExport Entry */ bool Matches(User *u, bool full = false) const; }; - -#endif // MODES_H diff --git a/include/module.h b/include/module.h index d7845f65a..7bfc40cfe 100644 --- a/include/module.h +++ b/include/module.h @@ -9,8 +9,7 @@ * Based on the original code of Services by Andy Church. */ -#ifndef MODULE_H -#define MODULE_H +#pragma once #include "access.h" #include "account.h" @@ -51,4 +50,3 @@ #include "modules/pseudoclients/memoserv.h" #include "modules/pseudoclients/nickserv.h" -#endif // MODULE_H diff --git a/include/modules.h b/include/modules.h index 0d121089a..05a763b00 100644 --- a/include/modules.h +++ b/include/modules.h @@ -10,11 +10,9 @@ * */ -#include "serialize.h" - -#ifndef MODULES_H -#define MODULES_H +#pragma once +#include "serialize.h" #include "base.h" #include "modes.h" #include "timers.h" @@ -1203,4 +1201,3 @@ class CoreExport ModuleManager static ModuleReturn DeleteModule(Module *m); }; -#endif // MODULES_H diff --git a/include/modules/dns.h b/include/modules/dns.h index 37af05cc9..59fc83e64 100644 --- a/include/modules/dns.h +++ b/include/modules/dns.h @@ -165,7 +165,7 @@ namespace DNS /** Used to time out the query, xalls OnError and lets the TimerManager * delete this request. */ - void Tick(time_t) anope_override + void Tick(time_t) override { Log(LOG_DEBUG_2) << "Resolver: timeout for query " << this->name; Query rr(*this); diff --git a/include/modules/os_session.h b/include/modules/os_session.h index 65f1c6f75..ac6bf9395 100644 --- a/include/modules/os_session.h +++ b/include/modules/os_session.h @@ -20,14 +20,14 @@ struct Exception : Serializable time_t expires; /* Time when it expires. 0 == no expiry */ Exception() : Serializable("Exception") { } - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &data); }; class SessionService : public Service { public: - typedef TR1NS::unordered_map SessionMap; + typedef std::unordered_map SessionMap; typedef std::vector ExceptionVector; SessionService(Module *m) : Service(m, "SessionService", "session") { } diff --git a/include/modules/sasl.h b/include/modules/sasl.h index ec6d741ca..dbe6441e9 100644 --- a/include/modules/sasl.h +++ b/include/modules/sasl.h @@ -80,7 +80,7 @@ namespace SASL public: IdentifyRequest(Module *m, const Anope::string &id, const Anope::string &acc, const Anope::string &pass) : ::IdentifyRequest(m, acc, pass), uid(id) { } - void OnSuccess() anope_override + void OnSuccess() override { if (!sasl) return; @@ -98,7 +98,7 @@ namespace SASL } } - void OnFail() anope_override + void OnFail() override { if (!sasl) return; diff --git a/include/modules/sql.h b/include/modules/sql.h index 789bec98b..9cde772dc 100644 --- a/include/modules/sql.h +++ b/include/modules/sql.h @@ -20,7 +20,7 @@ namespace SQL Clear(); } - std::iostream& operator[](const Anope::string &key) anope_override + std::iostream& operator[](const Anope::string &key) override { std::stringstream *&ss = data[key]; if (!ss) @@ -28,7 +28,7 @@ namespace SQL return *ss; } - std::set KeySet() const anope_override + std::set KeySet() const override { std::set keys; for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) @@ -36,7 +36,7 @@ namespace SQL return keys; } - size_t Hash() const anope_override + size_t Hash() const override { size_t hash = 0; for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it) @@ -60,12 +60,12 @@ namespace SQL this->data.clear(); } - void SetType(const Anope::string &key, Type t) anope_override + void SetType(const Anope::string &key, Type t) override { this->types[key] = t; } - Type GetType(const Anope::string &key) const anope_override + Type GetType(const Anope::string &key) const override { std::map::const_iterator it = this->types.find(key); if (it != this->types.end()) diff --git a/include/opertype.h b/include/opertype.h index fed40104c..9cbd3347a 100644 --- a/include/opertype.h +++ b/include/opertype.h @@ -6,8 +6,7 @@ * */ -#ifndef OPERTYPE_H -#define OPERTYPE_H +#pragma once #include "services.h" #include "account.h" @@ -124,4 +123,3 @@ class CoreExport OperType const std::list GetPrivs() const; }; -#endif // OPERTYPE_H diff --git a/include/protocol.h b/include/protocol.h index 8f4f2ea58..06f9d35c9 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -10,8 +10,7 @@ * */ -#ifndef PROTOCOL_H -#define PROTOCOL_H +#pragma once #include "services.h" #include "anope.h" @@ -274,4 +273,3 @@ class CoreExport IRCDMessage : public Service extern CoreExport IRCDProto *IRCD; -#endif // PROTOCOL_H diff --git a/include/pstdint.h b/include/pstdint.h deleted file mode 100644 index fa64dbe70..000000000 --- a/include/pstdint.h +++ /dev/null @@ -1,800 +0,0 @@ -/* A portable stdint.h - **************************************************************************** - * BSD License: - **************************************************************************** - * - * Copyright (c) 2005-2011 Paul Hsieh - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - **************************************************************************** - * - * Version 0.1.12 - * - * The ANSI C standard committee, for the C99 standard, specified the - * inclusion of a new standard include file called stdint.h. This is - * a very useful and long desired include file which contains several - * very precise definitions for integer scalar types that is - * critically important for making portable several classes of - * applications including cryptography, hashing, variable length - * integer libraries and so on. But for most developers its likely - * useful just for programming sanity. - * - * The problem is that most compiler vendors have decided not to - * implement the C99 standard, and the next C++ language standard - * (which has a lot more mindshare these days) will be a long time in - * coming and its unknown whether or not it will include stdint.h or - * how much adoption it will have. Either way, it will be a long time - * before all compilers come with a stdint.h and it also does nothing - * for the extremely large number of compilers available today which - * do not include this file, or anything comparable to it. - * - * So that's what this file is all about. Its an attempt to build a - * single universal include file that works on as many platforms as - * possible to deliver what stdint.h is supposed to. A few things - * that should be noted about this file: - * - * 1) It is not guaranteed to be portable and/or present an identical - * interface on all platforms. The extreme variability of the - * ANSI C standard makes this an impossibility right from the - * very get go. Its really only meant to be useful for the vast - * majority of platforms that possess the capability of - * implementing usefully and precisely defined, standard sized - * integer scalars. Systems which are not intrinsically 2s - * complement may produce invalid constants. - * - * 2) There is an unavoidable use of non-reserved symbols. - * - * 3) Other standard include files are invoked. - * - * 4) This file may come in conflict with future platforms that do - * include stdint.h. The hope is that one or the other can be - * used with no real difference. - * - * 5) In the current verison, if your platform can't represent - * int32_t, int16_t and int8_t, it just dumps out with a compiler - * error. - * - * 6) 64 bit integers may or may not be defined. Test for their - * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX. - * Note that this is different from the C99 specification which - * requires the existence of 64 bit support in the compiler. If - * this is not defined for your platform, yet it is capable of - * dealing with 64 bits then it is because this file has not yet - * been extended to cover all of your system's capabilities. - * - * 7) (u)intptr_t may or may not be defined. Test for its presence - * with the test: #ifdef PTRDIFF_MAX. If this is not defined - * for your platform, then it is because this file has not yet - * been extended to cover all of your system's capabilities, not - * because its optional. - * - * 8) The following might not been defined even if your platform is - * capable of defining it: - * - * WCHAR_MIN - * WCHAR_MAX - * (u)int64_t - * PTRDIFF_MIN - * PTRDIFF_MAX - * (u)intptr_t - * - * 9) The following have not been defined: - * - * WINT_MIN - * WINT_MAX - * - * 10) The criteria for defining (u)int_least(*)_t isn't clear, - * except for systems which don't have a type that precisely - * defined 8, 16, or 32 bit types (which this include file does - * not support anyways). Default definitions have been given. - * - * 11) The criteria for defining (u)int_fast(*)_t isn't something I - * would trust to any particular compiler vendor or the ANSI C - * committee. It is well known that "compatible systems" are - * commonly created that have very different performance - * characteristics from the systems they are compatible with, - * especially those whose vendors make both the compiler and the - * system. Default definitions have been given, but its strongly - * recommended that users never use these definitions for any - * reason (they do *NOT* deliver any serious guarantee of - * improved performance -- not in this file, nor any vendor's - * stdint.h). - * - * 12) The following macros: - * - * PRINTF_INTMAX_MODIFIER - * PRINTF_INT64_MODIFIER - * PRINTF_INT32_MODIFIER - * PRINTF_INT16_MODIFIER - * PRINTF_LEAST64_MODIFIER - * PRINTF_LEAST32_MODIFIER - * PRINTF_LEAST16_MODIFIER - * PRINTF_INTPTR_MODIFIER - * - * are strings which have been defined as the modifiers required - * for the "d", "u" and "x" printf formats to correctly output - * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t, - * (u)least32_t, (u)least16_t and (u)intptr_t types respectively. - * PRINTF_INTPTR_MODIFIER is not defined for some systems which - * provide their own stdint.h. PRINTF_INT64_MODIFIER is not - * defined if INT64_MAX is not defined. These are an extension - * beyond what C99 specifies must be in stdint.h. - * - * In addition, the following macros are defined: - * - * PRINTF_INTMAX_HEX_WIDTH - * PRINTF_INT64_HEX_WIDTH - * PRINTF_INT32_HEX_WIDTH - * PRINTF_INT16_HEX_WIDTH - * PRINTF_INT8_HEX_WIDTH - * PRINTF_INTMAX_DEC_WIDTH - * PRINTF_INT64_DEC_WIDTH - * PRINTF_INT32_DEC_WIDTH - * PRINTF_INT16_DEC_WIDTH - * PRINTF_INT8_DEC_WIDTH - * - * Which specifies the maximum number of characters required to - * print the number of that type in either hexadecimal or decimal. - * These are an extension beyond what C99 specifies must be in - * stdint.h. - * - * Compilers tested (all with 0 warnings at their highest respective - * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32 - * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio - * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3 - * - * This file should be considered a work in progress. Suggestions for - * improvements, especially those which increase coverage are strongly - * encouraged. - * - * Acknowledgements - * - * The following people have made significant contributions to the - * development and testing of this file: - * - * Chris Howie - * John Steele Scott - * Dave Thorup - * John Dill - * - */ - -#include -#include -#include - -/* - * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and - * do nothing else. On the Mac OS X version of gcc this is _STDINT_H_. - */ - -#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED) -#include -#define _PSTDINT_H_INCLUDED -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "h" -# endif -# ifndef PRINTF_INTMAX_MODIFIER -# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER -# endif -# ifndef PRINTF_INT64_HEX_WIDTH -# define PRINTF_INT64_HEX_WIDTH "16" -# endif -# ifndef PRINTF_INT32_HEX_WIDTH -# define PRINTF_INT32_HEX_WIDTH "8" -# endif -# ifndef PRINTF_INT16_HEX_WIDTH -# define PRINTF_INT16_HEX_WIDTH "4" -# endif -# ifndef PRINTF_INT8_HEX_WIDTH -# define PRINTF_INT8_HEX_WIDTH "2" -# endif -# ifndef PRINTF_INT64_DEC_WIDTH -# define PRINTF_INT64_DEC_WIDTH "20" -# endif -# ifndef PRINTF_INT32_DEC_WIDTH -# define PRINTF_INT32_DEC_WIDTH "10" -# endif -# ifndef PRINTF_INT16_DEC_WIDTH -# define PRINTF_INT16_DEC_WIDTH "5" -# endif -# ifndef PRINTF_INT8_DEC_WIDTH -# define PRINTF_INT8_DEC_WIDTH "3" -# endif -# ifndef PRINTF_INTMAX_HEX_WIDTH -# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH -# endif -# ifndef PRINTF_INTMAX_DEC_WIDTH -# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH -# endif - -/* - * Something really weird is going on with Open Watcom. Just pull some of - * these duplicated definitions from Open Watcom's stdint.h file for now. - */ - -# if defined (__WATCOMC__) && __WATCOMC__ >= 1250 -# if !defined (INT64_C) -# define INT64_C(x) (x + (INT64_MAX - INT64_MAX)) -# endif -# if !defined (UINT64_C) -# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX)) -# endif -# if !defined (INT32_C) -# define INT32_C(x) (x + (INT32_MAX - INT32_MAX)) -# endif -# if !defined (UINT32_C) -# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX)) -# endif -# if !defined (INT16_C) -# define INT16_C(x) (x) -# endif -# if !defined (UINT16_C) -# define UINT16_C(x) (x) -# endif -# if !defined (INT8_C) -# define INT8_C(x) (x) -# endif -# if !defined (UINT8_C) -# define UINT8_C(x) (x) -# endif -# if !defined (UINT64_MAX) -# define UINT64_MAX 18446744073709551615ULL -# endif -# if !defined (INT64_MAX) -# define INT64_MAX 9223372036854775807LL -# endif -# if !defined (UINT32_MAX) -# define UINT32_MAX 4294967295UL -# endif -# if !defined (INT32_MAX) -# define INT32_MAX 2147483647L -# endif -# if !defined (INTMAX_MAX) -# define INTMAX_MAX INT64_MAX -# endif -# if !defined (INTMAX_MIN) -# define INTMAX_MIN INT64_MIN -# endif -# endif -#endif - -#ifndef _PSTDINT_H_INCLUDED -#define _PSTDINT_H_INCLUDED - -#ifndef SIZE_MAX -# define SIZE_MAX (~(size_t)0) -#endif - -/* - * Deduce the type assignments from limits.h under the assumption that - * integer sizes in bits are powers of 2, and follow the ANSI - * definitions. - */ - -#ifndef UINT8_MAX -# define UINT8_MAX 0xff -#endif -#ifndef uint8_t -# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S) - typedef unsigned char uint8_t; -# define UINT8_C(v) ((uint8_t) v) -# else -# error "Platform not supported" -# endif -#endif - -#ifndef INT8_MAX -# define INT8_MAX 0x7f -#endif -#ifndef INT8_MIN -# define INT8_MIN INT8_C(0x80) -#endif -#ifndef int8_t -# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S) - typedef signed char int8_t; -# define INT8_C(v) ((int8_t) v) -# else -# error "Platform not supported" -# endif -#endif - -#ifndef UINT16_MAX -# define UINT16_MAX 0xffff -#endif -#ifndef uint16_t -#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S) - typedef unsigned int uint16_t; -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "" -# endif -# define UINT16_C(v) ((uint16_t) (v)) -#elif (USHRT_MAX == UINT16_MAX) - typedef unsigned short uint16_t; -# define UINT16_C(v) ((uint16_t) (v)) -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "h" -# endif -#else -#error "Platform not supported" -#endif -#endif - -#ifndef INT16_MAX -# define INT16_MAX 0x7fff -#endif -#ifndef INT16_MIN -# define INT16_MIN INT16_C(0x8000) -#endif -#ifndef int16_t -#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S) - typedef signed int int16_t; -# define INT16_C(v) ((int16_t) (v)) -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "" -# endif -#elif (SHRT_MAX == INT16_MAX) - typedef signed short int16_t; -# define INT16_C(v) ((int16_t) (v)) -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "h" -# endif -#else -#error "Platform not supported" -#endif -#endif - -#ifndef UINT32_MAX -# define UINT32_MAX (0xffffffffUL) -#endif -#ifndef uint32_t -#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) - typedef unsigned long uint32_t; -# define UINT32_C(v) v ## UL -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -#elif (UINT_MAX == UINT32_MAX) - typedef unsigned int uint32_t; -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -# define UINT32_C(v) v ## U -#elif (USHRT_MAX == UINT32_MAX) - typedef unsigned short uint32_t; -# define UINT32_C(v) ((unsigned short) (v)) -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -#else -#error "Platform not supported" -#endif -#endif - -#ifndef INT32_MAX -# define INT32_MAX (0x7fffffffL) -#endif -#ifndef INT32_MIN -# define INT32_MIN INT32_C(0x80000000) -#endif -#ifndef int32_t -#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) - typedef signed long int32_t; -# define INT32_C(v) v ## L -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -#elif (INT_MAX == INT32_MAX) - typedef signed int int32_t; -# define INT32_C(v) v -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -#elif (SHRT_MAX == INT32_MAX) - typedef signed short int32_t; -# define INT32_C(v) ((short) (v)) -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -#else -#error "Platform not supported" -#endif -#endif - -/* - * The macro stdint_int64_defined is temporarily used to record - * whether or not 64 integer support is available. It must be - * defined for any 64 integer extensions for new platforms that are - * added. - */ - -#undef stdint_int64_defined -#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S) -# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S) -# define stdint_int64_defined - typedef long long int64_t; - typedef unsigned long long uint64_t; -# define UINT64_C(v) v ## ULL -# define INT64_C(v) v ## LL -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# endif -#endif - -#if !defined (stdint_int64_defined) -# if defined(__GNUC__) -# define stdint_int64_defined - __extension__ typedef long long int64_t; - __extension__ typedef unsigned long long uint64_t; -# define UINT64_C(v) v ## ULL -# define INT64_C(v) v ## LL -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S) -# define stdint_int64_defined - typedef long long int64_t; - typedef unsigned long long uint64_t; -# define UINT64_C(v) v ## ULL -# define INT64_C(v) v ## LL -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC) -# define stdint_int64_defined - typedef __int64 int64_t; - typedef unsigned __int64 uint64_t; -# define UINT64_C(v) v ## UI64 -# define INT64_C(v) v ## I64 -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "I64" -# endif -# endif -#endif - -#if !defined (LONG_LONG_MAX) && defined (INT64_C) -# define LONG_LONG_MAX INT64_C (9223372036854775807) -#endif -#ifndef ULONG_LONG_MAX -# define ULONG_LONG_MAX UINT64_C (18446744073709551615) -#endif - -#if !defined (INT64_MAX) && defined (INT64_C) -# define INT64_MAX INT64_C (9223372036854775807) -#endif -#if !defined (INT64_MIN) && defined (INT64_C) -# define INT64_MIN INT64_C (-9223372036854775808) -#endif -#if !defined (UINT64_MAX) && defined (INT64_C) -# define UINT64_MAX UINT64_C (18446744073709551615) -#endif - -/* - * Width of hexadecimal for number field. - */ - -#ifndef PRINTF_INT64_HEX_WIDTH -# define PRINTF_INT64_HEX_WIDTH "16" -#endif -#ifndef PRINTF_INT32_HEX_WIDTH -# define PRINTF_INT32_HEX_WIDTH "8" -#endif -#ifndef PRINTF_INT16_HEX_WIDTH -# define PRINTF_INT16_HEX_WIDTH "4" -#endif -#ifndef PRINTF_INT8_HEX_WIDTH -# define PRINTF_INT8_HEX_WIDTH "2" -#endif - -#ifndef PRINTF_INT64_DEC_WIDTH -# define PRINTF_INT64_DEC_WIDTH "20" -#endif -#ifndef PRINTF_INT32_DEC_WIDTH -# define PRINTF_INT32_DEC_WIDTH "10" -#endif -#ifndef PRINTF_INT16_DEC_WIDTH -# define PRINTF_INT16_DEC_WIDTH "5" -#endif -#ifndef PRINTF_INT8_DEC_WIDTH -# define PRINTF_INT8_DEC_WIDTH "3" -#endif - -/* - * Ok, lets not worry about 128 bit integers for now. Moore's law says - * we don't need to worry about that until about 2040 at which point - * we'll have bigger things to worry about. - */ - -#ifdef stdint_int64_defined - typedef int64_t intmax_t; - typedef uint64_t uintmax_t; -# define INTMAX_MAX INT64_MAX -# define INTMAX_MIN INT64_MIN -# define UINTMAX_MAX UINT64_MAX -# define UINTMAX_C(v) UINT64_C(v) -# define INTMAX_C(v) INT64_C(v) -# ifndef PRINTF_INTMAX_MODIFIER -# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER -# endif -# ifndef PRINTF_INTMAX_HEX_WIDTH -# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH -# endif -# ifndef PRINTF_INTMAX_DEC_WIDTH -# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH -# endif -#else - typedef int32_t intmax_t; - typedef uint32_t uintmax_t; -# define INTMAX_MAX INT32_MAX -# define UINTMAX_MAX UINT32_MAX -# define UINTMAX_C(v) UINT32_C(v) -# define INTMAX_C(v) INT32_C(v) -# ifndef PRINTF_INTMAX_MODIFIER -# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER -# endif -# ifndef PRINTF_INTMAX_HEX_WIDTH -# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH -# endif -# ifndef PRINTF_INTMAX_DEC_WIDTH -# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH -# endif -#endif - -/* - * Because this file currently only supports platforms which have - * precise powers of 2 as bit sizes for the default integers, the - * least definitions are all trivial. Its possible that a future - * version of this file could have different definitions. - */ - -#ifndef stdint_least_defined - typedef int8_t int_least8_t; - typedef uint8_t uint_least8_t; - typedef int16_t int_least16_t; - typedef uint16_t uint_least16_t; - typedef int32_t int_least32_t; - typedef uint32_t uint_least32_t; -# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER -# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER -# define UINT_LEAST8_MAX UINT8_MAX -# define INT_LEAST8_MAX INT8_MAX -# define UINT_LEAST16_MAX UINT16_MAX -# define INT_LEAST16_MAX INT16_MAX -# define UINT_LEAST32_MAX UINT32_MAX -# define INT_LEAST32_MAX INT32_MAX -# define INT_LEAST8_MIN INT8_MIN -# define INT_LEAST16_MIN INT16_MIN -# define INT_LEAST32_MIN INT32_MIN -# ifdef stdint_int64_defined - typedef int64_t int_least64_t; - typedef uint64_t uint_least64_t; -# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER -# define UINT_LEAST64_MAX UINT64_MAX -# define INT_LEAST64_MAX INT64_MAX -# define INT_LEAST64_MIN INT64_MIN -# endif -#endif -#undef stdint_least_defined - -/* - * The ANSI C committee pretending to know or specify anything about - * performance is the epitome of misguided arrogance. The mandate of - * this file is to *ONLY* ever support that absolute minimum - * definition of the fast integer types, for compatibility purposes. - * No extensions, and no attempt to suggest what may or may not be a - * faster integer type will ever be made in this file. Developers are - * warned to stay away from these types when using this or any other - * stdint.h. - */ - -typedef int_least8_t int_fast8_t; -typedef uint_least8_t uint_fast8_t; -typedef int_least16_t int_fast16_t; -typedef uint_least16_t uint_fast16_t; -typedef int_least32_t int_fast32_t; -typedef uint_least32_t uint_fast32_t; -#define UINT_FAST8_MAX UINT_LEAST8_MAX -#define INT_FAST8_MAX INT_LEAST8_MAX -#define UINT_FAST16_MAX UINT_LEAST16_MAX -#define INT_FAST16_MAX INT_LEAST16_MAX -#define UINT_FAST32_MAX UINT_LEAST32_MAX -#define INT_FAST32_MAX INT_LEAST32_MAX -#define INT_FAST8_MIN INT_LEAST8_MIN -#define INT_FAST16_MIN INT_LEAST16_MIN -#define INT_FAST32_MIN INT_LEAST32_MIN -#ifdef stdint_int64_defined - typedef int_least64_t int_fast64_t; - typedef uint_least64_t uint_fast64_t; -# define UINT_FAST64_MAX UINT_LEAST64_MAX -# define INT_FAST64_MAX INT_LEAST64_MAX -# define INT_FAST64_MIN INT_LEAST64_MIN -#endif - -#undef stdint_int64_defined - -/* - * Whatever piecemeal, per compiler thing we can do about the wchar_t - * type limits. - */ - -#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) -# include -# ifndef WCHAR_MIN -# define WCHAR_MIN 0 -# endif -# ifndef WCHAR_MAX -# define WCHAR_MAX ((wchar_t)-1) -# endif -#endif - -/* - * Whatever piecemeal, per compiler/platform thing we can do about the - * (u)intptr_t types and limits. - */ - -#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED) -# define STDINT_H_UINTPTR_T_DEFINED -#endif - -#ifndef STDINT_H_UINTPTR_T_DEFINED -# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) -# define stdint_intptr_bits 64 -# elif defined (__WATCOMC__) || defined (__TURBOC__) -# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__) -# define stdint_intptr_bits 16 -# else -# define stdint_intptr_bits 32 -# endif -# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) -# define stdint_intptr_bits 32 -# elif defined (__INTEL_COMPILER) -/* TODO -- what did Intel do about x86-64? */ -# endif - -# ifdef stdint_intptr_bits -# define stdint_intptr_glue3_i(a,b,c) a##b##c -# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c) -# ifndef PRINTF_INTPTR_MODIFIER -# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER) -# endif -# ifndef PTRDIFF_MAX -# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) -# endif -# ifndef PTRDIFF_MIN -# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) -# endif -# ifndef UINTPTR_MAX -# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX) -# endif -# ifndef INTPTR_MAX -# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) -# endif -# ifndef INTPTR_MIN -# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) -# endif -# ifndef INTPTR_C -# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x) -# endif -# ifndef UINTPTR_C -# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x) -# endif - typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t; - typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t; -# else -/* TODO -- This following is likely wrong for some platforms, and does - nothing for the definition of uintptr_t. */ - typedef ptrdiff_t intptr_t; -# endif -# define STDINT_H_UINTPTR_T_DEFINED -#endif - -/* - * Assumes sig_atomic_t is signed and we have a 2s complement machine. - */ - -#ifndef SIG_ATOMIC_MAX -# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1) -#endif - -#endif - -#if defined (__TEST_PSTDINT_FOR_CORRECTNESS) - -/* - * Please compile with the maximum warning settings to make sure macros are not - * defined more than once. - */ - -#include -#include -#include - -#define glue3_aux(x,y,z) x ## y ## z -#define glue3(x,y,z) glue3_aux(x,y,z) - -#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0); -#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0); - -#define DECL(us,bits) glue3(DECL,us,) (bits) - -#define TESTUMAX(bits) glue3(u,bits,=) glue3(~,u,bits); if (glue3(UINT,bits,_MAX) glue3(!=,u,bits)) printf ("Something wrong with UINT%d_MAX\n", bits) - -int main () { - DECL(I,8) - DECL(U,8) - DECL(I,16) - DECL(U,16) - DECL(I,32) - DECL(U,32) -#ifdef INT64_MAX - DECL(I,64) - DECL(U,64) -#endif - intmax_t imax = INTMAX_C(0); - uintmax_t umax = UINTMAX_C(0); - char str0[256], str1[256]; - - sprintf (str0, "%d %x\n", 0, ~0); - - sprintf (str1, "%d %x\n", i8, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with i8 : %s\n", str1); - sprintf (str1, "%u %x\n", u8, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with u8 : %s\n", str1); - sprintf (str1, "%d %x\n", i16, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with i16 : %s\n", str1); - sprintf (str1, "%u %x\n", u16, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with u16 : %s\n", str1); - sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with i32 : %s\n", str1); - sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with u32 : %s\n", str1); -#ifdef INT64_MAX - sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with i64 : %s\n", str1); -#endif - sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with imax : %s\n", str1); - sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0); - if (0 != strcmp (str0, str1)) printf ("Something wrong with umax : %s\n", str1); - - TESTUMAX(8); - TESTUMAX(16); - TESTUMAX(32); -#ifdef INT64_MAX - TESTUMAX(64); -#endif - - return EXIT_SUCCESS; -} - -#endif diff --git a/include/regchannel.h b/include/regchannel.h index 416b0280d..402ed065b 100644 --- a/include/regchannel.h +++ b/include/regchannel.h @@ -7,8 +7,7 @@ * */ -#ifndef REGCHANNEL_H -#define REGCHANNEL_H +#pragma once #include "memo.h" #include "modes.h" @@ -39,7 +38,7 @@ class CoreExport AutoKick : public Serializable AutoKick(); ~AutoKick(); - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &); }; @@ -95,7 +94,7 @@ class CoreExport ChannelInfo : public Serializable, public Extensible ~ChannelInfo(); - void Serialize(Serialize::Data &data) const anope_override; + void Serialize(Serialize::Data &data) const override; static Serializable* Unserialize(Serializable *obj, Serialize::Data &); /** Change the founder of the channek @@ -245,4 +244,3 @@ class CoreExport ChannelInfo : public Serializable, public Extensible */ extern CoreExport bool IsFounder(const User *user, const ChannelInfo *ci); -#endif // REGCHANNEL_H diff --git a/include/regexpr.h b/include/regexpr.h index c46179d68..d8b96d750 100644 --- a/include/regexpr.h +++ b/include/regexpr.h @@ -10,8 +10,7 @@ * */ -#ifndef REGEXPR_H -#define REGEXPR_H +#pragma once #include "services.h" #include "anope.h" @@ -43,5 +42,3 @@ class CoreExport RegexProvider : public Service virtual Regex *Compile(const Anope::string &) = 0; }; -#endif // REGEXPR_H - diff --git a/include/serialize.h b/include/serialize.h index 496110fda..4bfdd0cb3 100644 --- a/include/serialize.h +++ b/include/serialize.h @@ -10,8 +10,7 @@ * */ -#ifndef SERIALIZE_H -#define SERIALIZE_H +#pragma once #include @@ -333,4 +332,3 @@ class Serialize::Reference : public ReferenceBase } }; -#endif // SERIALIZE_H diff --git a/include/servers.h b/include/servers.h index 7a2a594f1..743dc5d9c 100644 --- a/include/servers.h +++ b/include/servers.h @@ -10,8 +10,7 @@ * */ -#ifndef SERVERS_H -#define SERVERS_H +#pragma once #include "services.h" #include "anope.h" @@ -189,4 +188,3 @@ class CoreExport Server : public Extensible static Server *Find(const Anope::string &name, bool name_only = false); }; -#endif // SERVERS_H diff --git a/include/service.h b/include/service.h index 8142363d6..32686afb5 100644 --- a/include/service.h +++ b/include/service.h @@ -10,8 +10,7 @@ * */ -#ifndef SERVICE_H -#define SERVICE_H +#pragma once #include "services.h" #include "anope.h" @@ -135,7 +134,7 @@ class ServiceReference : public Reference this->invalid = true; } - operator bool() anope_override + operator bool() override { if (this->invalid) { @@ -171,5 +170,3 @@ class ServiceAlias } }; -#endif // SERVICE_H - diff --git a/include/services.h b/include/services.h index af585dcd6..45eb84c32 100644 --- a/include/services.h +++ b/include/services.h @@ -10,8 +10,7 @@ * */ -#ifndef SERVICES_H -#define SERVICES_H +#pragma once #include "sysconf.h" @@ -20,12 +19,10 @@ #include #include #include +#include #include #include -#if HAVE_STRINGS_H -# include -#endif #ifndef _WIN32 #include @@ -49,14 +46,6 @@ #define _(x) x -#ifdef __GXX_EXPERIMENTAL_CXX0X__ -# define anope_override override -# define anope_final final -#else -# define anope_override -# define anope_final -#endif - #ifndef _WIN32 # define DllExport # define CoreExport @@ -66,4 +55,3 @@ # include "anope_windows.h" #endif -#endif // SERVICES_H diff --git a/include/socketengine.h b/include/socketengine.h index 8772b14a6..ac6f2a35b 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -10,8 +10,7 @@ * */ -#ifndef SOCKETENGINE_H -#define SOCKETENGINE_H +#pragma once #include "services.h" #include "sockets.h" @@ -48,4 +47,3 @@ class CoreExport SocketEngine static bool IgnoreErrno(); }; -#endif // SOCKETENGINE_H diff --git a/include/sockets.h b/include/sockets.h index 0dfa5d9d0..a2c713207 100644 --- a/include/sockets.h +++ b/include/sockets.h @@ -10,8 +10,7 @@ * */ -#ifndef SOCKETS_H -#define SOCKETS_H +#pragma once #ifndef _WIN32 #include @@ -284,12 +283,12 @@ class CoreExport BufferedSocket : public virtual Socket /** Called when there is something to be received for this socket * @return true on success, false to drop this socket */ - bool ProcessRead() anope_override; + bool ProcessRead() override; /** Called when the socket is ready to be written to * @return true on success, false to drop this socket */ - bool ProcessWrite() anope_override; + bool ProcessWrite() override; /** Gets the new line from the input buffer, if any */ @@ -338,12 +337,12 @@ class CoreExport BinarySocket : public virtual Socket /** Called when there is something to be received for this socket * @return true on success, false to drop this socket */ - bool ProcessRead() anope_override; + bool ProcessRead() override; /** Called when the socket is ready to be written to * @return true on success, false to drop this socket */ - bool ProcessWrite() anope_override; + bool ProcessWrite() override; /** Write data to the socket * @param buffer The data to write @@ -401,12 +400,12 @@ class CoreExport ConnectionSocket : public virtual Socket * Used to determine whether or not this socket is connected yet. * @return true to continue to call ProcessRead/ProcessWrite, false to not continue */ - bool Process() anope_override; + bool Process() override; /** Called when there is an error for this socket * @return true on success, false to drop this socket */ - void ProcessError() anope_override; + void ProcessError() override; /** Called on a successful connect */ @@ -436,12 +435,12 @@ class CoreExport ClientSocket : public virtual Socket * Used to determine whether or not this socket is connected yet. * @return true to continue to call ProcessRead/ProcessWrite, false to not continue */ - bool Process() anope_override; + bool Process() override; /** Called when there is an error for this socket * @return true on success, false to drop this socket */ - void ProcessE