From 6eb1beb8f88a8862296d0b29eb3e081936f7f76b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brandl=2C=20Matth=C3=A4us=20=28MBR=29?= Date: Thu, 1 Mar 2018 11:11:06 +0100 Subject: [PATCH] Reduces the usage of noexcept in accordance with a discussion with zeux in the PR 183 --- src/pugixml.cpp | 10 +++++----- src/pugixml.hpp | 15 +++++++++------ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index f97028e..c8c2cf9 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -7591,7 +7591,7 @@ PUGI__NS_BEGIN _root_size = state._root_size; } - void release() PUGIXML_NOEXCEPT + void release() { xpath_memory_block* cur = _root; assert(cur); @@ -8613,13 +8613,13 @@ PUGI__NS_BEGIN } } - template PUGI__FN void delete_xpath_variable(T* var) PUGIXML_NOEXCEPT + template PUGI__FN void delete_xpath_variable(T* var) { var->~T(); xml_memory::deallocate(var); } - PUGI__FN void delete_xpath_variable(xpath_value_type type, xpath_variable* var) PUGIXML_NOEXCEPT + PUGI__FN void delete_xpath_variable(xpath_value_type type, xpath_variable* var) { switch (type) { @@ -11872,7 +11872,7 @@ PUGI__NS_BEGIN return new (memory) xpath_query_impl(); } - static void destroy(xpath_query_impl* impl) PUGIXML_NOEXCEPT + static void destroy(xpath_query_impl* impl) { // free all allocated pages impl->alloc.release(); @@ -12368,7 +12368,7 @@ namespace pugi return true; } - PUGI__FN void xpath_variable_set::_destroy(xpath_variable* var) PUGIXML_NOEXCEPT + PUGI__FN void xpath_variable_set::_destroy(xpath_variable* var) { while (var) { diff --git a/src/pugixml.hpp b/src/pugixml.hpp index e1a754a..a8c2006 100644 --- a/src/pugixml.hpp +++ b/src/pugixml.hpp @@ -82,15 +82,18 @@ #endif // If C++ is 2011 or higher, add 'noexcept' specifiers -#ifndef PUGIXML_NOEXCEPT +#ifndef PUGIXML_HAS_NOEXCEPT # if __cplusplus >= 201103 -# define PUGIXML_NOEXCEPT noexcept +# define PUGIXML_HAS_NOEXCEPT # elif defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026 -# define PUGIXML_NOEXCEPT noexcept -# else -# define PUGIXML_NOEXCEPT +# define PUGIXML_HAS_NOEXCEPT # endif #endif +#ifdef PUGIXML_HAS_NOEXCEPT +# define PUGIXML_NOEXCEPT noexcept +#else +# define PUGIXML_NOEXCEPT +#endif // If C++ is 2011 or higher, add 'override' qualifiers #ifndef PUGIXML_OVERRIDE @@ -1136,7 +1139,7 @@ namespace pugi xpath_variable* _find(const char_t* name) const; static bool _clone(xpath_variable* var, xpath_variable** out_result); - static void _destroy(xpath_variable* var) PUGIXML_NOEXCEPT; + static void _destroy(xpath_variable* var); public: // Default constructor/destructor