build: unreachable code after CV_Error() (part 2)
authorAlexander Alekhin <alexander.alekhin@intel.com>
Tue, 24 Apr 2018 10:48:21 +0000 (13:48 +0300)
committerAlexander Alekhin <alexander.alekhin@intel.com>
Tue, 24 Apr 2018 13:03:40 +0000 (16:03 +0300)
25 files changed:
modules/calib3d/src/circlesgrid.cpp
modules/core/src/alloc.cpp
modules/core/src/command_line_parser.cpp
modules/core/src/gl_core_3_1.cpp
modules/core/src/matrix.cpp
modules/core/src/matrix_c.cpp
modules/core/src/matrix_wrap.cpp
modules/core/src/opengl.cpp
modules/core/src/umatrix.cpp
modules/core/test/test_eigen.cpp
modules/dnn/include/opencv2/dnn/dnn.inl.hpp
modules/features2d/src/matchers.cpp
modules/highgui/src/window.cpp
modules/imgcodecs/src/rgbe.cpp
modules/imgproc/src/colormap.cpp
modules/imgproc/src/connectedcomponents.cpp
modules/imgproc/src/filter.cpp
modules/imgproc/src/morph.cpp
modules/imgproc/src/precomp.hpp
modules/imgproc/src/smooth.cpp
modules/imgproc/src/undistort.cpp
modules/imgproc/test/test_boundingrect.cpp
modules/ml/test/test_mltests2.cpp
modules/stitching/src/exposure_compensate.cpp
modules/videoio/src/cap_mjpeg_encoder.cpp

index 694644b..25da6be 100644 (file)
@@ -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<Point2f> &basis, std::vector<Graph> &basisGraphs)
index 8be7254..531af25 100644 (file)
@@ -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;
 }
 
 
index 7d5c6cc..766835f 100644 (file)
@@ -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 <sstream>
 
@@ -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
index 60d7f6f..eabb36f 100644 (file)
         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");
index f9c4044..d9d7ebe 100644 (file)
@@ -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<int>& _newshape) const
index 8b9d29e..28583cd 100644 (file)
@@ -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)
index 3fead37..bea5c67 100644 (file)
@@ -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<cuda::GpuMat>& 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 )
index 2241087..08cfb4e 100644 (file)
@@ -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
index 2fd0ab9..303b6be 100644 (file)
@@ -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
index 8a90c6e..b2f09ea 100644 (file)
@@ -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;
         }
     }
 
index be2e1c4..4231896 100644 (file)
@@ -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)
index 6cb7670..486b1b9 100644 (file)
@@ -1360,11 +1360,13 @@ Ptr<DescriptorMatcher> 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;
 }
index 251d1d3..663b445 100644 (file)
@@ -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;
 }
 
 
index fd95732..5152795 100644 (file)
@@ -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 */
index 3e5068d..83e4878 100644 (file)
@@ -126,9 +126,8 @@ static Mat interp1(InputArray _x, InputArray _Y, InputArray _xi)
         case CV_32SC1: return interp1_<int>(x,Y,xi); break;
         case CV_32FC1: return interp1_<float>(x,Y,xi); break;
         case CV_64FC1: return interp1_<double>(x,Y,xi); break;
-        default: CV_Error(Error::StsUnsupportedFormat, ""); break;
     }
-    return Mat();
+    CV_Error(Error::StsUnsupportedFormat, "");
 }
 
 namespace colormap
index f428cf3..bbc27dc 100644 (file)
@@ -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;
     }
 }
 
index 5cbaf3f..194040f 100644 (file)
@@ -3642,8 +3642,6 @@ cv::Ptr<cv::BaseRowFilter> cv::getLinearRowFilter( int srcType, int bufType,
     CV_Error_( CV_StsNotImplemented,
         ("Unsupported combination of source format (=%d), and buffer format (=%d)",
         srcType, bufType));
-
-    return Ptr<BaseRowFilter>();
 }
 
 
@@ -3739,8 +3737,6 @@ cv::Ptr<cv::BaseColumnFilter> cv::getLinearColumnFilter( int bufType, int dstTyp
     CV_Error_( CV_StsNotImplemented,
         ("Unsupported combination of buffer format (=%d), and destination format (=%d)",
         bufType, dstType));
-
-    return Ptr<BaseColumnFilter>();
 }
 
 
@@ -4491,8 +4487,6 @@ cv::Ptr<cv::BaseFilter> cv::getLinearFilter(int srcType, int dstType,
     CV_Error_( CV_StsNotImplemented,
         ("Unsupported combination of source format (=%d), and destination format (=%d)",
         srcType, dstType));
-
-    return Ptr<BaseFilter>();
 }
 
 
index ca92da3..0c3a1e4 100644 (file)
@@ -888,7 +888,6 @@ cv::Ptr<cv::BaseRowFilter> cv::getMorphologyRowFilter(int op, int type, int ksiz
     }
 
     CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type));
-    return Ptr<BaseRowFilter>();
 }
 
 cv::Ptr<cv::BaseColumnFilter> cv::getMorphologyColumnFilter(int op, int type, int ksize, int anchor)
@@ -935,7 +934,6 @@ cv::Ptr<cv::BaseColumnFilter> cv::getMorphologyColumnFilter(int op, int type, in
     }
 
     CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type));
-    return Ptr<BaseColumnFilter>();
 }
 
 
@@ -973,7 +971,6 @@ cv::Ptr<cv::BaseFilter> cv::getMorphologyFilter(int op, int type, InputArray _ke
     }
 
     CV_Error_( CV_StsNotImplemented, ("Unsupported data type (=%d)", type));
-    return Ptr<BaseFilter>();
 }
 
 
index 55241d9..400b7cc 100644 (file)
@@ -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_*/
index 78c85d7..9ac01b7 100644 (file)
@@ -1332,8 +1332,6 @@ cv::Ptr<cv::BaseRowFilter> 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<BaseRowFilter>();
 }
 
 
@@ -1374,8 +1372,6 @@ cv::Ptr<cv::BaseColumnFilter> 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<BaseColumnFilter>();
 }
 
 
@@ -1656,8 +1652,6 @@ static Ptr<BaseRowFilter> 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<BaseRowFilter>();
 }
 
 }
index a10561d..d083ceb 100644 (file)
@@ -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();
 }
 
 
index 332c593..52a84e5 100644 (file)
@@ -125,7 +125,6 @@ template <typename T> bool CV_BoundingRectTest::checking_function_work(vector <P
             cout << "Result rect (x, y, w, h): [" << rect[i].x << ", " << rect[i].y << ", " << rect[i].width << ", " << rect[i].height << "]" << endl;
             cout << endl;
             CV_Error(IMGPROC_BOUNDINGRECT_ERROR_DIFF, MESSAGE_ERROR_DIFF);
-            return false;
         }
 
     }
index 2ff0c93..b8c9090 100644 (file)
@@ -58,7 +58,6 @@ int str_to_svm_type(String& str)
     if( !str.compare("NU_SVR") )
         return SVM::NU_SVR;
     CV_Error( CV_StsBadArg, "incorrect svm type string" );
-    return -1;
 }
 int str_to_svm_kernel_type( String& str )
 {
@@ -71,7 +70,6 @@ int str_to_svm_kernel_type( String& str )
     if( !str.compare("SIGMOID") )
         return SVM::SIGMOID;
     CV_Error( CV_StsBadArg, "incorrect svm type string" );
-    return -1;
 }
 
 // 4. em
@@ -85,7 +83,6 @@ int str_to_ann_train_method( String& str )
     if (!str.compare("ANNEAL"))
         return ANN_MLP::ANNEAL;
     CV_Error( CV_StsBadArg, "incorrect ann train method string" );
-    return -1;
 }
 
 #if 0
@@ -102,7 +99,6 @@ int str_to_ann_activation_function(String& str)
     if (!str.compare("LEAKYRELU"))
         return ANN_MLP::LEAKYRELU;
     CV_Error(CV_StsBadArg, "incorrect ann activation function string");
-    return -1;
 }
 #endif
 
@@ -374,7 +370,6 @@ int str_to_boost_type( String& str )
     if ( !str.compare("GENTLE") )
         return Boost::GENTLE;
     CV_Error( CV_StsBadArg, "incorrect boost type string" );
-    return -1;
 }
 
 // 8. rtrees
@@ -387,7 +382,6 @@ int str_to_svmsgd_type( String& str )
     if ( !str.compare("ASGD") )
         return SVMSGD::ASGD;
     CV_Error( CV_StsBadArg, "incorrect svmsgd type string" );
-    return -1;
 }
 
 int str_to_margin_type( String& str )
@@ -397,7 +391,6 @@ int str_to_margin_type( String& str )
     if ( !str.compare("HARD_MARGIN") )
         return SVMSGD::HARD_MARGIN;
     CV_Error( CV_StsBadArg, "incorrect svmsgd margin type string" );
-    return -1;
 }
 
 }
index bb3914c..206eca3 100644 (file)
@@ -54,7 +54,6 @@ Ptr<ExposureCompensator> ExposureCompensator::createDefault(int type)
     if (type == GAIN_BLOCKS)
         return makePtr<BlocksGainCompensator>();
     CV_Error(Error::StsBadArg, "unsupported exposure compensation method");
-    return Ptr<ExposureCompensator>();
 }
 
 
index a518404..b564f60 100644 (file)
@@ -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]));