0032957: Add Standard_Noexcept definition CR0-WEEK-33 IR-2022-08-19
authorddzama <ddzama@opencascade.com>
Wed, 17 Aug 2022 08:11:26 +0000 (11:11 +0300)
committerddzama <ddzama@opencascade.com>
Thu, 18 Aug 2022 08:55:14 +0000 (11:55 +0300)
into Standard_Macro.hxx and
employ Standard_Noexcept.

src/NCollection/NCollection_AliasedArray.hxx
src/Poly/Poly_ArrayOfNodes.hxx
src/Poly/Poly_ArrayOfUVNodes.hxx
src/Standard/Standard_Handle.hxx
src/Standard/Standard_Macro.hxx
src/TCollection/TCollection_AsciiString.hxx
src/TCollection/TCollection_ExtendedString.hxx
src/TopLoc/TopLoc_SListOfItemLocation.hxx

index 678939b..c8916b3 100644 (file)
@@ -18,6 +18,7 @@
 #include <Standard_OutOfMemory.hxx>
 #include <Standard_OutOfRange.hxx>
 #include <Standard_TypeMismatch.hxx>
+#include <Standard_Macro.hxx>
 
 //! 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;
index 94f26b8..81a8e45 100644 (file)
@@ -17,6 +17,7 @@
 #include <NCollection_AliasedArray.hxx>
 #include <gp_Pnt.hxx>
 #include <gp_Vec3f.hxx>
+#include <Standard_Macro.hxx>
 
 //! 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);
   }
index 682be38..19f4e24 100644 (file)
@@ -17,6 +17,7 @@
 #include <NCollection_AliasedArray.hxx>
 #include <gp_Pnt2d.hxx>
 #include <gp_Vec2f.hxx>
+#include <Standard_Macro.hxx>
 
 //! 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);
   }
index 723dd90..6c21295 100644 (file)
@@ -18,6 +18,7 @@
 #include <Standard_Std.hxx>
 #include <Standard_Stream.hxx>
 #include <Standard_Transient.hxx>
+#include <Standard_Macro.hxx>
 
 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;
index a2f949d..85f2785 100644 (file)
   #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
index ccb68cd..0e5d2ff 100644 (file)
@@ -26,6 +26,7 @@
 #include <Standard_Real.hxx>
 #include <Standard_OStream.hxx>
 #include <Standard_IStream.hxx>
+#include <Standard_Macro.hxx>
 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();
index 1786028..f71869a 100644 (file)
@@ -31,6 +31,7 @@
 #include <Standard_Real.hxx>
 #include <Standard_OStream.hxx>
 #include <Standard_PCharacter.hxx>
+#include <Standard_Macro.hxx>
 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();
index 2ce729c..b80cc8e 100644 (file)
@@ -21,6 +21,7 @@
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
+#include <Standard_Macro.hxx>
 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;