From b7abfe5eca076c29a0d49a411320612264093bdf Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 4 May 2023 17:56:37 +0100 Subject: Avoid returning null when a config tag does not exist. This invokes undefined behaviour on modern compilers. --- include/config.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/config.h b/include/config.h index 2251d5566..f3d30559c 100644 --- a/include/config.h +++ b/include/config.h @@ -129,6 +129,9 @@ namespace Configuration std::map modules; Anope::map bots; + /* Represents a missing tag. */ + Block EmptyBlock; + Conf(); ~Conf(); -- cgit From 0646547c9eecc464dfc3c6fb0c7dfa9a3298a268 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 28 May 2023 20:40:00 -0400 Subject: config: remove dependency on no-delete-null-pointer-checks --- include/config.h | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/config.h b/include/config.h index f3d30559c..f3e5d8816 100644 --- a/include/config.h +++ b/include/config.h @@ -20,9 +20,11 @@ namespace Configuration { + namespace Internal + { class CoreExport Block { - friend struct Conf; + friend struct Configuration::Conf; public: typedef Anope::map item_map; @@ -34,13 +36,17 @@ namespace Configuration block_map blocks; int linenum; + /* Represents a missing tag. */ + static Block EmptyBlock; + public: Block(const Anope::string &); const Anope::string &GetName() const; - int CountBlock(const Anope::string &name); - Block* GetBlock(const Anope::string &name, int num = 0); + int CountBlock(const Anope::string &name) const; + const Block* GetBlock(const Anope::string &name, int num = 0) const; + Block* GetMutableBlock(const Anope::string &name, int num = 0); - template inline T Get(const Anope::string &tag) + template inline T Get(const Anope::string &tag) const { return this->Get(tag, ""); } @@ -66,6 +72,10 @@ namespace Configuration template<> CoreExport const Anope::string Block::Get(const Anope::string &tag, const Anope::string& def) const; template<> CoreExport time_t Block::Get(const Anope::string &tag, const Anope::string &def) const; template<> CoreExport bool Block::Get(const Anope::string &tag, const Anope::string &def) const; + } // namespace Internal + + typedef const Internal::Block Block; + typedef Internal::Block MutableBlock; /** Represents a configuration file */ @@ -129,9 +139,6 @@ namespace Configuration std::map modules; Anope::map bots; - /* Represents a missing tag. */ - Block EmptyBlock; - Conf(); ~Conf(); @@ -143,7 +150,7 @@ namespace Configuration BotInfo *GetClient(const Anope::string &name); - Block *GetCommand(CommandSource &); + const Block *GetCommand(CommandSource &); }; struct Uplink -- cgit From 66f37139cba97f2bb2a490376ffc33f153900b6c Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 28 May 2023 21:25:02 -0400 Subject: regchannels: remove dependency on no-delete-null-pointer-checks --- include/channels.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/channels.h b/include/channels.h index c6f9b66ad..e3ce9acf1 100644 --- a/include/channels.h +++ b/include/channels.h @@ -289,6 +289,11 @@ class CoreExport Channel : public Base, public Extensible */ bool CheckKick(User *user); + /** Find which bot should send mode/topic/etc changes for this channel + * @return The bot + */ + BotInfo *WhoSends() const; + /** Finds a channel * @param name The channel to find * @return The channel, if found -- cgit From fbf3b344740f6bd4f9337e485e35e9e8103428bc Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 2 Jun 2023 23:01:27 -0400 Subject: add gettext to conan deps --- include/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 73e57f59e..a434be6e1 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -6,8 +6,8 @@ set_target_properties(version-bin PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${L get_target_property(version_BINARY version-bin LOCATION) # Modify version.h from the above executable, with dependencies to version.cpp # and all of the source files in the main build -add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version_build - COMMAND ${version_BINARY} ${Anope_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h + COMMAND version-bin ${Anope_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h DEPENDS version-bin ${SRC_SRCS} ) # Add version-bin to list of files for CPack to ignore @@ -61,4 +61,4 @@ if(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX) endif(USE_PCH AND CMAKE_COMPILER_IS_GNUCXX) # Add a custom target to the above file -add_custom_target(headers DEPENDS version-bin ${CMAKE_CURRENT_BINARY_DIR}/version_build ${PCH_SOURCES_GCH}) +add_custom_target(headers DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_BINARY_DIR}/build.h ${PCH_SOURCES_GCH}) -- cgit