mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0030448: Coding - add typo detection to derivation creation methods using Standard_NODISCARD attribute
Added macro Standard_NODISCARD equivalent to C++17 attribute [[nodiscard]] for compilers that support this. Using Standard_NODISCARD macro for methods that create new object in gp, math, Geom, Bnd packages. Marked equivalent operators with Standard_NODISCARD, if they are defined close to relevant methods. Corrected code where warnings on unused result of calls to methods creating new objects are generated. In most cases it looks like spelling errors (e.g. Normalised() instead of Normalise())
This commit is contained in:
@@ -132,15 +132,15 @@ public:
|
||||
}
|
||||
|
||||
//! returns the product of an IntegerVector by an integer value.
|
||||
Standard_EXPORT math_IntegerVector Multiplied(const Standard_Integer theRight) const;
|
||||
Standard_EXPORT Standard_NODISCARD math_IntegerVector Multiplied(const Standard_Integer theRight) const;
|
||||
|
||||
math_IntegerVector operator*(const Standard_Integer theRight) const
|
||||
Standard_NODISCARD math_IntegerVector operator*(const Standard_Integer theRight) const
|
||||
{
|
||||
return Multiplied(theRight);
|
||||
}
|
||||
|
||||
//! returns the product of a vector and a real value.
|
||||
Standard_EXPORT math_IntegerVector TMultiplied(const Standard_Integer theRight) const;
|
||||
Standard_EXPORT Standard_NODISCARD math_IntegerVector TMultiplied(const Standard_Integer theRight) const;
|
||||
|
||||
friend inline math_IntegerVector operator* (const Standard_Integer theLeft, const math_IntegerVector& theRight)
|
||||
{
|
||||
@@ -160,9 +160,9 @@ public:
|
||||
//! adds the IntegerVector "theRight" to an IntegerVector.
|
||||
//! An exception is raised if the IntegerVectors have not the same length.
|
||||
//! An exception is raised if the lengths are not equal.
|
||||
Standard_EXPORT math_IntegerVector Added(const math_IntegerVector& theRight) const;
|
||||
Standard_EXPORT Standard_NODISCARD math_IntegerVector Added(const math_IntegerVector& theRight) const;
|
||||
|
||||
math_IntegerVector operator+(const math_IntegerVector& theRight) const
|
||||
Standard_NODISCARD math_IntegerVector operator+(const math_IntegerVector& theRight) const
|
||||
{
|
||||
return Added(theRight);
|
||||
}
|
||||
@@ -199,9 +199,9 @@ public:
|
||||
|
||||
//! returns the inner product of 2 IntegerVectors.
|
||||
//! An exception is raised if the lengths are not equal.
|
||||
Standard_EXPORT Standard_Integer Multiplied(const math_IntegerVector& theRight) const;
|
||||
Standard_EXPORT Standard_NODISCARD Standard_Integer Multiplied(const math_IntegerVector& theRight) const;
|
||||
|
||||
Standard_Integer operator*(const math_IntegerVector& theRight) const
|
||||
Standard_NODISCARD Standard_Integer operator*(const math_IntegerVector& theRight) const
|
||||
{
|
||||
return Multiplied(theRight);
|
||||
}
|
||||
@@ -225,9 +225,9 @@ public:
|
||||
|
||||
//! returns the subtraction of "theRight" from "me".
|
||||
//! An exception is raised if the IntegerVectors have not the same length.
|
||||
Standard_EXPORT math_IntegerVector Subtracted(const math_IntegerVector& theRight) const;
|
||||
Standard_EXPORT Standard_NODISCARD math_IntegerVector Subtracted(const math_IntegerVector& theRight) const;
|
||||
|
||||
math_IntegerVector operator-(const math_IntegerVector& theRight) const
|
||||
Standard_NODISCARD math_IntegerVector operator-(const math_IntegerVector& theRight) const
|
||||
{
|
||||
return Subtracted(theRight);
|
||||
}
|
||||
|
@@ -170,8 +170,8 @@ void operator*= (const Standard_Real Right)
|
||||
|
||||
//! multiplies all the elements of a matrix by the
|
||||
//! value <Right>.
|
||||
Standard_EXPORT math_Matrix Multiplied (const Standard_Real Right) const;
|
||||
math_Matrix operator* (const Standard_Real Right) const
|
||||
Standard_EXPORT Standard_NODISCARD math_Matrix Multiplied (const Standard_Real Right) const;
|
||||
Standard_NODISCARD math_Matrix operator* (const Standard_Real Right) const
|
||||
{
|
||||
return Multiplied(Right);
|
||||
}
|
||||
@@ -194,7 +194,7 @@ math_Matrix operator* (const Standard_Real Right) const
|
||||
//! rows of this matrix, or
|
||||
//! - the number of columns of matrix Right is not equal to
|
||||
//! the number of columns of this matrix.
|
||||
Standard_EXPORT math_Matrix TMultiplied (const Standard_Real Right) const;
|
||||
Standard_EXPORT Standard_NODISCARD math_Matrix TMultiplied (const Standard_Real Right) const;
|
||||
friend math_Matrix operator *(const Standard_Real Left,const math_Matrix& Right);
|
||||
|
||||
//! divides all the elements of a matrix by the value <Right>.
|
||||
@@ -207,8 +207,8 @@ void operator/= (const Standard_Real Right)
|
||||
|
||||
//! divides all the elements of a matrix by the value <Right>.
|
||||
//! An exception is raised if <Right> = 0.
|
||||
Standard_EXPORT math_Matrix Divided (const Standard_Real Right) const;
|
||||
math_Matrix operator/ (const Standard_Real Right) const
|
||||
Standard_EXPORT Standard_NODISCARD math_Matrix Divided (const Standard_Real Right) const;
|
||||
Standard_NODISCARD math_Matrix operator/ (const Standard_Real Right) const
|
||||
{
|
||||
return Divided(Right);
|
||||
}
|
||||
@@ -227,8 +227,8 @@ void operator+= (const math_Matrix& Right)
|
||||
|
||||
//! adds the matrix <Right> to a matrix.
|
||||
//! An exception is raised if the dimensions are different.
|
||||
Standard_EXPORT math_Matrix Added (const math_Matrix& Right) const;
|
||||
math_Matrix operator+ (const math_Matrix& Right) const
|
||||
Standard_EXPORT Standard_NODISCARD math_Matrix Added (const math_Matrix& Right) const;
|
||||
Standard_NODISCARD math_Matrix operator+ (const math_Matrix& Right) const
|
||||
{
|
||||
return Added(Right);
|
||||
}
|
||||
@@ -251,8 +251,8 @@ void operator-= (const math_Matrix& Right)
|
||||
|
||||
//! Returns the result of the subtraction of <Right> from <me>.
|
||||
//! An exception is raised if the dimensions are different.
|
||||
Standard_EXPORT math_Matrix Subtracted (const math_Matrix& Right) const;
|
||||
math_Matrix operator- (const math_Matrix& Right) const
|
||||
Standard_EXPORT Standard_NODISCARD math_Matrix Subtracted (const math_Matrix& Right) const;
|
||||
Standard_NODISCARD math_Matrix operator- (const math_Matrix& Right) const
|
||||
{
|
||||
return Subtracted(Right);
|
||||
}
|
||||
@@ -304,7 +304,7 @@ math_Matrix operator- (const math_Matrix& Right) const
|
||||
|
||||
//! Teturns the transposed of a matrix.
|
||||
//! An exception is raised if the matrix is not a square matrix.
|
||||
Standard_EXPORT math_Matrix Transposed() const;
|
||||
Standard_EXPORT Standard_NODISCARD math_Matrix Transposed() const;
|
||||
|
||||
//! Returns the inverse of a matrix.
|
||||
//! Exception NotSquare is raised if the matrix is not square.
|
||||
@@ -363,16 +363,16 @@ void operator*= (const math_Matrix& Right)
|
||||
|
||||
//! Returns the product of 2 matrices.
|
||||
//! An exception is raised if the dimensions are different.
|
||||
Standard_EXPORT math_Matrix Multiplied (const math_Matrix& Right) const;
|
||||
math_Matrix operator* (const math_Matrix& Right) const
|
||||
Standard_EXPORT Standard_NODISCARD math_Matrix Multiplied (const math_Matrix& Right) const;
|
||||
Standard_NODISCARD math_Matrix operator* (const math_Matrix& Right) const
|
||||
{
|
||||
return Multiplied(Right);
|
||||
}
|
||||
|
||||
//! Returns the product of a matrix by a vector.
|
||||
//! An exception is raised if the dimensions are different.
|
||||
Standard_EXPORT math_Vector Multiplied (const math_Vector& Right) const;
|
||||
math_Vector operator* (const math_Vector& Right) const
|
||||
Standard_EXPORT Standard_NODISCARD math_Vector Multiplied (const math_Vector& Right) const;
|
||||
Standard_NODISCARD math_Vector operator* (const math_Vector& Right) const
|
||||
{
|
||||
return Multiplied(Right);
|
||||
}
|
||||
|
@@ -127,7 +127,7 @@ public:
|
||||
//! Exceptions
|
||||
//! Standard_NullValue if this vector is null (i.e. if its norm is
|
||||
//! less than or equal to Standard_Real::RealEpsilon().
|
||||
Standard_EXPORT math_Vector Normalized() const;
|
||||
Standard_EXPORT Standard_NODISCARD math_Vector Normalized() const;
|
||||
|
||||
//! Inverts this vector and assigns the result to this vector.
|
||||
Standard_EXPORT void Invert();
|
||||
@@ -156,15 +156,15 @@ public:
|
||||
}
|
||||
|
||||
//! returns the product of a vector and a real value.
|
||||
Standard_EXPORT math_Vector Multiplied(const Standard_Real theRight) const;
|
||||
Standard_EXPORT Standard_NODISCARD math_Vector Multiplied(const Standard_Real theRight) const;
|
||||
|
||||
math_Vector operator*(const Standard_Real theRight) const
|
||||
Standard_NODISCARD math_Vector operator*(const Standard_Real theRight) const
|
||||
{
|
||||
return Multiplied(theRight);
|
||||
}
|
||||
|
||||
//! returns the product of a vector and a real value.
|
||||
Standard_EXPORT math_Vector TMultiplied(const Standard_Real theRight) const;
|
||||
Standard_EXPORT Standard_NODISCARD math_Vector TMultiplied(const Standard_Real theRight) const;
|
||||
|
||||
friend inline math_Vector operator* (const Standard_Real theLeft, const math_Vector& theRight)
|
||||
{
|
||||
@@ -182,9 +182,9 @@ public:
|
||||
|
||||
//! divides a vector by the value "theRight".
|
||||
//! An exception is raised if "theRight" = 0.
|
||||
Standard_EXPORT math_Vector Divided(const Standard_Real theRight) const;
|
||||
Standard_EXPORT Standard_NODISCARD math_Vector Divided(const Standard_Real theRight) const;
|
||||
|
||||
math_Vector operator/(const Standard_Real theRight) const
|
||||
Standard_NODISCARD math_Vector operator/(const Standard_Real theRight) const
|
||||
{
|
||||
return Divided(theRight);
|
||||
}
|
||||
@@ -204,9 +204,9 @@ public:
|
||||
//! adds the vector theRight to a vector.
|
||||
//! An exception is raised if the vectors have not the same length.
|
||||
//! An exception is raised if the lengths are not equal.
|
||||
Standard_EXPORT math_Vector Added(const math_Vector& theRight) const;
|
||||
Standard_EXPORT Standard_NODISCARD math_Vector Added(const math_Vector& theRight) const;
|
||||
|
||||
math_Vector operator+(const math_Vector& theRight) const
|
||||
Standard_NODISCARD math_Vector operator+(const math_Vector& theRight) const
|
||||
{
|
||||
return Added(theRight);
|
||||
}
|
||||
@@ -264,16 +264,16 @@ public:
|
||||
|
||||
//! returns the inner product of 2 vectors.
|
||||
//! An exception is raised if the lengths are not equal.
|
||||
Standard_EXPORT Standard_Real Multiplied(const math_Vector& theRight) const;
|
||||
Standard_Real operator*(const math_Vector& theRight) const
|
||||
Standard_EXPORT Standard_NODISCARD Standard_Real Multiplied(const math_Vector& theRight) const;
|
||||
Standard_NODISCARD Standard_Real operator*(const math_Vector& theRight) const
|
||||
{
|
||||
return Multiplied(theRight);
|
||||
}
|
||||
|
||||
//! returns the product of a vector by a matrix.
|
||||
Standard_EXPORT math_Vector Multiplied(const math_Matrix& theRight) const;
|
||||
Standard_EXPORT Standard_NODISCARD math_Vector Multiplied(const math_Matrix& theRight) const;
|
||||
|
||||
math_Vector operator*(const math_Matrix& theRight) const
|
||||
Standard_NODISCARD math_Vector operator*(const math_Matrix& theRight) const
|
||||
{
|
||||
return Multiplied(theRight);
|
||||
}
|
||||
@@ -297,9 +297,9 @@ public:
|
||||
|
||||
//! returns the subtraction of "theRight" from "me".
|
||||
//! An exception is raised if the vectors have not the same length.
|
||||
Standard_EXPORT math_Vector Subtracted(const math_Vector& theRight) const;
|
||||
Standard_EXPORT Standard_NODISCARD math_Vector Subtracted(const math_Vector& theRight) const;
|
||||
|
||||
math_Vector operator-(const math_Vector& theRight) const
|
||||
Standard_NODISCARD math_Vector operator-(const math_Vector& theRight) const
|
||||
{
|
||||
return Subtracted(theRight);
|
||||
}
|
||||
|
Reference in New Issue
Block a user