From: Alexander Alekhin Date: Wed, 22 Aug 2018 14:38:51 +0000 (+0300) Subject: Merge remote-tracking branch 'upstream/3.4' into merge-3.4 X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~1^2~584 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=63564039640c81256ccfedf77899e37746352d45;p=platform%2Fupstream%2Fopencv.git Merge remote-tracking branch 'upstream/3.4' into merge-3.4 --- 63564039640c81256ccfedf77899e37746352d45 diff --cc modules/core/include/opencv2/core/base.hpp index 87c5c4e,389fa65..24f92b5 --- a/modules/core/include/opencv2/core/base.hpp +++ b/modules/core/include/opencv2/core/base.hpp @@@ -419,21 -444,45 +419,27 @@@ for example */ #define CV_Error_( code, args ) cv::error( code, cv::format args, CV_Func, __FILE__, __LINE__ ) - #define CV_Assert_1( expr ) if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ) + /** @brief Checks a condition at runtime and throws exception if it fails + + The macros CV_Assert (and CV_DbgAssert(expr)) evaluate the specified expression. If it is 0, the macros + raise an error (see cv::error). The macro CV_Assert checks the condition in both Debug and Release + configurations while CV_DbgAssert is only retained in the Debug configuration. + */ + #define CV_Assert( expr ) do { if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0) -//! @cond IGNORED -#define CV__ErrorNoReturn( code, msg ) cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ ) -#define CV__ErrorNoReturn_( code, args ) cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ ) -#ifdef __OPENCV_BUILD -#undef CV_Error -#define CV_Error CV__ErrorNoReturn -#undef CV_Error_ -#define CV_Error_ CV__ErrorNoReturn_ -#undef CV_Assert -#define CV_Assert( expr ) do { if(!!(expr)) ; else cv::errorNoReturn( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0) -#else -// backward compatibility -#define CV_ErrorNoReturn CV__ErrorNoReturn -#define CV_ErrorNoReturn_ CV__ErrorNoReturn_ -#endif -//! @endcond - #endif // CV_STATIC_ANALYSIS //! @cond IGNORED - -#if defined OPENCV_FORCE_MULTIARG_ASSERT_CHECK && defined CV_STATIC_ANALYSIS -#warning "OPENCV_FORCE_MULTIARG_ASSERT_CHECK can't be used with CV_STATIC_ANALYSIS" -#undef OPENCV_FORCE_MULTIARG_ASSERT_CHECK +#if !defined(__OPENCV_BUILD) // TODO: backward compatibility only +#ifndef CV_ErrorNoReturn +#define CV_ErrorNoReturn CV_Error +#endif +#ifndef CV_ErrorNoReturn_ +#define CV_ErrorNoReturn_ CV_Error_ +#endif #endif - //! @endcond -#ifdef OPENCV_FORCE_MULTIARG_ASSERT_CHECK -#define CV_Assert_1( expr ) do { if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0) -#else + #define CV_Assert_1 CV_Assert -#endif #define CV_Assert_2( expr1, expr2 ) CV_Assert_1(expr1); CV_Assert_1(expr2) #define CV_Assert_3( expr1, expr2, expr3 ) CV_Assert_2(expr1, expr2); CV_Assert_1(expr3) #define CV_Assert_4( expr1, expr2, expr3, expr4 ) CV_Assert_3(expr1, expr2, expr3); CV_Assert_1(expr4) @@@ -444,18 -493,14 +450,10 @@@ #define CV_Assert_9( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9 ) CV_Assert_8(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8 ); CV_Assert_1(expr9) #define CV_Assert_10( expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9, expr10 ) CV_Assert_9(expr1, expr2, expr3, expr4, expr5, expr6, expr7, expr8, expr9 ); CV_Assert_1(expr10) - #define CV_VA_NUM_ARGS_HELPER(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N - #define CV_VA_NUM_ARGS(...) CV_VA_NUM_ARGS_HELPER(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) - - /** @brief Checks a condition at runtime and throws exception if it fails + #define CV_Assert_N(...) do { __CV_CAT(CV_Assert_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__); } while(0) - The macros CV_Assert (and CV_DbgAssert(expr)) evaluate the specified expression. If it is 0, the macros - raise an error (see cv::error). The macro CV_Assert checks the condition in both Debug and Release - configurations while CV_DbgAssert is only retained in the Debug configuration. - */ - #define CV_Assert(...) do { CVAUX_CONCAT(CV_Assert_, CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__); } while(0) -#ifdef OPENCV_FORCE_MULTIARG_ASSERT_CHECK -#undef CV_Assert -#define CV_Assert CV_Assert_N -#endif + //! @endcond - /** replaced with CV_Assert(expr) in Debug configuration */ #if defined _DEBUG || defined CV_STATIC_ANALYSIS # define CV_DbgAssert(expr) CV_Assert(expr) #else