diff --git a/gui/cppchecklibrarydata.h b/gui/cppchecklibrarydata.h index afe39df5050..ddccf3b6534 100644 --- a/gui/cppchecklibrarydata.h +++ b/gui/cppchecklibrarydata.h @@ -19,8 +19,6 @@ #ifndef CPPCHECKLIBRARYDATA_H #define CPPCHECKLIBRARYDATA_H -#include "config.h" - #include #include @@ -230,7 +228,7 @@ class CppcheckLibraryData { entrypoints.clear(); } - void swap(CppcheckLibraryData &other) NOEXCEPT { + void swap(CppcheckLibraryData &other) noexcept { containers.swap(other.containers); defines.swap(other.defines); undefines.swap(other.undefines); diff --git a/lib/checkleakautovar.h b/lib/checkleakautovar.h index b7f57d0bd5e..d7d8d390b3d 100644 --- a/lib/checkleakautovar.h +++ b/lib/checkleakautovar.h @@ -75,7 +75,7 @@ class CPPCHECKLIB VarInfo { referenced.erase(varid); } - void swap(VarInfo &other) NOEXCEPT { + void swap(VarInfo &other) noexcept { alloctype.swap(other.alloctype); possibleUsage.swap(other.possibleUsage); conditionalAlloc.swap(other.conditionalAlloc); diff --git a/lib/config.h b/lib/config.h index ca60904c5d9..960c2c91aa4 100644 --- a/lib/config.h +++ b/lib/config.h @@ -52,16 +52,6 @@ #define __has_feature(x) 0 #endif -// C++11 noexcept -#if defined(__cpp_noexcept_function_type) || \ - (defined(__GNUC__) && (__GNUC__ >= 5)) \ - || defined(__clang__) \ - || defined(__CPPCHECK__) -# define NOEXCEPT noexcept -#else -# define NOEXCEPT -#endif - // C++11 noreturn #if __has_cpp_attribute (noreturn) \ || (defined(__GNUC__) && (__GNUC__ >= 5)) \ diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index 889826380db..eb0b290ac6c 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -205,7 +205,7 @@ void ProgramMemory::erase_if(const std::function& pred } } -void ProgramMemory::swap(ProgramMemory &pm) NOEXCEPT +void ProgramMemory::swap(ProgramMemory &pm) noexcept { mValues.swap(pm.mValues); } diff --git a/lib/programmemory.h b/lib/programmemory.h index adb0d1469ce..bb68a9404d4 100644 --- a/lib/programmemory.h +++ b/lib/programmemory.h @@ -79,11 +79,11 @@ struct ExprIdToken { return !(lhs < rhs); } - const Token& operator*() const NOEXCEPT { + const Token& operator*() const noexcept { return *tok; } - const Token* operator->() const NOEXCEPT { + const Token* operator->() const noexcept { return tok; } @@ -128,7 +128,7 @@ struct CPPCHECKLIB ProgramMemory { void erase_if(const std::function& pred); - void swap(ProgramMemory &pm) NOEXCEPT; + void swap(ProgramMemory &pm) noexcept; void clear(); diff --git a/lib/tokenlist.h b/lib/tokenlist.h index 48cf5d99547..ae61fff6de4 100644 --- a/lib/tokenlist.h +++ b/lib/tokenlist.h @@ -56,7 +56,7 @@ class CPPCHECKLIB TokenList { TokenList(const TokenList &) = delete; TokenList &operator=(const TokenList &) = delete; - TokenList(TokenList&& other) NOEXCEPT = default; + TokenList(TokenList&& other) noexcept = default; /** @return the source file path. e.g. "file.cpp" */ const std::string& getSourceFilePath() const; diff --git a/lib/valueptr.h b/lib/valueptr.h index 5e0bea0196b..270b5f58fc6 100644 --- a/lib/valueptr.h +++ b/lib/valueptr.h @@ -53,12 +53,12 @@ class CPPCHECKLIB ValuePtr { mPtr.reset(mClone(rhs.get())); } } - ValuePtr(ValuePtr&& rhs) NOEXCEPT : mPtr(std::move(rhs.mPtr)), mClone(std::move(rhs.mClone)) {} + ValuePtr(ValuePtr&& rhs) noexcept : mPtr(std::move(rhs.mPtr)), mClone(std::move(rhs.mClone)) {} - T* get() NOEXCEPT { + T* get() noexcept { return mPtr.get(); } - const T* get() const NOEXCEPT { + const T* get() const noexcept { return mPtr.get(); } @@ -69,14 +69,14 @@ class CPPCHECKLIB ValuePtr { return *get(); } - T* operator->() NOEXCEPT { + T* operator->() noexcept { return get(); } - const T* operator->() const NOEXCEPT { + const T* operator->() const noexcept { return get(); } - void swap(ValuePtr& rhs) NOEXCEPT { + void swap(ValuePtr& rhs) noexcept { using std::swap; swap(mPtr, rhs.mPtr); swap(mClone, rhs.mClone); @@ -88,7 +88,7 @@ class CPPCHECKLIB ValuePtr { } // NOLINTNEXTLINE(google-explicit-constructor) - operator bool() const NOEXCEPT { + operator bool() const noexcept { return !!mPtr; }