]> OCCT Git - occt.git/commitdiff
0032917: Coding Rules - eliminate MSVS warning C26440 on VS2019/C++20 (If your functi...
authorddzama <ddzama@opencascade.com>
Thu, 31 Mar 2022 06:21:08 +0000 (09:21 +0300)
committersmoskvin <smoskvin@opencascade.com>
Fri, 29 Apr 2022 15:09:00 +0000 (18:09 +0300)
Microsoft Visual Studio Professional 2019
Version 16.11.11
std=c++20

Get rid of warning C26440: "If your function may not throw, declare it noexcept"

"If code is not supposed to cause any exceptions,
it should be marked as such by using the 'noexcept' specifier.
This would help to simplify error handling on the client code side,
as well as enable compiler to do additional optimizations."

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

index a13a000861cb00d9dca64e99023743b08524a13a..d3b297795c3e48ec12373f2bdb4e9713871515ad 100644 (file)
@@ -65,7 +65,7 @@ public:
   }
 
   //! Move constructor
-  NCollection_AliasedArray (NCollection_AliasedArray&& theOther)
+  NCollection_AliasedArray (NCollection_AliasedArray&& theOther) noexcept
   : myData (theOther.myData), myStride (theOther.myStride), mySize (theOther.mySize), myDeletable (theOther.myDeletable)
   {
     theOther.myDeletable = false;
index c65b8842c901f2e06128e876d5db0f4853e7d5bd..94f26b887dc91cf8b5bbe65d75d978735d2ba599 100644 (file)
@@ -85,14 +85,14 @@ public:
   Poly_ArrayOfNodes& operator= (const Poly_ArrayOfNodes& theOther) { return Assign (theOther); }
 
   //! Move constructor
-  Poly_ArrayOfNodes (Poly_ArrayOfNodes&& theOther)
+  Poly_ArrayOfNodes (Poly_ArrayOfNodes&& theOther) noexcept
   : NCollection_AliasedArray (std::move (theOther))
   {
     //
   }
 
   //! Move assignment operator; @sa Move()
-  Poly_ArrayOfNodes& operator= (Poly_ArrayOfNodes&& theOther)
+  Poly_ArrayOfNodes& operator= (Poly_ArrayOfNodes&& theOther) noexcept
   {
     return Move (theOther);
   }
index 8ec30bc4666a01caf0f6b46ff9fbd6489e53faaf..682be382d21d72f0290bb0cbaf5e339b348d5116 100644 (file)
@@ -85,14 +85,14 @@ public:
   Poly_ArrayOfUVNodes& operator= (const Poly_ArrayOfUVNodes& theOther) { return Assign (theOther); }
 
   //! Move constructor
-  Poly_ArrayOfUVNodes (Poly_ArrayOfUVNodes&& theOther)
+  Poly_ArrayOfUVNodes (Poly_ArrayOfUVNodes&& theOther) noexcept
   : NCollection_AliasedArray (std::move (theOther))
   {
     //
   }
 
   //! Move assignment operator; @sa Move()
-  Poly_ArrayOfUVNodes& operator= (Poly_ArrayOfUVNodes&& theOther)
+  Poly_ArrayOfUVNodes& operator= (Poly_ArrayOfUVNodes&& theOther) noexcept
   {
     return Move (theOther);
   }
index 763f83a99712959b04dc698a207381a5f910a924..723dd903243f5dd502d3ed147ca119dd24c443a5 100644 (file)
@@ -71,7 +71,7 @@ namespace opencascade {
     }
 
     //! Move constructor
-    handle (handle&& theHandle) : entity(theHandle.entity)
+    handle (handle&& theHandle) noexcept : entity(theHandle.entity)
     {
       theHandle.entity = 0;
     }
@@ -112,7 +112,7 @@ namespace opencascade {
     }
 
     //! Move operator
-    handle& operator= (handle&& theHandle)
+    handle& operator= (handle&& theHandle) noexcept
     {
       std::swap (this->entity, theHandle.entity);
       return *this;
index 8f277b12211ceff6c66f774178965324a107e43f..d2592e9a08b9e51ad60678ebf24d89220bce61fd 100644 (file)
@@ -77,7 +77,7 @@ public:
   Standard_EXPORT TCollection_AsciiString(const TCollection_AsciiString& astring);
 
   //! Move constructor
-  TCollection_AsciiString (TCollection_AsciiString&& theOther)
+  TCollection_AsciiString (TCollection_AsciiString&& theOther) noexcept
   : mystring (theOther.mystring),
     mylength (theOther.mylength)
   {
@@ -279,7 +279,7 @@ void operator = (const TCollection_AsciiString& fromwhere)
   Standard_EXPORT void Swap (TCollection_AsciiString& theOther);
 
   //! Move assignment operator
-  TCollection_AsciiString& operator= (TCollection_AsciiString&& theOther) { Swap (theOther); return *this; }
+  TCollection_AsciiString& operator= (TCollection_AsciiString&& theOther) noexcept { Swap (theOther); return *this; }
 
   //! Frees memory allocated by AsciiString.
   Standard_EXPORT ~TCollection_AsciiString();
index be5c3f97b3c93a94d495dc9358959da84d255667..1786028e7903855499f7af0e8d70e2aa4ea510cb 100644 (file)
@@ -98,7 +98,7 @@ public:
   Standard_EXPORT TCollection_ExtendedString(const TCollection_ExtendedString& astring);
 
   //! Move constructor
-  TCollection_ExtendedString (TCollection_ExtendedString&& theOther)
+  TCollection_ExtendedString (TCollection_ExtendedString&& theOther) noexcept
   : mystring (theOther.mystring),
     mylength (theOther.mylength)
   {
@@ -153,7 +153,7 @@ void operator = (const TCollection_ExtendedString& fromwhere)
   Standard_EXPORT void Swap (TCollection_ExtendedString& theOther);
 
   //! Move assignment operator
-  TCollection_ExtendedString& operator= (TCollection_ExtendedString&& theOther) { Swap (theOther); return *this; }
+  TCollection_ExtendedString& operator= (TCollection_ExtendedString&& theOther) noexcept { Swap (theOther); return *this; }
 
   //! Frees memory allocated by ExtendedString.
   Standard_EXPORT ~TCollection_ExtendedString();
index ce6b3d356db67a449b9d8cae1665250075658469..a0093d5c6937f86e402177df2612ea07e6cb67a5 100644 (file)
@@ -70,13 +70,13 @@ public:
   }
   
   //! Move constructor
-  TopLoc_SListOfItemLocation (TopLoc_SListOfItemLocation&& theOther)
+  TopLoc_SListOfItemLocation (TopLoc_SListOfItemLocation&& theOther) noexcept
     : myNode(std::move (theOther.myNode))
   {
   }
 
   //! Move operator
-  TopLoc_SListOfItemLocation& operator= (TopLoc_SListOfItemLocation&& theOther)
+  TopLoc_SListOfItemLocation& operator= (TopLoc_SListOfItemLocation&& theOther) noexcept
   {
     myNode = std::move (theOther.myNode);
     return *this;