diff --git a/cmake/OpenCVCompilerOptions.cmake b/cmake/OpenCVCompilerOptions.cmake index b9293df1b6..774103af3a 100644 --- a/cmake/OpenCVCompilerOptions.cmake +++ b/cmake/OpenCVCompilerOptions.cmake @@ -120,7 +120,9 @@ if(CV_GCC OR CV_CLANG) add_extra_compiler_option(-Wno-unnamed-type-template-args) add_extra_compiler_option(-Wno-comment) if(NOT OPENCV_SKIP_IMPLICIT_FALLTHROUGH - AND NOT " ${CMAKE_CXX_FLAGS} ${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_CXX_FLAGS}" MATCHES "implicit-fallthrough") + AND NOT " ${CMAKE_CXX_FLAGS} ${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_CXX_FLAGS}" MATCHES "implicit-fallthrough" + AND (CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0) + ) add_extra_compiler_option(-Wimplicit-fallthrough=3) endif() if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.2.0) diff --git a/modules/calib3d/src/circlesgrid.cpp b/modules/calib3d/src/circlesgrid.cpp index 694644bbd5..25da6be03f 100644 --- a/modules/calib3d/src/circlesgrid.cpp +++ b/modules/calib3d/src/circlesgrid.cpp @@ -759,12 +759,8 @@ bool CirclesGridFinder::isDetectionCorrect() } return (vertices.size() == largeHeight * largeWidth + smallHeight * smallWidth); } - - default: - CV_Error(0, "Unknown pattern type"); } - - return false; + CV_Error(Error::StsBadArg, "Unknown pattern type"); } void CirclesGridFinder::findMCS(const std::vector &basis, std::vector &basisGraphs) diff --git a/modules/core/include/opencv2/core/base.hpp b/modules/core/include/opencv2/core/base.hpp index 9cdc6a32a2..766e63b6eb 100644 --- a/modules/core/include/opencv2/core/base.hpp +++ b/modules/core/include/opencv2/core/base.hpp @@ -371,7 +371,7 @@ It is possible to alternate error processing by using redirectError(). @param _func - function name. Available only when the compiler supports getting it @param _file - source file name where the error has occurred @param _line - line number in the source file where the error has occurred -@see CV_Error, CV_Error_, CV_ErrorNoReturn, CV_ErrorNoReturn_, CV_Assert, CV_DbgAssert +@see CV_Error, CV_Error_, CV_Assert, CV_DbgAssert */ CV_EXPORTS void error(int _code, const String& _err, const char* _func, const char* _file, int _line); @@ -414,8 +414,6 @@ CV_INLINE CV_NORETURN void errorNoReturn(int _code, const String& _err, const ch // We need to use simplified definition for them. #define CV_Error(...) do { abort(); } while (0) #define CV_Error_( code, args ) do { cv::format args; abort(); } while (0) -#define CV_ErrorNoReturn(...) do { abort(); } while (0) -#define CV_ErrorNoReturn_(...) do { abort(); } while (0) #define CV_Assert_1( expr ) do { if (!(expr)) abort(); } while (0) #else // CV_STATIC_ANALYSIS @@ -446,22 +444,22 @@ for example: */ #define CV_Error_( code, args ) cv::error( code, cv::format args, CV_Func, __FILE__, __LINE__ ) -/** same as CV_Error(code,msg), but does not return */ -#define CV_ErrorNoReturn( code, msg ) cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ ) - -/** 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__ ) - #define CV_Assert_1( expr ) if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ) //! @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 +#define CV_Error CV__ErrorNoReturn #undef CV_Error_ -#define CV_Error_ CV_ErrorNoReturn_ +#define CV_Error_ CV__ErrorNoReturn_ #undef CV_Assert_1 #define CV_Assert_1( expr ) if(!!(expr)) ; else cv::errorNoReturn( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ) +#else +// backward compatibility +#define CV_ErrorNoReturn CV__ErrorNoReturn +#define CV_ErrorNoReturn_ CV__ErrorNoReturn_ #endif //! @endcond diff --git a/modules/core/include/opencv2/core/hal/intrin_cpp.hpp b/modules/core/include/opencv2/core/hal/intrin_cpp.hpp index 5f0aab1bae..c7cbb578db 100644 --- a/modules/core/include/opencv2/core/hal/intrin_cpp.hpp +++ b/modules/core/include/opencv2/core/hal/intrin_cpp.hpp @@ -1047,7 +1047,7 @@ template inline bool v_check_any(const v_reg<_Tp, n>& a) Return value will be built by combining values _a_ and _b_ using the following scheme: result[i] = mask[i] ? a[i] : b[i]; -@Note: _mask_ element values are restricted to these values: +@note: _mask_ element values are restricted to these values: - 0: select element from _b_ - 0xff/0xffff/etc: select element from _a_ (fully compatible with bitwise-based operator) diff --git a/modules/core/include/opencv2/core/opencl/opencl_info.hpp b/modules/core/include/opencv2/core/opencl/opencl_info.hpp index fdd27039e2..b5d37394a7 100644 --- a/modules/core/include/opencv2/core/opencl/opencl_info.hpp +++ b/modules/core/include/opencv2/core/opencl/opencl_info.hpp @@ -93,7 +93,7 @@ static void dumpOpenCLInformation() const Device& device = Device::getDefault(); if (!device.available()) - CV_ErrorNoReturn(Error::OpenCLInitError, "OpenCL device is not available"); + CV_Error(Error::OpenCLInitError, "OpenCL device is not available"); DUMP_MESSAGE_STDOUT("Current OpenCL device: "); diff --git a/modules/core/include/opencv2/core/opencl/runtime/opencl_core.hpp b/modules/core/include/opencv2/core/opencl/runtime/opencl_core.hpp index ea9a7ffa1e..0404b3177a 100644 --- a/modules/core/include/opencv2/core/opencl/runtime/opencl_core.hpp +++ b/modules/core/include/opencv2/core/opencl/runtime/opencl_core.hpp @@ -76,7 +76,7 @@ #endif #ifndef CL_VERSION_1_2 -#define CV_REQUIRE_OPENCL_1_2_ERROR CV_ErrorNoReturn(cv::Error::OpenCLApiCallError, "OpenCV compiled without OpenCL v1.2 support, so we can't use functionality from OpenCL v1.2") +#define CV_REQUIRE_OPENCL_1_2_ERROR CV_Error(cv::Error::OpenCLApiCallError, "OpenCV compiled without OpenCL v1.2 support, so we can't use functionality from OpenCL v1.2") #endif #endif // HAVE_OPENCL diff --git a/modules/core/src/alloc.cpp b/modules/core/src/alloc.cpp index 8be725459d..531af254ff 100644 --- a/modules/core/src/alloc.cpp +++ b/modules/core/src/alloc.cpp @@ -53,7 +53,6 @@ namespace cv { static void* OutOfMemoryError(size_t size) { CV_Error_(CV_StsNoMem, ("Failed to allocate %llu bytes", (unsigned long long)size)); - return 0; } diff --git a/modules/core/src/command_line_parser.cpp b/modules/core/src/command_line_parser.cpp index 7d5c6cc03a..766835fe1d 100644 --- a/modules/core/src/command_line_parser.cpp +++ b/modules/core/src/command_line_parser.cpp @@ -1,3 +1,6 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. #include "precomp.hpp" #include @@ -364,7 +367,6 @@ bool CommandLineParser::has(const String& name) const } CV_Error_(Error::StsBadArg, ("undeclared key '%s' requested", name.c_str())); - return false; } bool CommandLineParser::check() const diff --git a/modules/core/src/directx.cpp b/modules/core/src/directx.cpp index 2ea168705d..97e56259d5 100644 --- a/modules/core/src/directx.cpp +++ b/modules/core/src/directx.cpp @@ -50,11 +50,11 @@ #include # include "directx.inc.hpp" #else // HAVE_DIRECTX -#define NO_DIRECTX_SUPPORT_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without DirectX support") +#define NO_DIRECTX_SUPPORT_ERROR CV_Error(cv::Error::StsBadFunc, "OpenCV was build without DirectX support") #endif #ifndef HAVE_OPENCL -# define NO_OPENCL_SUPPORT_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without OpenCL support") +# define NO_OPENCL_SUPPORT_ERROR CV_Error(cv::Error::StsBadFunc, "OpenCV was build without OpenCL support") #endif // HAVE_OPENCL namespace cv { namespace directx { diff --git a/modules/core/src/gl_core_3_1.cpp b/modules/core/src/gl_core_3_1.cpp index 60d7f6f88a..eabb36ff3e 100644 --- a/modules/core/src/gl_core_3_1.cpp +++ b/modules/core/src/gl_core_3_1.cpp @@ -143,6 +143,9 @@ return func; } #else +#if defined(_MSC_VER) + #pragma warning(disable : 4702) // unreachable code +#endif static void* IntGetProcAddress(const char*) { CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support"); diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index f9c4044614..d9d7ebef97 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -912,7 +912,6 @@ Mat Mat::reshape(int _cn, int _newndims, const int* _newsz) const CV_Error(CV_StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet"); // TBD - return Mat(); } Mat Mat::reshape(int _cn, const std::vector& _newshape) const diff --git a/modules/core/src/matrix_c.cpp b/modules/core/src/matrix_c.cpp index 8b9d29eeee..28583cd05c 100644 --- a/modules/core/src/matrix_c.cpp +++ b/modules/core/src/matrix_c.cpp @@ -179,7 +179,6 @@ Mat cvarrToMat(const CvArr* arr, bool copyData, return buf; } CV_Error(CV_StsBadArg, "Unknown array type"); - return Mat(); } void extractImageCOI(const CvArr* arr, OutputArray _ch, int coi) diff --git a/modules/core/src/matrix_wrap.cpp b/modules/core/src/matrix_wrap.cpp index 3fead37cbb..bea5c670b6 100644 --- a/modules/core/src/matrix_wrap.cpp +++ b/modules/core/src/matrix_wrap.cpp @@ -110,14 +110,12 @@ Mat _InputArray::getMat_(int i) const { CV_Assert( i < 0 ); CV_Error(cv::Error::StsNotImplemented, "You should explicitly call mapHost/unmapHost methods for ogl::Buffer object"); - return Mat(); } if( k == CUDA_GPU_MAT ) { CV_Assert( i < 0 ); CV_Error(cv::Error::StsNotImplemented, "You should explicitly call download method for cuda::GpuMat object"); - return Mat(); } if( k == CUDA_HOST_MEM ) @@ -130,7 +128,6 @@ Mat _InputArray::getMat_(int i) const } CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type"); - return Mat(); } UMat _InputArray::getUMat(int i) const @@ -354,14 +351,12 @@ cuda::GpuMat _InputArray::getGpuMat() const if (k == OPENGL_BUFFER) { CV_Error(cv::Error::StsNotImplemented, "You should explicitly call mapDevice/unmapDevice methods for ogl::Buffer object"); - return cuda::GpuMat(); } if (k == NONE) return cuda::GpuMat(); CV_Error(cv::Error::StsNotImplemented, "getGpuMat is available only for cuda::GpuMat and cuda::HostMem"); - return cuda::GpuMat(); } void _InputArray::getGpuMatVector(std::vector& gpumv) const { @@ -516,7 +511,6 @@ Size _InputArray::size(int i) const } CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type"); - return Size(); } int _InputArray::sizend(int* arrsz, int i) const @@ -716,7 +710,6 @@ int _InputArray::dims(int i) const } CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type"); - return 0; } size_t _InputArray::total(int i) const @@ -845,7 +838,6 @@ int _InputArray::type(int i) const return ((const cuda::HostMem*)obj)->type(); CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type"); - return 0; } int _InputArray::depth(int i) const @@ -928,7 +920,6 @@ bool _InputArray::empty() const return ((const cuda::HostMem*)obj)->empty(); CV_Error(Error::StsNotImplemented, "Unknown/unsupported array type"); - return true; } bool _InputArray::isContinuous(int i) const @@ -970,7 +961,6 @@ bool _InputArray::isContinuous(int i) const return i < 0 ? ((const cuda::GpuMat*)obj)->isContinuous() : true; CV_Error(CV_StsNotImplemented, "Unknown/unsupported array type"); - return false; } bool _InputArray::isSubmatrix(int i) const @@ -1009,7 +999,6 @@ bool _InputArray::isSubmatrix(int i) const } CV_Error(CV_StsNotImplemented, ""); - return false; } size_t _InputArray::offset(int i) const @@ -1074,7 +1063,6 @@ size_t _InputArray::offset(int i) const } CV_Error(Error::StsNotImplemented, ""); - return 0; } size_t _InputArray::step(int i) const @@ -1135,7 +1123,6 @@ size_t _InputArray::step(int i) const } CV_Error(Error::StsNotImplemented, ""); - return 0; } void _InputArray::copyTo(const _OutputArray& arr) const @@ -1459,7 +1446,6 @@ void _OutputArray::create(int d, const int* sizes, int mtype, int i, if( k == NONE ) { CV_Error(CV_StsNullPtr, "create() called for the missing output array" ); - return; } if( k == STD_VECTOR_MAT ) diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index 7d34580e6c..142f90aeec 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -133,7 +133,7 @@ namespace cv { namespace ocl { int refcount #ifndef HAVE_OPENCL -#define CV_OPENCL_NO_SUPPORT() CV_ErrorNoReturn(cv::Error::OpenCLApiCallError, "OpenCV build without OpenCL support") +#define CV_OPENCL_NO_SUPPORT() CV_Error(cv::Error::OpenCLApiCallError, "OpenCV build without OpenCL support") namespace { struct DummyImpl { @@ -2177,7 +2177,7 @@ struct Context::Impl if (!ptr) { CV_OPENCL_SVM_TRACE_ERROR_P("clSVMAlloc returned NULL...\n"); - CV_ErrorNoReturn(Error::StsBadArg, "clSVMAlloc returned NULL"); + CV_Error(Error::StsBadArg, "clSVMAlloc returned NULL"); } try { @@ -2186,7 +2186,7 @@ struct Context::Impl if (CL_SUCCESS != clEnqueueSVMMap(q, CL_TRUE, CL_MAP_WRITE, ptr, 100, 0, NULL, NULL)) { CV_OPENCL_SVM_TRACE_ERROR_P("clEnqueueSVMMap failed...\n"); - CV_ErrorNoReturn(Error::StsBadArg, "clEnqueueSVMMap FAILED"); + CV_Error(Error::StsBadArg, "clEnqueueSVMMap FAILED"); } clFinish(q); try @@ -2201,12 +2201,12 @@ struct Context::Impl if (CL_SUCCESS != clEnqueueSVMUnmap(q, ptr, 0, NULL, NULL)) { CV_OPENCL_SVM_TRACE_ERROR_P("clEnqueueSVMUnmap failed...\n"); - CV_ErrorNoReturn(Error::StsBadArg, "clEnqueueSVMUnmap FAILED"); + CV_Error(Error::StsBadArg, "clEnqueueSVMUnmap FAILED"); } clFinish(q); if (error) { - CV_ErrorNoReturn(Error::StsBadArg, "OpenCL SVM buffer access test was FAILED"); + CV_Error(Error::StsBadArg, "OpenCL SVM buffer access test was FAILED"); } } catch (...) @@ -2412,7 +2412,7 @@ void Context::setUseSVM(bool enabled) i->svmInit(); if (enabled && !i->svmAvailable) { - CV_ErrorNoReturn(Error::StsError, "OpenCL Shared Virtual Memory (SVM) is not supported by OpenCL device"); + CV_Error(Error::StsError, "OpenCL Shared Virtual Memory (SVM) is not supported by OpenCL device"); } i->svmEnabled = enabled; } @@ -2483,7 +2483,7 @@ void attachContext(const String& platformName, void* platformID, void* context, CV_OCL_CHECK(clGetPlatformIDs(0, 0, &cnt)); if (cnt == 0) - CV_ErrorNoReturn(cv::Error::OpenCLApiCallError, "no OpenCL platform available!"); + CV_Error(cv::Error::OpenCLApiCallError, "no OpenCL platform available!"); std::vector platforms(cnt); @@ -2505,13 +2505,13 @@ void attachContext(const String& platformName, void* platformID, void* context, } if (!platformAvailable) - CV_ErrorNoReturn(cv::Error::OpenCLApiCallError, "No matched platforms available!"); + CV_Error(cv::Error::OpenCLApiCallError, "No matched platforms available!"); // check if platformID corresponds to platformName String actualPlatformName; get_platform_name((cl_platform_id)platformID, actualPlatformName); if (platformName != actualPlatformName) - CV_ErrorNoReturn(cv::Error::OpenCLApiCallError, "No matched platforms available!"); + CV_Error(cv::Error::OpenCLApiCallError, "No matched platforms available!"); // do not initialize OpenCL context Context ctx = Context::getDefault(false); @@ -3305,7 +3305,7 @@ struct ProgramSource::Impl hash = crc64(sourceAddr_, sourceSize_); break; default: - CV_ErrorNoReturn(Error::StsInternal, "Internal error"); + CV_Error(Error::StsInternal, "Internal error"); } sourceHash_ = cv::format("%08llx", hash); isHashUpdated = true; @@ -3427,7 +3427,7 @@ const String& ProgramSource::source() const ProgramSource::hash_t ProgramSource::hash() const { - CV_ErrorNoReturn(Error::StsNotImplemented, "Removed method: ProgramSource::hash()"); + CV_Error(Error::StsNotImplemented, "Removed method: ProgramSource::hash()"); } ProgramSource ProgramSource::fromBinary(const String& module, const String& name, @@ -3597,11 +3597,11 @@ struct Program::Impl } else if (src_->kind_ == ProgramSource::Impl::PROGRAM_SPIRV) { - CV_ErrorNoReturn(Error::StsNotImplemented, "OpenCL: SPIR-V is not supported"); + CV_Error(Error::StsNotImplemented, "OpenCL: SPIR-V is not supported"); } else { - CV_ErrorNoReturn(Error::StsInternal, "Internal error"); + CV_Error(Error::StsInternal, "Internal error"); } CV_Assert(handle != NULL); #if OPENCV_HAVE_FILESYSTEM_SUPPORT @@ -3948,19 +3948,19 @@ void* Program::ptr() const #ifndef OPENCV_REMOVE_DEPRECATED_API const ProgramSource& Program::source() const { - CV_ErrorNoReturn(Error::StsNotImplemented, "Removed API"); + CV_Error(Error::StsNotImplemented, "Removed API"); } bool Program::read(const String& bin, const String& buildflags) { CV_UNUSED(bin); CV_UNUSED(buildflags); - CV_ErrorNoReturn(Error::StsNotImplemented, "Removed API"); + CV_Error(Error::StsNotImplemented, "Removed API"); } bool Program::write(String& bin) const { CV_UNUSED(bin); - CV_ErrorNoReturn(Error::StsNotImplemented, "Removed API"); + CV_Error(Error::StsNotImplemented, "Removed API"); } String Program::getPrefix() const @@ -5627,7 +5627,7 @@ public: } if (id != NULL && strcmp(id, "OCL") != 0) { - CV_ErrorNoReturn(cv::Error::StsBadArg, "getBufferPoolController(): unknown BufferPool ID\n"); + CV_Error(cv::Error::StsBadArg, "getBufferPoolController(): unknown BufferPool ID\n"); } return &bufferPool; } diff --git a/modules/core/src/opencl/runtime/opencl_core.cpp b/modules/core/src/opencl/runtime/opencl_core.cpp index 46b8c14ca4..1d761390cc 100644 --- a/modules/core/src/opencl/runtime/opencl_core.cpp +++ b/modules/core/src/opencl/runtime/opencl_core.cpp @@ -316,7 +316,7 @@ static void* opencl_check_fn(int ID) #endif else { - CV_ErrorNoReturn(cv::Error::StsBadArg, "Invalid function ID"); + CV_Error(cv::Error::StsBadArg, "Invalid function ID"); } void* func = CV_CL_GET_PROC_ADDRESS(e->fnName); if (!func) diff --git a/modules/core/src/opengl.cpp b/modules/core/src/opengl.cpp index 4146e6ab8f..08cfb4ed90 100644 --- a/modules/core/src/opengl.cpp +++ b/modules/core/src/opengl.cpp @@ -48,7 +48,7 @@ # include # endif #else // HAVE_OPENGL -# define NO_OPENGL_SUPPORT_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without OpenGL support") +# define NO_OPENGL_SUPPORT_ERROR CV_Error(cv::Error::StsBadFunc, "OpenCV was build without OpenGL support") #endif // HAVE_OPENGL using namespace cv; @@ -1304,10 +1304,15 @@ void cv::ogl::Arrays::release() void cv::ogl::Arrays::setAutoRelease(bool flag) { +#ifndef HAVE_OPENGL + CV_UNUSED(flag); + throw_no_ogl(); +#else vertex_.setAutoRelease(flag); color_.setAutoRelease(flag); normal_.setAutoRelease(flag); texCoord_.setAutoRelease(flag); +#endif } void cv::ogl::Arrays::bind() const @@ -1563,10 +1568,10 @@ void cv::ogl::render(const ogl::Arrays& arr, InputArray indices, int mode, Scala # ifdef cl_khr_gl_sharing # define HAVE_OPENCL_OPENGL_SHARING # else -# define NO_OPENCL_SHARING_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without OpenCL/OpenGL sharing support") +# define NO_OPENCL_SHARING_ERROR CV_Error(cv::Error::StsBadFunc, "OpenCV was build without OpenCL/OpenGL sharing support") # endif #else // HAVE_OPENCL -# define NO_OPENCL_SUPPORT_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without OpenCL support") +# define NO_OPENCL_SUPPORT_ERROR CV_Error(cv::Error::StsBadFunc, "OpenCV was build without OpenCL support") #endif // HAVE_OPENCL #if defined(HAVE_OPENGL) diff --git a/modules/core/src/parallel.cpp b/modules/core/src/parallel.cpp index ca3f9bdd21..413b9ee97d 100644 --- a/modules/core/src/parallel.cpp +++ b/modules/core/src/parallel.cpp @@ -239,7 +239,7 @@ namespace #if CV__EXCEPTION_PTR std::rethrow_exception(pException); #else - CV_ErrorNoReturn(Error::StsError, "Exception in parallel_for() body: " + exception_message); + CV_Error(Error::StsError, "Exception in parallel_for() body: " + exception_message); #endif } } diff --git a/modules/core/src/persistence.cpp b/modules/core/src/persistence.cpp index a163c28dd2..9b67a97e80 100644 --- a/modules/core/src/persistence.cpp +++ b/modules/core/src/persistence.cpp @@ -85,7 +85,7 @@ char* icvGets( CvFileStorage* fs, char* str, int maxCount ) return ptr; } #endif - CV_ErrorNoReturn(CV_StsError, "The storage is not opened"); + CV_Error(CV_StsError, "The storage is not opened"); } int icvEof( CvFileStorage* fs ) diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp index f2f5f8555b..e3ee27cf78 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -76,7 +76,7 @@ static bool param_dumpErrors = utils::getConfigurationParameterBool("OPENCV_DUMP # define CV_ERROR_SET_TERMINATE_HANDLER 1 # endif #endif -#if CV_ERROR_SET_TERMINATE_HANDLER == 0 +#if defined(CV_ERROR_SET_TERMINATE_HANDLER) && !CV_ERROR_SET_TERMINATE_HANDLER # undef CV_ERROR_SET_TERMINATE_HANDLER #endif @@ -532,7 +532,7 @@ struct HWFeatures "******************************************************************\n"); fprintf(stderr, "\nRequired baseline features:\n"); checkFeatures(baseline_features, sizeof(baseline_features) / sizeof(baseline_features[0]), true); - CV_ErrorNoReturn(cv::Error::StsAssert, "Missing support for required CPU baseline features. Check OpenCV build configuration and required CPU/HW setup."); + CV_Error(cv::Error::StsAssert, "Missing support for required CPU baseline features. Check OpenCV build configuration and required CPU/HW setup."); } readSettings(baseline_features, sizeof(baseline_features) / sizeof(baseline_features[0])); @@ -1657,7 +1657,7 @@ bool utils::getConfigurationParameterBool(const char* name, bool defaultValue) { return false; } - CV_ErrorNoReturn(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str())); + CV_Error(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str())); } @@ -1688,7 +1688,7 @@ size_t utils::getConfigurationParameterSizeT(const char* name, size_t defaultVal return v * 1024 * 1024; else if (suffixStr == "KB" || suffixStr == "Kb" || suffixStr == "kb") return v * 1024; - CV_ErrorNoReturn(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str())); + CV_Error(cv::Error::StsBadArg, cv::format("Invalid value for %s parameter: %s", name, value.c_str())); } cv::String utils::getConfigurationParameterString(const char* name, const char* defaultValue) diff --git a/modules/core/src/umatrix.cpp b/modules/core/src/umatrix.cpp index 2fd0ab96a5..303b6bec12 100644 --- a/modules/core/src/umatrix.cpp +++ b/modules/core/src/umatrix.cpp @@ -837,8 +837,6 @@ UMat UMat::reshape(int _cn, int _newndims, const int* _newsz) const } CV_Error(CV_StsNotImplemented, "Reshaping of n-dimensional non-continuous matrices is not supported yet"); - // TBD - return UMat(); } Mat UMat::getMat(int accessFlags) const diff --git a/modules/core/src/utils/filesystem.cpp b/modules/core/src/utils/filesystem.cpp index d9d72ecedc..d7eeffce23 100644 --- a/modules/core/src/utils/filesystem.cpp +++ b/modules/core/src/utils/filesystem.cpp @@ -265,7 +265,7 @@ struct FileLock::Impl } else { - CV_ErrorNoReturn_(Error::StsAssert, ("Can't open lock file: %s", fname)); + CV_Error_(Error::StsAssert, ("Can't open lock file: %s", fname)); } } break; @@ -517,7 +517,7 @@ cv::String getCacheDirectory(const char* sub_directory_name, const char* configu } #else -#define NOT_IMPLEMENTED CV_ErrorNoReturn(Error::StsNotImplemented, ""); +#define NOT_IMPLEMENTED CV_Error(Error::StsNotImplemented, ""); CV_EXPORTS bool exists(const cv::String& /*path*/) { NOT_IMPLEMENTED } CV_EXPORTS void remove_all(const cv::String& /*path*/) { NOT_IMPLEMENTED } CV_EXPORTS bool createDirectory(const cv::String& /*path*/) { NOT_IMPLEMENTED } diff --git a/modules/core/src/va_intel.cpp b/modules/core/src/va_intel.cpp index 5cdd6e8f3d..0a2bfd96a3 100644 --- a/modules/core/src/va_intel.cpp +++ b/modules/core/src/va_intel.cpp @@ -10,7 +10,7 @@ #ifdef HAVE_VA # include #else // HAVE_VA -# define NO_VA_SUPPORT_ERROR CV_ErrorNoReturn(cv::Error::StsBadFunc, "OpenCV was build without VA support (libva)") +# define NO_VA_SUPPORT_ERROR CV_Error(cv::Error::StsBadFunc, "OpenCV was build without VA support (libva)") #endif // HAVE_VA using namespace cv; diff --git a/modules/core/test/test_eigen.cpp b/modules/core/test/test_eigen.cpp index 8a90c6e325..b2f09ea48c 100644 --- a/modules/core/test/test_eigen.cpp +++ b/modules/core/test/test_eigen.cpp @@ -174,7 +174,6 @@ bool Core_EigenTest::check_pair_count(const cv::Mat& src, const cv::Mat& evalues std::cout << "Number of rows: " << evalues.rows << " Number of cols: " << evalues.cols << endl; std::cout << "Size of src symmetric matrix: " << src.rows << " * " << src.cols << endl; std::cout << endl; CV_Error(CORE_EIGEN_ERROR_COUNT, MESSAGE_ERROR_COUNT); - return false; } return true; } @@ -190,7 +189,6 @@ bool Core_EigenTest::check_pair_count(const cv::Mat& src, const cv::Mat& evalues std::cout << "Number of rows: " << evectors.rows << " Number of cols: " << evectors.cols << endl; std:: cout << "Size of src symmetric matrix: " << src.rows << " * " << src.cols << endl; std::cout << endl; CV_Error (CORE_EIGEN_ERROR_SIZE, MESSAGE_ERROR_SIZE); - return false; } if (!(evalues.rows == right_eigen_pair_count && evalues.cols == 1)) @@ -199,7 +197,6 @@ bool Core_EigenTest::check_pair_count(const cv::Mat& src, const cv::Mat& evalues std::cout << "Number of rows: " << evalues.rows << " Number of cols: " << evalues.cols << endl; std:: cout << "Size of src symmetric matrix: " << src.rows << " * " << src.cols << endl; std::cout << endl; CV_Error (CORE_EIGEN_ERROR_COUNT, MESSAGE_ERROR_COUNT); - return false; } return true; @@ -237,7 +234,6 @@ bool Core_EigenTest::check_orthogonality(const cv::Mat& U) std::cout << endl; std::cout << "Checking orthogonality of matrix " << U << ": "; print_information(i, U, diff, eps_vec); CV_Error(CORE_EIGEN_ERROR_ORTHO, MESSAGE_ERROR_ORTHO); - return false; } } @@ -257,7 +253,6 @@ bool Core_EigenTest::check_pairs_order(const cv::Mat& eigen_values) std::cout << "Pair of indexes with non descending of eigen values: (" << i << ", " << i+1 << ")." << endl; std::cout << endl; CV_Error(CORE_EIGEN_ERROR_ORDER, MESSAGE_ERROR_ORDER); - return false; } break; @@ -272,7 +267,6 @@ bool Core_EigenTest::check_pairs_order(const cv::Mat& eigen_values) std::cout << "Pair of indexes with non descending of eigen values: (" << i << ", " << i+1 << ")." << endl; std::cout << endl; CV_Error(CORE_EIGEN_ERROR_ORDER, "Eigen values are not sorted in descending order."); - return false; } break; @@ -331,7 +325,6 @@ bool Core_EigenTest::test_pairs(const cv::Mat& src) std::cout << endl; std::cout << "Checking accuracy of eigen vectors computing for matrix " << src << ": "; print_information(i, src, diff, eps_vec); CV_Error(CORE_EIGEN_ERROR_DIFF, MESSAGE_ERROR_DIFF_2); - return false; } } @@ -360,7 +353,6 @@ bool Core_EigenTest::test_values(const cv::Mat& src) std::cout << endl; std::cout << "Checking accuracy of eigen values computing for matrix " << src << ": "; print_information(i, src, diff, eps_val); CV_Error(CORE_EIGEN_ERROR_DIFF, MESSAGE_ERROR_DIFF_1); - return false; } } diff --git a/modules/dnn/include/opencv2/dnn/dnn.inl.hpp b/modules/dnn/include/opencv2/dnn/dnn.inl.hpp index be2e1c4895..4231896187 100644 --- a/modules/dnn/include/opencv2/dnn/dnn.inl.hpp +++ b/modules/dnn/include/opencv2/dnn/dnn.inl.hpp @@ -269,17 +269,16 @@ inline int DictValue::size() const { case Param::INT: return (int)pi->size(); - break; case Param::STRING: return (int)ps->size(); - break; case Param::REAL: return (int)pd->size(); - break; - default: - CV_Error(Error::StsInternal, ""); - return -1; } +#ifdef __OPENCV_BUILD + CV_Error(Error::StsInternal, ""); +#else + CV_ErrorNoReturn(Error::StsInternal, ""); +#endif } inline std::ostream &operator<<(std::ostream &stream, const DictValue &dictv) diff --git a/modules/dnn/src/dnn.cpp b/modules/dnn/src/dnn.cpp index edeca8e612..3f753ecec6 100644 --- a/modules/dnn/src/dnn.cpp +++ b/modules/dnn/src/dnn.cpp @@ -1941,7 +1941,7 @@ Net::Net() : impl(new Net::Impl) Net Net::readFromModelOptimizer(const String& xml, const String& bin) { #ifndef HAVE_INF_ENGINE - CV_ErrorNoReturn(Error::StsError, "Build OpenCV with Inference Engine to enable loading models from Model Optimizer."); + CV_Error(Error::StsError, "Build OpenCV with Inference Engine to enable loading models from Model Optimizer."); #else InferenceEngine::CNNNetReader reader; reader.ReadNetwork(xml); @@ -2930,7 +2930,7 @@ Net readNet(const String& _model, const String& _config, const String& _framewor std::swap(model, config); return readNetFromModelOptimizer(config, model); } - CV_ErrorNoReturn(Error::StsError, "Cannot determine an origin framework of files: " + + CV_Error(Error::StsError, "Cannot determine an origin framework of files: " + model + (config.empty() ? "" : ", " + config)); } diff --git a/modules/dnn/src/layers/detection_output_layer.cpp b/modules/dnn/src/layers/detection_output_layer.cpp index c6b711f841..5c4be180a1 100644 --- a/modules/dnn/src/layers/detection_output_layer.cpp +++ b/modules/dnn/src/layers/detection_output_layer.cpp @@ -151,7 +151,7 @@ public: message += " layer parameter does not contain "; message += parameterName; message += " parameter."; - CV_ErrorNoReturn(Error::StsBadArg, message); + CV_Error(Error::StsBadArg, message); } else { @@ -471,12 +471,12 @@ public: { int label = it->first; if (confidenceScores.rows <= label) - CV_ErrorNoReturn_(cv::Error::StsError, ("Could not find confidence predictions for label %d", label)); + CV_Error_(cv::Error::StsError, ("Could not find confidence predictions for label %d", label)); const std::vector& scores = confidenceScores.row(label); int locLabel = _shareLocation ? -1 : label; LabelBBox::const_iterator label_bboxes = decodeBBoxes.find(locLabel); if (label_bboxes == decodeBBoxes.end()) - CV_ErrorNoReturn_(cv::Error::StsError, ("Could not find location predictions for label %d", locLabel)); + CV_Error_(cv::Error::StsError, ("Could not find location predictions for label %d", locLabel)); const std::vector& indices = it->second; for (size_t j = 0; j < indices.size(); ++j, ++count) @@ -507,14 +507,14 @@ public: if (c == _backgroundLabelId) continue; // Ignore background class. if (c >= confidenceScores.rows) - CV_ErrorNoReturn_(cv::Error::StsError, ("Could not find confidence predictions for label %d", c)); + CV_Error_(cv::Error::StsError, ("Could not find confidence predictions for label %d", c)); const std::vector scores = confidenceScores.row(c); int label = _shareLocation ? -1 : c; LabelBBox::const_iterator label_bboxes = decodeBBoxes.find(label); if (label_bboxes == decodeBBoxes.end()) - CV_ErrorNoReturn_(cv::Error::StsError, ("Could not find location predictions for label %d", label)); + CV_Error_(cv::Error::StsError, ("Could not find location predictions for label %d", label)); if (_bboxesNormalized) NMSFast_(label_bboxes->second, scores, _confidenceThreshold, _nmsThreshold, 1.0, _topK, indices[c], util::caffe_norm_box_overlap); @@ -532,7 +532,7 @@ public: int label = it->first; const std::vector& labelIndices = it->second; if (label >= confidenceScores.rows) - CV_ErrorNoReturn_(cv::Error::StsError, ("Could not find location predictions for label %d", label)); + CV_Error_(cv::Error::StsError, ("Could not find location predictions for label %d", label)); const std::vector& scores = confidenceScores.row(label); for (size_t j = 0; j < labelIndices.size(); ++j) { @@ -645,7 +645,7 @@ public: decode_bbox.ymax = decode_bbox_center_y + decode_bbox_height * .5; } else - CV_ErrorNoReturn(Error::StsBadArg, "Unknown type."); + CV_Error(Error::StsBadArg, "Unknown type."); if (clip_bbox) { @@ -714,7 +714,7 @@ public: continue; // Ignore background class. LabelBBox::const_iterator label_loc_preds = loc_preds.find(label); if (label_loc_preds == loc_preds.end()) - CV_ErrorNoReturn_(cv::Error::StsError, ("Could not find location predictions for label %d", label)); + CV_Error_(cv::Error::StsError, ("Could not find location predictions for label %d", label)); DecodeBBoxes(prior_bboxes, prior_variances, code_type, variance_encoded_in_target, clip, clip_bounds, normalized_bbox, label_loc_preds->second, decode_bboxes[label]); diff --git a/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp b/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp index 80bb6b5367..8dfa0cdb62 100644 --- a/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp +++ b/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp @@ -89,7 +89,7 @@ public: if (net.node(i).name() == name) return net.node(i); } - CV_ErrorNoReturn(Error::StsParseError, "Input node with name " + name + " not found"); + CV_Error(Error::StsParseError, "Input node with name " + name + " not found"); } // Match TensorFlow subgraph starting from with a set of nodes to be fused. diff --git a/modules/features2d/src/matchers.cpp b/modules/features2d/src/matchers.cpp index 6cb7670c69..486b1b916a 100644 --- a/modules/features2d/src/matchers.cpp +++ b/modules/features2d/src/matchers.cpp @@ -1360,11 +1360,13 @@ Ptr FlannBasedMatcher::clone( bool emptyTrainData ) const { CV_Error( Error::StsNotImplemented, "deep clone functionality is not implemented, because " "Flann::Index has not copy constructor or clone method "); +#if 0 //matcher->flannIndex; matcher->addedDescCount = addedDescCount; matcher->mergedDescriptors = DescriptorCollection( mergedDescriptors ); std::transform( trainDescCollection.begin(), trainDescCollection.end(), matcher->trainDescCollection.begin(), clone_op ); +#endif } return matcher; } diff --git a/modules/highgui/src/window.cpp b/modules/highgui/src/window.cpp index 251d1d31da..663b4458fc 100644 --- a/modules/highgui/src/window.cpp +++ b/modules/highgui/src/window.cpp @@ -530,7 +530,6 @@ static const char* NO_QT_ERR_MSG = "The library is compiled without QT support"; cv::QtFont cv::fontQt(const String&, int, Scalar, int, int, int) { CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); - return QtFont(); } void cv::addText( const Mat&, const String&, Point, const QtFont&) @@ -556,7 +555,6 @@ void cv::displayOverlay(const String&, const String&, int ) int cv::startLoop(int (*)(int argc, char *argv[]), int , char**) { CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); - return 0; } void cv::stopLoop() @@ -577,7 +575,6 @@ void cv::loadWindowParameters(const String&) int cv::createButton(const String&, ButtonCallback, void*, int , bool ) { CV_Error(CV_StsNotImplemented, NO_QT_ERR_MSG); - return 0; } #endif @@ -606,17 +603,16 @@ void cv::setWindowTitle(const String&, const String&) } #define CV_NO_GUI_ERROR(funcname) \ - cvError( CV_StsError, funcname, \ + cv::errorNoReturn(cv::Error::StsError, \ "The function is not implemented. " \ "Rebuild the library with Windows, GTK+ 2.x or Carbon support. "\ "If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script", \ - __FILE__, __LINE__ ) + funcname, __FILE__, __LINE__) CV_IMPL int cvNamedWindow( const char*, int ) { CV_NO_GUI_ERROR("cvNamedWindow"); - return -1; } CV_IMPL void cvDestroyWindow( const char* ) @@ -651,7 +647,6 @@ cvCreateTrackbar( const char*, const char*, int*, int, CvTrackbarCallback ) { CV_NO_GUI_ERROR( "cvCreateTrackbar" ); - return -1; } CV_IMPL int @@ -660,7 +655,6 @@ cvCreateTrackbar2( const char* /*trackbar_name*/, const char* /*window_name*/, void* /*userdata*/ ) { CV_NO_GUI_ERROR( "cvCreateTrackbar2" ); - return -1; } CV_IMPL void @@ -672,7 +666,6 @@ cvSetMouseCallback( const char*, CvMouseCallback, void* ) CV_IMPL int cvGetTrackbarPos( const char*, const char* ) { CV_NO_GUI_ERROR( "cvGetTrackbarPos" ); - return -1; } CV_IMPL void cvSetTrackbarPos( const char*, const char*, int ) @@ -693,33 +686,28 @@ CV_IMPL void cvSetTrackbarMin(const char*, const char*, int) CV_IMPL void* cvGetWindowHandle( const char* ) { CV_NO_GUI_ERROR( "cvGetWindowHandle" ); - return 0; } CV_IMPL const char* cvGetWindowName( void* ) { CV_NO_GUI_ERROR( "cvGetWindowName" ); - return 0; } CV_IMPL int cvWaitKey( int ) { CV_NO_GUI_ERROR( "cvWaitKey" ); - return -1; } CV_IMPL int cvInitSystem( int , char** ) { CV_NO_GUI_ERROR( "cvInitSystem" ); - return -1; } CV_IMPL int cvStartWindowThread() { CV_NO_GUI_ERROR( "cvStartWindowThread" ); - return -1; } //-------- Qt --------- @@ -742,7 +730,6 @@ CV_IMPL int cvStartLoop(int (*)(int argc, char *argv[]), int , char* argv[]) { (void)argv; CV_NO_GUI_ERROR("cvStartLoop"); - return -1; } CV_IMPL void cvStopLoop() @@ -763,7 +750,6 @@ CV_IMPL void cvSaveWindowParameters(const char* ) CV_IMPL int cvCreateButton(const char*, void (*)(int, void*), void*, int, int) { CV_NO_GUI_ERROR("cvCreateButton"); - return -1; } diff --git a/modules/imgcodecs/src/grfmt_bmp.cpp b/modules/imgcodecs/src/grfmt_bmp.cpp index 25a386eaeb..3a6dbfe622 100644 --- a/modules/imgcodecs/src/grfmt_bmp.cpp +++ b/modules/imgcodecs/src/grfmt_bmp.cpp @@ -490,7 +490,7 @@ decode_rle8_bad: ; result = true; break; default: - CV_ErrorNoReturn(cv::Error::StsError, "Invalid/unsupported mode"); + CV_Error(cv::Error::StsError, "Invalid/unsupported mode"); } } CV_CATCH_ALL diff --git a/modules/imgcodecs/src/grfmt_gdal.cpp b/modules/imgcodecs/src/grfmt_gdal.cpp index cd0be3e9dd..17581b576a 100644 --- a/modules/imgcodecs/src/grfmt_gdal.cpp +++ b/modules/imgcodecs/src/grfmt_gdal.cpp @@ -409,7 +409,7 @@ bool GdalDecoder::readData( Mat& img ){ color = 3; break; default: - CV_ErrorNoReturn(cv::Error::StsError, "Invalid/unsupported mode"); + CV_Error(cv::Error::StsError, "Invalid/unsupported mode"); } // make sure the image band has the same dimensions as the image diff --git a/modules/imgcodecs/src/grfmt_pxm.cpp b/modules/imgcodecs/src/grfmt_pxm.cpp index a7da43902f..49ffc9ef59 100644 --- a/modules/imgcodecs/src/grfmt_pxm.cpp +++ b/modules/imgcodecs/src/grfmt_pxm.cpp @@ -77,7 +77,7 @@ static int ReadNumber(RLByteStream& strm, int maxdigits = 0) else { #if 1 - CV_ErrorNoReturn_(Error::StsError, ("PXM: Unexpected code in ReadNumber(): 0x%x (%d)", code, code)); + CV_Error_(Error::StsError, ("PXM: Unexpected code in ReadNumber(): 0x%x (%d)", code, code)); #else code = strm.getByte(); #endif @@ -354,7 +354,7 @@ bool PxMDecoder::readData( Mat& img ) break; } default: - CV_ErrorNoReturn(Error::StsError, "m_bpp is not supported"); + CV_Error(Error::StsError, "m_bpp is not supported"); } } CV_CATCH (cv::Exception, e) diff --git a/modules/imgcodecs/src/loadsave.cpp b/modules/imgcodecs/src/loadsave.cpp index 12852d1c48..e6782dcbec 100644 --- a/modules/imgcodecs/src/loadsave.cpp +++ b/modules/imgcodecs/src/loadsave.cpp @@ -722,7 +722,7 @@ bool imwrite( const String& filename, InputArray _img, else if (_img.isMatVector() || _img.isUMatVector()) _img.getMatVector(img_vec); else - CV_ErrorNoReturn(Error::StsBadArg, "Unknown/unsupported input encountered"); + CV_Error(Error::StsBadArg, "Unknown/unsupported input encountered"); CV_Assert(!img_vec.empty()); return imwrite_(filename, img_vec, params, false); diff --git a/modules/imgcodecs/src/rgbe.cpp b/modules/imgcodecs/src/rgbe.cpp index fd957321de..5152795d19 100644 --- a/modules/imgcodecs/src/rgbe.cpp +++ b/modules/imgcodecs/src/rgbe.cpp @@ -99,7 +99,6 @@ static int rgbe_error(int rgbe_error_code, const char *msg) CV_Error(cv::Error::StsError, cv::String("RGBE error: \n") + cv::String(msg)); } - return RGBE_RETURN_FAILURE; } /* standard conversion from float pixels to rgbe pixels */ diff --git a/modules/imgproc/src/colormap.cpp b/modules/imgproc/src/colormap.cpp index 3e5068d488..83e4878e5f 100644 --- a/modules/imgproc/src/colormap.cpp +++ b/modules/imgproc/src/colormap.cpp @@ -126,9 +126,8 @@ static Mat interp1(InputArray _x, InputArray _Y, InputArray _xi) case CV_32SC1: return interp1_(x,Y,xi); break; case CV_32FC1: return interp1_(x,Y,xi); break; case CV_64FC1: return interp1_(x,Y,xi); break; - default: CV_Error(Error::StsUnsupportedFormat, ""); break; } - return Mat(); + CV_Error(Error::StsUnsupportedFormat, ""); } namespace colormap diff --git a/modules/imgproc/src/connectedcomponents.cpp b/modules/imgproc/src/connectedcomponents.cpp index f428cf3f87..bbc27dca7d 100644 --- a/modules/imgproc/src/connectedcomponents.cpp +++ b/modules/imgproc/src/connectedcomponents.cpp @@ -3980,7 +3980,6 @@ namespace cv{ } CV_Error(CV_StsUnsupportedFormat, "unsupported label/image type"); - return -1; } } @@ -4003,7 +4002,6 @@ int cv::connectedComponents(InputArray img_, OutputArray _labels, int connectivi } else{ CV_Error(CV_StsUnsupportedFormat, "the type of labels must be 16u or 32s"); - return 0; } } diff --git a/modules/imgproc/src/filter.cpp b/modules/imgproc/src/filter.cpp index 5cbaf3f357..194040ffec 100644 --- a/modules/imgproc/src/filter.cpp +++ b/modules/imgproc/src/filter.cpp @@ -3642,8 +3642,6 @@ cv::Ptr cv::getLinearRowFilter( int srcType, int bufType, CV_Error_( CV_StsNotImplemented, ("Unsupported combination of source format (=%d), and buffer format (=%d)", srcType, bufType)); - - return Ptr(); } @@ -3739,8 +3737,6 @@ cv::Ptr cv::getLinearColumnFilter( int bufType, int dstTyp CV_Error_( CV_StsNotImplemented, ("Unsupported combination of buffer format (=%d), and destination format (=%d)", bufType, dstType)); - - return Ptr(); } @@ -4491,8 +4487,6 @@ cv::Ptr cv::getLinearFilter(int srcType, int dstType, CV_Error_( CV_StsNotImplemented, ("Unsupported combination of source format (=%d), and destination format (=%d)", srcType, dstType)); - - return Ptr(); } diff --git a/modules/imgproc/src/morph.cpp b/modules/imgproc/src/morph.cpp index ca92da3244..0c3a1e4088 100644 --- a/modules/imgproc/src/morph.cpp +++ b/modules/imgproc/src/morph.cpp @@ -888,7 +888,6 @@ cv::Ptr cv::getMorphologyRowFilter(int op, int type, int ksiz } CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); - return Ptr(); } cv::Ptr cv::getMorphologyColumnFilter(int op, int type, int ksize, int anchor) @@ -935,7 +934,6 @@ cv::Ptr cv::getMorphologyColumnFilter(int op, int type, in } CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); - return Ptr(); } @@ -973,7 +971,6 @@ cv::Ptr cv::getMorphologyFilter(int op, int type, InputArray _ke } CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type)); - return Ptr(); } diff --git a/modules/imgproc/src/precomp.hpp b/modules/imgproc/src/precomp.hpp index 55241d9b88..400b7cc2db 100644 --- a/modules/imgproc/src/precomp.hpp +++ b/modules/imgproc/src/precomp.hpp @@ -117,9 +117,7 @@ inline bool isStorageOrMat(void * arr) return true; else if (CV_IS_MAT( arr )) return false; - else - CV_Error( CV_StsBadArg, "Destination is not CvMemStorage* nor CvMat*" ); - return false; + CV_Error( CV_StsBadArg, "Destination is not CvMemStorage* nor CvMat*" ); } #endif /*__OPENCV_CV_INTERNAL_H_*/ diff --git a/modules/imgproc/src/smooth.cpp b/modules/imgproc/src/smooth.cpp index 78c85d74e1..9ac01b7172 100644 --- a/modules/imgproc/src/smooth.cpp +++ b/modules/imgproc/src/smooth.cpp @@ -1332,8 +1332,6 @@ cv::Ptr cv::getRowSumFilter(int srcType, int sumType, int ksi CV_Error_( CV_StsNotImplemented, ("Unsupported combination of source format (=%d), and buffer format (=%d)", srcType, sumType)); - - return Ptr(); } @@ -1374,8 +1372,6 @@ cv::Ptr cv::getColumnSumFilter(int sumType, int dstType, i CV_Error_( CV_StsNotImplemented, ("Unsupported combination of sum format (=%d), and destination format (=%d)", sumType, dstType)); - - return Ptr(); } @@ -1656,8 +1652,6 @@ static Ptr getSqrRowSumFilter(int srcType, int sumType, int ksize CV_Error_( CV_StsNotImplemented, ("Unsupported combination of source format (=%d), and buffer format (=%d)", srcType, sumType)); - - return Ptr(); } } diff --git a/modules/imgproc/src/undistort.cpp b/modules/imgproc/src/undistort.cpp index a10561d102..d083ceb77b 100644 --- a/modules/imgproc/src/undistort.cpp +++ b/modules/imgproc/src/undistort.cpp @@ -613,7 +613,6 @@ static Point2f mapPointSpherical(const Point2f& p, float alpha, Vec4d* J, int pr return Point2f((float)asin(x1), (float)asin(y1)); } CV_Error(CV_StsBadArg, "Unknown projection type"); - return Point2f(); } diff --git a/modules/imgproc/test/test_boundingrect.cpp b/modules/imgproc/test/test_boundingrect.cpp index 332c593a9a..52a84e5cfe 100644 --- a/modules/imgproc/test/test_boundingrect.cpp +++ b/modules/imgproc/test/test_boundingrect.cpp @@ -125,7 +125,6 @@ template bool CV_BoundingRectTest::checking_function_work(vector

ExposureCompensator::createDefault(int type) if (type == GAIN_BLOCKS) return makePtr(); CV_Error(Error::StsBadArg, "unsupported exposure compensation method"); - return Ptr(); } diff --git a/modules/ts/src/ts.cpp b/modules/ts/src/ts.cpp index 7264a34557..7dd05fbf55 100644 --- a/modules/ts/src/ts.cpp +++ b/modules/ts/src/ts.cpp @@ -836,7 +836,7 @@ std::string findDataFile(const std::string& relative_path, bool required) #endif #endif if (required) - CV_ErrorNoReturn(cv::Error::StsError, cv::format("OpenCV tests: Can't find required data file: %s", relative_path.c_str())); + CV_Error(cv::Error::StsError, cv::format("OpenCV tests: Can't find required data file: %s", relative_path.c_str())); throw SkipTestException(cv::format("OpenCV tests: Can't find data file: %s", relative_path.c_str())); } diff --git a/modules/videoio/include/opencv2/videoio/container_avi.private.hpp b/modules/videoio/include/opencv2/videoio/container_avi.private.hpp index 212a892699..61ea74dece 100644 --- a/modules/videoio/include/opencv2/videoio/container_avi.private.hpp +++ b/modules/videoio/include/opencv2/videoio/container_avi.private.hpp @@ -106,7 +106,8 @@ protected: bool parseMovi(frame_list& in_frame_list) { //not implemented - in_frame_list.empty(); + CV_UNUSED(in_frame_list); + // FIXIT: in_frame_list.empty(); return true; } bool parseStrl(char stream_id, Codecs codec_); diff --git a/modules/videoio/src/cap.cpp b/modules/videoio/src/cap.cpp index 33f7973636..67e1befca2 100644 --- a/modules/videoio/src/cap.cpp +++ b/modules/videoio/src/cap.cpp @@ -65,7 +65,7 @@ using namespace std; #if defined(__clang__) #pragma clang diagnostic ignored "-Wimplicit-fallthrough" #endif -#if defined(__GNUC__) +#if defined(__GNUC__) && __GNUC__ >= 7 #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #endif diff --git a/modules/videoio/src/cap_gstreamer.cpp b/modules/videoio/src/cap_gstreamer.cpp index c5212f6731..9c3fd049b7 100644 --- a/modules/videoio/src/cap_gstreamer.cpp +++ b/modules/videoio/src/cap_gstreamer.cpp @@ -158,7 +158,7 @@ inline static bool is_gst_element_exists(const std::string & name) //================================================================================================== -class GStreamerCapture : public IVideoCapture +class GStreamerCapture CV_FINAL : public IVideoCapture { private: GstElement* pipeline; @@ -184,12 +184,12 @@ private: public: GStreamerCapture(); ~GStreamerCapture(); - virtual bool grabFrame(); - virtual bool retrieveFrame(int /*unused*/, OutputArray dst); - virtual double getProperty(int propId) const; - virtual bool setProperty(int propId, double value); - virtual bool isOpened() const; - virtual int getCaptureDomain(); // Return the type of the capture object: CAP_VFW, etc... + virtual bool grabFrame() CV_OVERRIDE; + virtual bool retrieveFrame(int /*unused*/, OutputArray dst) CV_OVERRIDE; + virtual double getProperty(int propId) const CV_OVERRIDE; + virtual bool setProperty(int propId, double value) CV_OVERRIDE; + virtual bool isOpened() const CV_OVERRIDE; + virtual int getCaptureDomain() CV_OVERRIDE; // Return the type of the capture object: CAP_VFW, etc... bool open(int id); bool open(const String &filename_); static void newPad(GstElement * /*elem*/, GstPad *pad, gpointer data); @@ -630,7 +630,7 @@ bool GStreamerCapture::open(const String &filename_) const gchar * filename = filename_.c_str(); bool file = false; - bool stream = false; + //bool stream = false; bool manualpipeline = false; char *uri = NULL; GstElement* uridecodebin = NULL; @@ -655,7 +655,7 @@ bool GStreamerCapture::open(const String &filename_) #else uri = realpath(filename, NULL); #endif - stream = false; + //stream = false; if(uri) { uri = g_filename_to_uri(uri, NULL, NULL); @@ -680,13 +680,13 @@ bool GStreamerCapture::open(const String &filename_) fprintf(stderr, "GStreamer: Error opening bin: %s\n", err->message); return false; } - stream = true; + //stream = true; manualpipeline = true; } } else { - stream = true; + //stream = true; uri = g_strdup(filename); } diff --git a/modules/videoio/src/cap_mjpeg_encoder.cpp b/modules/videoio/src/cap_mjpeg_encoder.cpp index a518404e94..b564f608b9 100644 --- a/modules/videoio/src/cap_mjpeg_encoder.cpp +++ b/modules/videoio/src/cap_mjpeg_encoder.cpp @@ -96,7 +96,6 @@ static bool createEncodeHuffmanTable( const int* src, unsigned* table, int max_s if( size > max_size ) { CV_Error(CV_StsOutOfRange, "too big maximum Huffman code size"); - return false; } memset( table, 0, size*sizeof(table[0])); diff --git a/modules/videoio/test/test_video_io.cpp b/modules/videoio/test/test_video_io.cpp index 14bb1315b1..c1834be5ec 100644 --- a/modules/videoio/test/test_video_io.cpp +++ b/modules/videoio/test/test_video_io.cpp @@ -83,6 +83,7 @@ struct VideoCaptureAPI case CAP_ARAVIS: return "CAP_ARAVIS"; case CAP_OPENCV_MJPEG: return "CAP_OPENCV_MJPEG"; case CAP_INTEL_MFX: return "CAP_INTEL_MFX"; + case CAP_XINE: return "CAP_XINE"; } return "unknown"; } diff --git a/samples/dnn/object_detection.cpp b/samples/dnn/object_detection.cpp index 16d82eb0e7..5ff537bdbd 100644 --- a/samples/dnn/object_detection.cpp +++ b/samples/dnn/object_detection.cpp @@ -214,7 +214,7 @@ void postprocess(Mat& frame, const std::vector& outs, Net& net) } } std::vector indices; - NMSBoxes(boxes, confidences, confThreshold, 0.4, indices); + NMSBoxes(boxes, confidences, confThreshold, 0.4f, indices); for (size_t i = 0; i < indices.size(); ++i) { int idx = indices[i];