From 4cbec82ac175a26995fe54c426325d921cf348cd Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Mon, 23 Apr 2018 14:32:40 +0300 Subject: [PATCH] build: unreachable code after CV_Error() --- .../include/opencv2/core/private.cuda.hpp | 4 +- modules/core/src/cuda_gpu_mat.cpp | 2 - modules/core/src/cuda_host_mem.cpp | 2 - modules/core/src/cuda_info.cpp | 61 ------------------- modules/core/src/cuda_stream.cpp | 6 -- modules/core/src/gl_core_3_1.cpp | 1 - modules/core/src/opengl.cpp | 13 +--- modules/stitching/src/blenders.cpp | 1 - modules/stitching/src/timelapsers.cpp | 1 - modules/stitching/src/warpers_cuda.cpp | 6 -- modules/superres/src/btv_l1_cuda.cpp | 1 - modules/superres/src/frame_source.cpp | 3 +- modules/superres/src/optical_flow.cpp | 4 -- modules/videostab/src/global_motion.cpp | 3 +- modules/videostab/src/inpainting.cpp | 6 +- 15 files changed, 9 insertions(+), 105 deletions(-) diff --git a/modules/core/include/opencv2/core/private.cuda.hpp b/modules/core/include/opencv2/core/private.cuda.hpp index 003ff126ba..10948e5408 100644 --- a/modules/core/include/opencv2/core/private.cuda.hpp +++ b/modules/core/include/opencv2/core/private.cuda.hpp @@ -104,13 +104,13 @@ namespace cv { namespace cuda { #ifndef HAVE_CUDA -static inline void throw_no_cuda() { CV_Error(cv::Error::GpuNotSupported, "The library is compiled without CUDA support"); } +static inline CV_NORETURN void throw_no_cuda() { CV_Error(cv::Error::GpuNotSupported, "The library is compiled without CUDA support"); } #else // HAVE_CUDA #define nppSafeSetStream(oldStream, newStream) { if(oldStream != newStream) { cudaStreamSynchronize(oldStream); nppSetStream(newStream); } } -static inline void throw_no_cuda() { CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); } +static inline CV_NORETURN void throw_no_cuda() { CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); } namespace cv { namespace cuda { diff --git a/modules/core/src/cuda_gpu_mat.cpp b/modules/core/src/cuda_gpu_mat.cpp index 0d1e3ba330..8215dd0694 100644 --- a/modules/core/src/cuda_gpu_mat.cpp +++ b/modules/core/src/cuda_gpu_mat.cpp @@ -488,7 +488,6 @@ GpuMat& cv::cuda::GpuMat::setTo(Scalar s, Stream& _stream) (void) s; (void) _stream; throw_no_cuda(); - return *this; } GpuMat& cv::cuda::GpuMat::setTo(Scalar s, InputArray _mask, Stream& _stream) @@ -497,7 +496,6 @@ GpuMat& cv::cuda::GpuMat::setTo(Scalar s, InputArray _mask, Stream& _stream) (void) _mask; (void) _stream; throw_no_cuda(); - return *this; } void cv::cuda::GpuMat::convertTo(OutputArray _dst, int rtype, Stream& _stream) const diff --git a/modules/core/src/cuda_host_mem.cpp b/modules/core/src/cuda_host_mem.cpp index 3f1daf5411..37b2314c96 100644 --- a/modules/core/src/cuda_host_mem.cpp +++ b/modules/core/src/cuda_host_mem.cpp @@ -138,7 +138,6 @@ MatAllocator* cv::cuda::HostMem::getAllocator(AllocType alloc_type) #ifndef HAVE_CUDA (void) alloc_type; throw_no_cuda(); - return NULL; #else static std::map > allocators; @@ -302,7 +301,6 @@ GpuMat cv::cuda::HostMem::createGpuMatHeader() const { #ifndef HAVE_CUDA throw_no_cuda(); - return GpuMat(); #else CV_Assert( alloc_type == SHARED ); diff --git a/modules/core/src/cuda_info.cpp b/modules/core/src/cuda_info.cpp index 4bf3d8f78e..c7c5c3ed89 100644 --- a/modules/core/src/cuda_info.cpp +++ b/modules/core/src/cuda_info.cpp @@ -79,7 +79,6 @@ int cv::cuda::getDevice() { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else int device; cudaSafeCall( cudaGetDevice(&device) ); @@ -101,7 +100,6 @@ bool cv::cuda::deviceSupports(FeatureSet feature_set) #ifndef HAVE_CUDA (void) feature_set; throw_no_cuda(); - return false; #else static int versions[] = { @@ -231,7 +229,6 @@ bool cv::cuda::TargetArchs::builtWith(cv::cuda::FeatureSet feature_set) #ifndef HAVE_CUDA (void) feature_set; throw_no_cuda(); - return false; #else return cudaArch.builtWith(feature_set); #endif @@ -243,7 +240,6 @@ bool cv::cuda::TargetArchs::hasPtx(int major, int minor) (void) major; (void) minor; throw_no_cuda(); - return false; #else return cudaArch.hasPtx(major, minor); #endif @@ -255,7 +251,6 @@ bool cv::cuda::TargetArchs::hasBin(int major, int minor) (void) major; (void) minor; throw_no_cuda(); - return false; #else return cudaArch.hasBin(major, minor); #endif @@ -267,7 +262,6 @@ bool cv::cuda::TargetArchs::hasEqualOrLessPtx(int major, int minor) (void) major; (void) minor; throw_no_cuda(); - return false; #else return cudaArch.hasEqualOrLessPtx(major, minor); #endif @@ -279,7 +273,6 @@ bool cv::cuda::TargetArchs::hasEqualOrGreaterPtx(int major, int minor) (void) major; (void) minor; throw_no_cuda(); - return false; #else return cudaArch.hasEqualOrGreaterPtx(major, minor); #endif @@ -291,7 +284,6 @@ bool cv::cuda::TargetArchs::hasEqualOrGreaterBin(int major, int minor) (void) major; (void) minor; throw_no_cuda(); - return false; #else return cudaArch.hasEqualOrGreaterBin(major, minor); #endif @@ -350,7 +342,6 @@ const char* cv::cuda::DeviceInfo::name() const { #ifndef HAVE_CUDA throw_no_cuda(); - return ""; #else return deviceProps().get(device_id_)->name; #endif @@ -360,7 +351,6 @@ size_t cv::cuda::DeviceInfo::totalGlobalMem() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->totalGlobalMem; #endif @@ -370,7 +360,6 @@ size_t cv::cuda::DeviceInfo::sharedMemPerBlock() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->sharedMemPerBlock; #endif @@ -380,7 +369,6 @@ int cv::cuda::DeviceInfo::regsPerBlock() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->regsPerBlock; #endif @@ -390,7 +378,6 @@ int cv::cuda::DeviceInfo::warpSize() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->warpSize; #endif @@ -400,7 +387,6 @@ size_t cv::cuda::DeviceInfo::memPitch() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->memPitch; #endif @@ -410,7 +396,6 @@ int cv::cuda::DeviceInfo::maxThreadsPerBlock() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->maxThreadsPerBlock; #endif @@ -420,7 +405,6 @@ Vec3i cv::cuda::DeviceInfo::maxThreadsDim() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec3i(); #else return Vec3i(deviceProps().get(device_id_)->maxThreadsDim); #endif @@ -430,7 +414,6 @@ Vec3i cv::cuda::DeviceInfo::maxGridSize() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec3i(); #else return Vec3i(deviceProps().get(device_id_)->maxGridSize); #endif @@ -440,7 +423,6 @@ int cv::cuda::DeviceInfo::clockRate() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->clockRate; #endif @@ -450,7 +432,6 @@ size_t cv::cuda::DeviceInfo::totalConstMem() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->totalConstMem; #endif @@ -460,7 +441,6 @@ int cv::cuda::DeviceInfo::majorVersion() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->major; #endif @@ -470,7 +450,6 @@ int cv::cuda::DeviceInfo::minorVersion() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->minor; #endif @@ -480,7 +459,6 @@ size_t cv::cuda::DeviceInfo::textureAlignment() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->textureAlignment; #endif @@ -490,7 +468,6 @@ size_t cv::cuda::DeviceInfo::texturePitchAlignment() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->texturePitchAlignment; #endif @@ -500,7 +477,6 @@ int cv::cuda::DeviceInfo::multiProcessorCount() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->multiProcessorCount; #endif @@ -510,7 +486,6 @@ bool cv::cuda::DeviceInfo::kernelExecTimeoutEnabled() const { #ifndef HAVE_CUDA throw_no_cuda(); - return false; #else return deviceProps().get(device_id_)->kernelExecTimeoutEnabled != 0; #endif @@ -520,7 +495,6 @@ bool cv::cuda::DeviceInfo::integrated() const { #ifndef HAVE_CUDA throw_no_cuda(); - return false; #else return deviceProps().get(device_id_)->integrated != 0; #endif @@ -530,7 +504,6 @@ bool cv::cuda::DeviceInfo::canMapHostMemory() const { #ifndef HAVE_CUDA throw_no_cuda(); - return false; #else return deviceProps().get(device_id_)->canMapHostMemory != 0; #endif @@ -540,7 +513,6 @@ DeviceInfo::ComputeMode cv::cuda::DeviceInfo::computeMode() const { #ifndef HAVE_CUDA throw_no_cuda(); - return ComputeModeDefault; #else static const ComputeMode tbl[] = { @@ -558,7 +530,6 @@ int cv::cuda::DeviceInfo::maxTexture1D() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->maxTexture1D; #endif @@ -568,7 +539,6 @@ int cv::cuda::DeviceInfo::maxTexture1DMipmap() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else #if CUDA_VERSION >= 5000 return deviceProps().get(device_id_)->maxTexture1DMipmap; @@ -583,7 +553,6 @@ int cv::cuda::DeviceInfo::maxTexture1DLinear() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->maxTexture1DLinear; #endif @@ -593,7 +562,6 @@ Vec2i cv::cuda::DeviceInfo::maxTexture2D() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec2i(); #else return Vec2i(deviceProps().get(device_id_)->maxTexture2D); #endif @@ -603,7 +571,6 @@ Vec2i cv::cuda::DeviceInfo::maxTexture2DMipmap() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec2i(); #else #if CUDA_VERSION >= 5000 return Vec2i(deviceProps().get(device_id_)->maxTexture2DMipmap); @@ -618,7 +585,6 @@ Vec3i cv::cuda::DeviceInfo::maxTexture2DLinear() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec3i(); #else return Vec3i(deviceProps().get(device_id_)->maxTexture2DLinear); #endif @@ -628,7 +594,6 @@ Vec2i cv::cuda::DeviceInfo::maxTexture2DGather() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec2i(); #else return Vec2i(deviceProps().get(device_id_)->maxTexture2DGather); #endif @@ -638,7 +603,6 @@ Vec3i cv::cuda::DeviceInfo::maxTexture3D() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec3i(); #else return Vec3i(deviceProps().get(device_id_)->maxTexture3D); #endif @@ -648,7 +612,6 @@ int cv::cuda::DeviceInfo::maxTextureCubemap() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->maxTextureCubemap; #endif @@ -658,7 +621,6 @@ Vec2i cv::cuda::DeviceInfo::maxTexture1DLayered() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec2i(); #else return Vec2i(deviceProps().get(device_id_)->maxTexture1DLayered); #endif @@ -668,7 +630,6 @@ Vec3i cv::cuda::DeviceInfo::maxTexture2DLayered() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec3i(); #else return Vec3i(deviceProps().get(device_id_)->maxTexture2DLayered); #endif @@ -678,7 +639,6 @@ Vec2i cv::cuda::DeviceInfo::maxTextureCubemapLayered() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec2i(); #else return Vec2i(deviceProps().get(device_id_)->maxTextureCubemapLayered); #endif @@ -688,7 +648,6 @@ int cv::cuda::DeviceInfo::maxSurface1D() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->maxSurface1D; #endif @@ -698,7 +657,6 @@ Vec2i cv::cuda::DeviceInfo::maxSurface2D() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec2i(); #else return Vec2i(deviceProps().get(device_id_)->maxSurface2D); #endif @@ -708,7 +666,6 @@ Vec3i cv::cuda::DeviceInfo::maxSurface3D() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec3i(); #else return Vec3i(deviceProps().get(device_id_)->maxSurface3D); #endif @@ -718,7 +675,6 @@ Vec2i cv::cuda::DeviceInfo::maxSurface1DLayered() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec2i(); #else return Vec2i(deviceProps().get(device_id_)->maxSurface1DLayered); #endif @@ -728,7 +684,6 @@ Vec3i cv::cuda::DeviceInfo::maxSurface2DLayered() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec3i(); #else return Vec3i(deviceProps().get(device_id_)->maxSurface2DLayered); #endif @@ -738,7 +693,6 @@ int cv::cuda::DeviceInfo::maxSurfaceCubemap() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->maxSurfaceCubemap; #endif @@ -748,7 +702,6 @@ Vec2i cv::cuda::DeviceInfo::maxSurfaceCubemapLayered() const { #ifndef HAVE_CUDA throw_no_cuda(); - return Vec2i(); #else return Vec2i(deviceProps().get(device_id_)->maxSurfaceCubemapLayered); #endif @@ -758,7 +711,6 @@ size_t cv::cuda::DeviceInfo::surfaceAlignment() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->surfaceAlignment; #endif @@ -768,7 +720,6 @@ bool cv::cuda::DeviceInfo::concurrentKernels() const { #ifndef HAVE_CUDA throw_no_cuda(); - return false; #else return deviceProps().get(device_id_)->concurrentKernels != 0; #endif @@ -778,7 +729,6 @@ bool cv::cuda::DeviceInfo::ECCEnabled() const { #ifndef HAVE_CUDA throw_no_cuda(); - return false; #else return deviceProps().get(device_id_)->ECCEnabled != 0; #endif @@ -788,7 +738,6 @@ int cv::cuda::DeviceInfo::pciBusID() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->pciBusID; #endif @@ -798,7 +747,6 @@ int cv::cuda::DeviceInfo::pciDeviceID() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->pciDeviceID; #endif @@ -808,7 +756,6 @@ int cv::cuda::DeviceInfo::pciDomainID() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->pciDomainID; #endif @@ -818,7 +765,6 @@ bool cv::cuda::DeviceInfo::tccDriver() const { #ifndef HAVE_CUDA throw_no_cuda(); - return false; #else return deviceProps().get(device_id_)->tccDriver != 0; #endif @@ -828,7 +774,6 @@ int cv::cuda::DeviceInfo::asyncEngineCount() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->asyncEngineCount; #endif @@ -838,7 +783,6 @@ bool cv::cuda::DeviceInfo::unifiedAddressing() const { #ifndef HAVE_CUDA throw_no_cuda(); - return false; #else return deviceProps().get(device_id_)->unifiedAddressing != 0; #endif @@ -848,7 +792,6 @@ int cv::cuda::DeviceInfo::memoryClockRate() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->memoryClockRate; #endif @@ -858,7 +801,6 @@ int cv::cuda::DeviceInfo::memoryBusWidth() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->memoryBusWidth; #endif @@ -868,7 +810,6 @@ int cv::cuda::DeviceInfo::l2CacheSize() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->l2CacheSize; #endif @@ -878,7 +819,6 @@ int cv::cuda::DeviceInfo::maxThreadsPerMultiProcessor() const { #ifndef HAVE_CUDA throw_no_cuda(); - return 0; #else return deviceProps().get(device_id_)->maxThreadsPerMultiProcessor; #endif @@ -906,7 +846,6 @@ bool cv::cuda::DeviceInfo::isCompatible() const { #ifndef HAVE_CUDA throw_no_cuda(); - return false; #else // Check PTX compatibility if (TargetArchs::hasEqualOrLessPtx(majorVersion(), minorVersion())) diff --git a/modules/core/src/cuda_stream.cpp b/modules/core/src/cuda_stream.cpp index 6574f27c16..67cb6ad954 100644 --- a/modules/core/src/cuda_stream.cpp +++ b/modules/core/src/cuda_stream.cpp @@ -450,7 +450,6 @@ bool cv::cuda::Stream::queryIfComplete() const { #ifndef HAVE_CUDA throw_no_cuda(); - return false; #else cudaError_t err = cudaStreamQuery(impl_->stream); @@ -526,8 +525,6 @@ Stream& cv::cuda::Stream::Null() { #ifndef HAVE_CUDA throw_no_cuda(); - static Stream stream; - return stream; #else const int deviceId = getDevice(); return initializer.getNullStream(deviceId); @@ -716,7 +713,6 @@ GpuMat cv::cuda::BufferPool::getBuffer(int rows, int cols, int type) (void) cols; (void) type; throw_no_cuda(); - return GpuMat(); #else GpuMat buf(allocator_); buf.create(rows, cols, type); @@ -806,7 +802,6 @@ bool cv::cuda::Event::queryIfComplete() const { #ifndef HAVE_CUDA throw_no_cuda(); - return false; #else cudaError_t err = cudaEventQuery(impl_->event); @@ -833,7 +828,6 @@ float cv::cuda::Event::elapsedTime(const Event& start, const Event& end) (void) start; (void) end; throw_no_cuda(); - return 0.0f; #else float ms; cudaSafeCall( cudaEventElapsedTime(&ms, start.impl_->event, end.impl_->event) ); diff --git a/modules/core/src/gl_core_3_1.cpp b/modules/core/src/gl_core_3_1.cpp index 318eb50e13..60d7f6f88a 100644 --- a/modules/core/src/gl_core_3_1.cpp +++ b/modules/core/src/gl_core_3_1.cpp @@ -146,7 +146,6 @@ static void* IntGetProcAddress(const char*) { CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support"); - return 0; } #endif diff --git a/modules/core/src/opengl.cpp b/modules/core/src/opengl.cpp index 111a9737dc..4146e6ab8f 100644 --- a/modules/core/src/opengl.cpp +++ b/modules/core/src/opengl.cpp @@ -57,7 +57,7 @@ using namespace cv::cuda; namespace { #ifndef HAVE_OPENGL -inline static void throw_no_ogl() { CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support"); } +inline static CV_NORETURN void throw_no_ogl() { CV_Error(cv::Error::OpenGlNotSupported, "The library is compiled without OpenGL support"); } #elif defined _DEBUG inline static bool checkError(const char* file, const int line, const char* func = 0) { @@ -82,8 +82,7 @@ inline static bool checkError(const char* file, const int line, const char* func default: msg = "Unknown error"; }; - cvError(CV_OpenGlApiCallError, func, msg, file, line); - return false; + cv::errorNoReturn(Error::OpenGlApiCallError, func, msg, file, line); } return true; } @@ -697,7 +696,6 @@ cv::ogl::Buffer cv::ogl::Buffer::clone(Target target, bool autoRelease) const (void) target; (void) autoRelease; throw_no_ogl(); - return cv::ogl::Buffer(); #else ogl::Buffer buf; buf.copyFrom(*this, target, autoRelease); @@ -731,7 +729,6 @@ Mat cv::ogl::Buffer::mapHost(Access access) #ifndef HAVE_OPENGL (void) access; throw_no_ogl(); - return Mat(); #else return Mat(rows_, cols_, type_, impl_->mapHost(access)); #endif @@ -750,11 +747,9 @@ GpuMat cv::ogl::Buffer::mapDevice() { #ifndef HAVE_OPENGL throw_no_ogl(); - return GpuMat(); #else #ifndef HAVE_CUDA throw_no_cuda(); - return GpuMat(); #else return GpuMat(rows_, cols_, type_, impl_->mapDevice()); #endif @@ -779,12 +774,10 @@ cuda::GpuMat cv::ogl::Buffer::mapDevice(cuda::Stream& stream) #ifndef HAVE_OPENGL (void) stream; throw_no_ogl(); - return GpuMat(); #else #ifndef HAVE_CUDA (void) stream; throw_no_cuda(); - return GpuMat(); #else return GpuMat(rows_, cols_, type_, impl_->mapDevice(cuda::StreamAccessor::getStream(stream))); #endif @@ -810,7 +803,6 @@ unsigned int cv::ogl::Buffer::bufId() const { #ifndef HAVE_OPENGL throw_no_ogl(); - return 0; #else return impl_->bufId(); #endif @@ -1216,7 +1208,6 @@ unsigned int cv::ogl::Texture2D::texId() const { #ifndef HAVE_OPENGL throw_no_ogl(); - return 0; #else return impl_->texId(); #endif diff --git a/modules/stitching/src/blenders.cpp b/modules/stitching/src/blenders.cpp index ee665b348d..5a7fa856c0 100644 --- a/modules/stitching/src/blenders.cpp +++ b/modules/stitching/src/blenders.cpp @@ -74,7 +74,6 @@ Ptr Blender::createDefault(int type, bool try_gpu) if (type == MULTI_BAND) return makePtr(try_gpu); CV_Error(Error::StsBadArg, "unsupported blending method"); - return Ptr(); } diff --git a/modules/stitching/src/timelapsers.cpp b/modules/stitching/src/timelapsers.cpp index b42e79ae1a..fef94b64d6 100644 --- a/modules/stitching/src/timelapsers.cpp +++ b/modules/stitching/src/timelapsers.cpp @@ -53,7 +53,6 @@ Ptr Timelapser::createDefault(int type) if (type == CROP) return makePtr(); CV_Error(Error::StsBadArg, "unsupported timelapsing method"); - return Ptr(); } diff --git a/modules/stitching/src/warpers_cuda.cpp b/modules/stitching/src/warpers_cuda.cpp index d1fe8739b4..67f9042131 100644 --- a/modules/stitching/src/warpers_cuda.cpp +++ b/modules/stitching/src/warpers_cuda.cpp @@ -163,7 +163,6 @@ Rect cv::detail::PlaneWarperGpu::buildMaps(Size src_size, InputArray K, InputArr (void)xmap; (void)ymap; throw_no_cuda(); - return Rect(); #else projector_.setCameraParams(K, R, T); @@ -198,7 +197,6 @@ Point cv::detail::PlaneWarperGpu::warp(const cuda::GpuMat & src, InputArray K, I (void)border_mode; (void)dst; throw_no_cuda(); - return Point(); #else Rect dst_roi = buildMaps(src.size(), K, R, T, d_xmap_, d_ymap_); dst.create(dst_roi.height + 1, dst_roi.width + 1, src.type()); @@ -216,7 +214,6 @@ Rect cv::detail::SphericalWarperGpu::buildMaps(Size src_size, InputArray K, Inpu (void)xmap; (void)ymap; throw_no_cuda(); - return Rect(); #else projector_.setCameraParams(K, R); @@ -242,7 +239,6 @@ Point cv::detail::SphericalWarperGpu::warp(const cuda::GpuMat & src, InputArray (void)border_mode; (void)dst; throw_no_cuda(); - return Point(); #else Rect dst_roi = buildMaps(src.size(), K, R, d_xmap_, d_ymap_); dst.create(dst_roi.height + 1, dst_roi.width + 1, src.type()); @@ -262,7 +258,6 @@ Rect cv::detail::CylindricalWarperGpu::buildMaps(Size src_size, InputArray K, In (void)xmap; (void)ymap; throw_no_cuda(); - return Rect(); #else projector_.setCameraParams(K, R); @@ -288,7 +283,6 @@ Point cv::detail::CylindricalWarperGpu::warp(const cuda::GpuMat & src, InputArra (void)border_mode; (void)dst; throw_no_cuda(); - return Point(); #else Rect dst_roi = buildMaps(src.size(), K, R, d_xmap_, d_ymap_); dst.create(dst_roi.height + 1, dst_roi.width + 1, src.type()); diff --git a/modules/superres/src/btv_l1_cuda.cpp b/modules/superres/src/btv_l1_cuda.cpp index 357eadf071..dd8c305035 100644 --- a/modules/superres/src/btv_l1_cuda.cpp +++ b/modules/superres/src/btv_l1_cuda.cpp @@ -55,7 +55,6 @@ using namespace cv::superres::detail; Ptr cv::superres::createSuperResolution_BTVL1_CUDA() { CV_Error(Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); - return Ptr(); } #else // HAVE_CUDA diff --git a/modules/superres/src/frame_source.cpp b/modules/superres/src/frame_source.cpp index 350f39c3fa..cc7fdb2adb 100644 --- a/modules/superres/src/frame_source.cpp +++ b/modules/superres/src/frame_source.cpp @@ -196,9 +196,8 @@ Ptr cv::superres::createFrameSource_Camera(int deviceId) Ptr cv::superres::createFrameSource_Video_CUDA(const String& fileName) { - (void) fileName; + CV_UNUSED(fileName); CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); - return Ptr(); } #else // HAVE_OPENCV_CUDACODEC diff --git a/modules/superres/src/optical_flow.cpp b/modules/superres/src/optical_flow.cpp index cd6153a4be..2e0c485b36 100644 --- a/modules/superres/src/optical_flow.cpp +++ b/modules/superres/src/optical_flow.cpp @@ -411,25 +411,21 @@ Ptr cv::superres::createOptFlow_DualTVL1() Ptr cv::superres::createOptFlow_Farneback_CUDA() { CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); - return Ptr(); } Ptr cv::superres::createOptFlow_DualTVL1_CUDA() { CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); - return Ptr(); } Ptr cv::superres::createOptFlow_Brox_CUDA() { CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); - return Ptr(); } Ptr cv::superres::createOptFlow_PyrLK_CUDA() { CV_Error(cv::Error::StsNotImplemented, "The called functionality is disabled for current build or platform"); - return Ptr(); } #else // HAVE_OPENCV_CUDAOPTFLOW diff --git a/modules/videostab/src/global_motion.cpp b/modules/videostab/src/global_motion.cpp index f40ef4c7ef..c49de12a8d 100644 --- a/modules/videostab/src/global_motion.cpp +++ b/modules/videostab/src/global_motion.cpp @@ -546,9 +546,8 @@ Mat MotionEstimatorL1::estimate(InputArray points0, InputArray points1, bool *ok #ifndef HAVE_CLP + CV_UNUSED(ok); CV_Error(Error::StsError, "The library is built without Clp support"); - if (ok) *ok = false; - return Mat::eye(3, 3, CV_32F); #else diff --git a/modules/videostab/src/inpainting.cpp b/modules/videostab/src/inpainting.cpp index 19f8e519fc..ea69060b48 100644 --- a/modules/videostab/src/inpainting.cpp +++ b/modules/videostab/src/inpainting.cpp @@ -329,12 +329,12 @@ MotionInpainter::MotionInpainter() { #ifdef HAVE_OPENCV_CUDAOPTFLOW setOptFlowEstimator(makePtr()); -#else - CV_Error(Error::StsNotImplemented, "Current implementation of MotionInpainter requires CUDA"); -#endif setFlowErrorThreshold(1e-4f); setDistThreshold(5.f); setBorderMode(BORDER_REPLICATE); +#else + CV_Error(Error::StsNotImplemented, "Current implementation of MotionInpainter requires CUDA"); +#endif }