1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #8769 from mshabunin:kw-fixes

This commit is contained in:
Vadim Pisarevsky
2017-05-23 14:59:36 +00:00
16 changed files with 170 additions and 100 deletions
@@ -381,6 +381,17 @@ CV_INLINE CV_NORETURN void errorNoReturn(int _code, const String& _err, const ch
#define CV_Func ""
#endif
#ifdef CV_STATIC_ANALYSIS
// In practice, some macro are not processed correctly (noreturn is not detected).
// We need to use simplified definition for them.
#define CV_Error(...) do { abort(); } while (0)
#define CV_Error_(...) do { abort(); } while (0)
#define CV_Assert(cond) do { if (!(cond)) abort(); } while (0)
#define CV_ErrorNoReturn(...) do { abort(); } while (0)
#define CV_ErrorNoReturn_(...) do { abort(); } while (0)
#else // CV_STATIC_ANALYSIS
/** @brief Call the error handler.
Currently, the error handler prints the error code and the error message to the standard
@@ -421,6 +432,8 @@ configurations while CV_DbgAssert is only retained in the Debug configuration.
/** same as CV_Error_(code,args), but does not return */
#define CV_ErrorNoReturn_( code, args ) cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ )
#endif // CV_STATIC_ANALYSIS
/** replaced with CV_Assert(expr) in Debug configuration */
#ifdef _DEBUG
# define CV_DbgAssert(expr) CV_Assert(expr)
+12
View File
@@ -302,6 +302,18 @@ Cv64suf;
# define MAX(a,b) ((a) < (b) ? (b) : (a))
#endif
/****************************************************************************************\
* static analysys *
\****************************************************************************************/
// In practice, some macro are not processed correctly (noreturn is not detected).
// We need to use simplified definition for them.
#ifndef CV_STATIC_ANALYSIS
# if defined(__KLOCWORK__) || defined(__clang_analyzer__) || defined(__COVERITY__)
# define CV_STATIC_ANALYSIS
# endif
#endif
/****************************************************************************************\
* exchange-add operation for atomic operations on reference counters *
\****************************************************************************************/
@@ -872,7 +872,7 @@ size_t Mat::step1(int i) const
inline
bool Mat::empty() const
{
return data == 0 || total() == 0;
return data == 0 || total() == 0 || dims == 0;
}
inline
@@ -3739,7 +3739,7 @@ size_t UMat::step1(int i) const
inline
bool UMat::empty() const
{
return u == 0 || total() == 0;
return u == 0 || total() == 0 || dims == 0;
}
inline
+2 -1
View File
@@ -1040,7 +1040,8 @@ Complex<_Tp> operator / (const Complex<_Tp>& a, const Complex<_Tp>& b)
template<typename _Tp> static inline
Complex<_Tp>& operator /= (Complex<_Tp>& a, const Complex<_Tp>& b)
{
return (a = a / b);
a = a / b;
return a;
}
template<typename _Tp> static inline