From 1a1739b20085bd648b850f633ca234a805897ee2 Mon Sep 17 00:00:00 2001 From: ddzama Date: Wed, 17 Aug 2022 11:11:26 +0300 Subject: [PATCH] 0032957: Add Standard_Noexcept definition into Standard_Macro.hxx and employ Standard_Noexcept. --- src/NCollection/NCollection_AliasedArray.hxx | 3 ++- src/Poly/Poly_ArrayOfNodes.hxx | 5 +++-- src/Poly/Poly_ArrayOfUVNodes.hxx | 5 +++-- src/Standard/Standard_Handle.hxx | 5 +++-- src/Standard/Standard_Macro.hxx | 16 ++++++++++++++++ src/TCollection/TCollection_AsciiString.hxx | 5 +++-- src/TCollection/TCollection_ExtendedString.hxx | 5 +++-- src/TopLoc/TopLoc_SListOfItemLocation.hxx | 5 +++-- 8 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src/NCollection/NCollection_AliasedArray.hxx b/src/NCollection/NCollection_AliasedArray.hxx index 678939bfc3..c8916b366c 100644 --- a/src/NCollection/NCollection_AliasedArray.hxx +++ b/src/NCollection/NCollection_AliasedArray.hxx @@ -18,6 +18,7 @@ #include #include #include +#include //! Defines an array of values of configurable size. //! For instance, this class allows defining an array of 32-bit or 64-bit integer values with bitness determined in runtime. @@ -63,7 +64,7 @@ public: } //! Move constructor - NCollection_AliasedArray (NCollection_AliasedArray&& theOther) noexcept + NCollection_AliasedArray (NCollection_AliasedArray&& theOther) Standard_Noexcept : myData (theOther.myData), myStride (theOther.myStride), mySize (theOther.mySize), myDeletable (theOther.myDeletable) { theOther.myDeletable = false; diff --git a/src/Poly/Poly_ArrayOfNodes.hxx b/src/Poly/Poly_ArrayOfNodes.hxx index 94f26b887d..81a8e45ae0 100644 --- a/src/Poly/Poly_ArrayOfNodes.hxx +++ b/src/Poly/Poly_ArrayOfNodes.hxx @@ -17,6 +17,7 @@ #include #include #include +#include //! Defines an array of 3D nodes of single/double precision configurable at construction time. class Poly_ArrayOfNodes : public NCollection_AliasedArray<> @@ -85,14 +86,14 @@ public: Poly_ArrayOfNodes& operator= (const Poly_ArrayOfNodes& theOther) { return Assign (theOther); } //! Move constructor - Poly_ArrayOfNodes (Poly_ArrayOfNodes&& theOther) noexcept + Poly_ArrayOfNodes (Poly_ArrayOfNodes&& theOther) Standard_Noexcept : NCollection_AliasedArray (std::move (theOther)) { // } //! Move assignment operator; @sa Move() - Poly_ArrayOfNodes& operator= (Poly_ArrayOfNodes&& theOther) noexcept + Poly_ArrayOfNodes& operator= (Poly_ArrayOfNodes&& theOther) Standard_Noexcept { return Move (theOther); } diff --git a/src/Poly/Poly_ArrayOfUVNodes.hxx b/src/Poly/Poly_ArrayOfUVNodes.hxx index 682be382d2..19f4e2491a 100644 --- a/src/Poly/Poly_ArrayOfUVNodes.hxx +++ b/src/Poly/Poly_ArrayOfUVNodes.hxx @@ -17,6 +17,7 @@ #include #include #include +#include //! Defines an array of 2D nodes of single/double precision configurable at construction time. class Poly_ArrayOfUVNodes : public NCollection_AliasedArray<> @@ -85,14 +86,14 @@ public: Poly_ArrayOfUVNodes& operator= (const Poly_ArrayOfUVNodes& theOther) { return Assign (theOther); } //! Move constructor - Poly_ArrayOfUVNodes (Poly_ArrayOfUVNodes&& theOther) noexcept + Poly_ArrayOfUVNodes (Poly_ArrayOfUVNodes&& theOther) Standard_Noexcept : NCollection_AliasedArray (std::move (theOther)) { // } //! Move assignment operator; @sa Move() - Poly_ArrayOfUVNodes& operator= (Poly_ArrayOfUVNodes&& theOther) noexcept + Poly_ArrayOfUVNodes& operator= (Poly_ArrayOfUVNodes&& theOther) Standard_Noexcept { return Move (theOther); } diff --git a/src/Standard/Standard_Handle.hxx b/src/Standard/Standard_Handle.hxx index 723dd90324..6c212951b3 100644 --- a/src/Standard/Standard_Handle.hxx +++ b/src/Standard/Standard_Handle.hxx @@ -18,6 +18,7 @@ #include #include #include +#include class Standard_Transient; @@ -71,7 +72,7 @@ namespace opencascade { } //! Move constructor - handle (handle&& theHandle) noexcept : entity(theHandle.entity) + handle (handle&& theHandle) Standard_Noexcept : entity(theHandle.entity) { theHandle.entity = 0; } @@ -112,7 +113,7 @@ namespace opencascade { } //! Move operator - handle& operator= (handle&& theHandle) noexcept + handle& operator= (handle&& theHandle) Standard_Noexcept { std::swap (this->entity, theHandle.entity); return *this; diff --git a/src/Standard/Standard_Macro.hxx b/src/Standard/Standard_Macro.hxx index a2f949d357..85f2785eae 100644 --- a/src/Standard/Standard_Macro.hxx +++ b/src/Standard/Standard_Macro.hxx @@ -315,5 +315,21 @@ #define Standard_ATOMIC(theType) theType #endif +//! @def Standard_Noexcept +//! Definition of Standard_Noexcept: +//! if noexcept is accessible, Standard_Noexcept is "noexcept" and "throw()" otherwise. +#ifdef _MSC_VER + #if _MSC_VER >= 1900 + #define Standard_Noexcept noexcept + #else + #define Standard_Noexcept throw() + #endif +#else + #if __cplusplus >= 201103L + #define Standard_Noexcept noexcept + #else + #define Standard_Noexcept throw() + #endif +#endif #endif diff --git a/src/TCollection/TCollection_AsciiString.hxx b/src/TCollection/TCollection_AsciiString.hxx index ccb68cde32..0e5d2ff82a 100644 --- a/src/TCollection/TCollection_AsciiString.hxx +++ b/src/TCollection/TCollection_AsciiString.hxx @@ -26,6 +26,7 @@ #include #include #include +#include class TCollection_ExtendedString; //! Class defines a variable-length sequence of 8-bit characters. @@ -74,7 +75,7 @@ public: Standard_EXPORT TCollection_AsciiString(const TCollection_AsciiString& astring); //! Move constructor - TCollection_AsciiString (TCollection_AsciiString&& theOther) noexcept + TCollection_AsciiString (TCollection_AsciiString&& theOther) Standard_Noexcept : mystring (theOther.mystring), mylength (theOther.mylength) { @@ -276,7 +277,7 @@ void operator = (const TCollection_AsciiString& fromwhere) Standard_EXPORT void Swap (TCollection_AsciiString& theOther); //! Move assignment operator - TCollection_AsciiString& operator= (TCollection_AsciiString&& theOther) noexcept { Swap (theOther); return *this; } + TCollection_AsciiString& operator= (TCollection_AsciiString&& theOther) Standard_Noexcept { Swap (theOther); return *this; } //! Frees memory allocated by AsciiString. Standard_EXPORT ~TCollection_AsciiString(); diff --git a/src/TCollection/TCollection_ExtendedString.hxx b/src/TCollection/TCollection_ExtendedString.hxx index 1786028e79..f71869ac6f 100644 --- a/src/TCollection/TCollection_ExtendedString.hxx +++ b/src/TCollection/TCollection_ExtendedString.hxx @@ -31,6 +31,7 @@ #include #include #include +#include class TCollection_AsciiString; @@ -98,7 +99,7 @@ public: Standard_EXPORT TCollection_ExtendedString(const TCollection_ExtendedString& astring); //! Move constructor - TCollection_ExtendedString (TCollection_ExtendedString&& theOther) noexcept + TCollection_ExtendedString (TCollection_ExtendedString&& theOther) Standard_Noexcept : mystring (theOther.mystring), mylength (theOther.mylength) { @@ -153,7 +154,7 @@ void operator = (const TCollection_ExtendedString& fromwhere) Standard_EXPORT void Swap (TCollection_ExtendedString& theOther); //! Move assignment operator - TCollection_ExtendedString& operator= (TCollection_ExtendedString&& theOther) noexcept { Swap (theOther); return *this; } + TCollection_ExtendedString& operator= (TCollection_ExtendedString&& theOther) Standard_Noexcept { Swap (theOther); return *this; } //! Frees memory allocated by ExtendedString. Standard_EXPORT ~TCollection_ExtendedString(); diff --git a/src/TopLoc/TopLoc_SListOfItemLocation.hxx b/src/TopLoc/TopLoc_SListOfItemLocation.hxx index 2ce729cc0c..b80cc8ed72 100644 --- a/src/TopLoc/TopLoc_SListOfItemLocation.hxx +++ b/src/TopLoc/TopLoc_SListOfItemLocation.hxx @@ -21,6 +21,7 @@ #include #include +#include class TopLoc_SListNodeOfItemLocation; class TopLoc_ItemLocation; @@ -69,13 +70,13 @@ public: } //! Move constructor - TopLoc_SListOfItemLocation (TopLoc_SListOfItemLocation&& theOther) noexcept + TopLoc_SListOfItemLocation (TopLoc_SListOfItemLocation&& theOther) Standard_Noexcept : myNode(std::move (theOther.myNode)) { } //! Move operator - TopLoc_SListOfItemLocation& operator= (TopLoc_SListOfItemLocation&& theOther) noexcept + TopLoc_SListOfItemLocation& operator= (TopLoc_SListOfItemLocation&& theOther) Standard_Noexcept { myNode = std::move (theOther.myNode); return *this;