mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #22935 from alalek:gapi_error
G-API: replace GAPI_Assert() with 'false' and '0' to GAPI_Error() * gapi: GAPI_Error() macro * gapi: replace GAPI_Assert() with 'false' and '0' to GAPI_Error() * build: eliminate 'unreachable code' after CV_Error() (MSVC 2015) * build: eliminate 'unreachable code' warning for MSVS 2015/2017 - observed in constructors stubs with throwing exception
This commit is contained in:
committed by
GitHub
parent
420db56ffd
commit
91998d6424
@@ -41,7 +41,7 @@ inline std::ostream& operator<<(std::ostream& os, mathOp op)
|
||||
CASE(SUB);
|
||||
CASE(MUL);
|
||||
CASE(DIV);
|
||||
default: GAPI_Assert(false && "unknown mathOp value");
|
||||
default: GAPI_Error("unknown mathOp value");
|
||||
}
|
||||
#undef CASE
|
||||
return os;
|
||||
@@ -57,7 +57,7 @@ inline std::ostream& operator<<(std::ostream& os, bitwiseOp op)
|
||||
CASE(OR);
|
||||
CASE(XOR);
|
||||
CASE(NOT);
|
||||
default: GAPI_Assert(false && "unknown bitwiseOp value");
|
||||
default: GAPI_Error("unknown bitwiseOp value");
|
||||
}
|
||||
#undef CASE
|
||||
return os;
|
||||
|
||||
@@ -34,7 +34,7 @@ inline std::ostream& operator<<(std::ostream& os, operation op)
|
||||
CASE(GTR); CASE(LTR); CASE(GER); CASE(LER); CASE(EQR); CASE(NER);
|
||||
CASE(AND); CASE(OR); CASE(XOR);
|
||||
CASE(ANDR); CASE(ORR); CASE(XORR);
|
||||
default: GAPI_Assert(false && "unknown operation value");
|
||||
default: GAPI_Error("unknown operation value");
|
||||
}
|
||||
#undef CASE
|
||||
return os;
|
||||
@@ -187,7 +187,7 @@ struct g_api_ocv_pair_mat_scalar {
|
||||
CASE(GTR); CASE(LTR); CASE(GER); CASE(LER); CASE(EQR); CASE(NER);
|
||||
CASE(AND); CASE(OR); CASE(XOR);
|
||||
CASE(ANDR); CASE(ORR); CASE(XORR);
|
||||
default: GAPI_Assert(false && "unknown operation value");
|
||||
default: GAPI_Error("unknown operation value");
|
||||
}
|
||||
}
|
||||
#undef CASE
|
||||
@@ -214,7 +214,7 @@ struct g_api_ocv_pair_mat_mat {
|
||||
CASE(ADD); CASE(SUB); CASE(DIV);
|
||||
CASE(GT); CASE(LT); CASE(GE); CASE(LE); CASE(EQ); CASE(NE);
|
||||
CASE(AND); CASE(OR); CASE(XOR);
|
||||
default: GAPI_Assert(false && "unknown operation value");
|
||||
default: GAPI_Error("unknown operation value");
|
||||
}
|
||||
}
|
||||
#undef CASE
|
||||
|
||||
@@ -25,7 +25,7 @@ TEST_P(TestGAPIStereo, DisparityDepthTest)
|
||||
case format::DEPTH_FLOAT16: dtype = CV_16FC1; break;
|
||||
case format::DEPTH_FLOAT32: dtype = CV_32FC1; break;
|
||||
case format::DISPARITY_FIXED16_12_4: dtype = CV_16SC1; break;
|
||||
default: GAPI_Assert(false && "Unsupported format in test");
|
||||
default: GAPI_Error("Unsupported format in test");
|
||||
}
|
||||
initOutMats(sz, dtype);
|
||||
|
||||
@@ -61,7 +61,7 @@ TEST_P(TestGAPIStereo, DisparityDepthTest)
|
||||
case format::DISPARITY_FIXED16_12_4:
|
||||
break;
|
||||
default:
|
||||
GAPI_Assert(false && "Unsupported format in test");
|
||||
GAPI_Error("Unsupported format in test");
|
||||
}
|
||||
|
||||
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
|
||||
|
||||
@@ -373,7 +373,7 @@ public:
|
||||
initMatByPointsVectorRandU<Pt<cv::float16_t>>(sz_in);
|
||||
break;
|
||||
default:
|
||||
GAPI_Assert(false && "Unsupported depth");
|
||||
GAPI_Error("Unsupported depth");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1065,7 +1065,7 @@ inline std::ostream& operator<<(std::ostream& os, CmpTypes op)
|
||||
CASE(CMP_LT);
|
||||
CASE(CMP_LE);
|
||||
CASE(CMP_NE);
|
||||
default: GAPI_Assert(false && "unknown CmpTypes value");
|
||||
default: GAPI_Error("unknown CmpTypes value");
|
||||
}
|
||||
#undef CASE
|
||||
return os;
|
||||
@@ -1084,7 +1084,7 @@ inline std::ostream& operator<<(std::ostream& os, NormTypes op)
|
||||
CASE(NORM_HAMMING2);
|
||||
CASE(NORM_RELATIVE);
|
||||
CASE(NORM_MINMAX);
|
||||
default: GAPI_Assert(false && "unknown NormTypes value");
|
||||
default: GAPI_Error("unknown NormTypes value");
|
||||
}
|
||||
#undef CASE
|
||||
return os;
|
||||
@@ -1100,7 +1100,7 @@ inline std::ostream& operator<<(std::ostream& os, RetrievalModes op)
|
||||
CASE(RETR_CCOMP);
|
||||
CASE(RETR_TREE);
|
||||
CASE(RETR_FLOODFILL);
|
||||
default: GAPI_Assert(false && "unknown RetrievalModes value");
|
||||
default: GAPI_Error("unknown RetrievalModes value");
|
||||
}
|
||||
#undef CASE
|
||||
return os;
|
||||
@@ -1115,7 +1115,7 @@ inline std::ostream& operator<<(std::ostream& os, ContourApproximationModes op)
|
||||
CASE(CHAIN_APPROX_SIMPLE);
|
||||
CASE(CHAIN_APPROX_TC89_L1);
|
||||
CASE(CHAIN_APPROX_TC89_KCOS);
|
||||
default: GAPI_Assert(false && "unknown ContourApproximationModes value");
|
||||
default: GAPI_Error("unknown ContourApproximationModes value");
|
||||
}
|
||||
#undef CASE
|
||||
return os;
|
||||
@@ -1134,7 +1134,7 @@ inline std::ostream& operator<<(std::ostream& os, MorphTypes op)
|
||||
CASE(MORPH_TOPHAT);
|
||||
CASE(MORPH_BLACKHAT);
|
||||
CASE(MORPH_HITMISS);
|
||||
default: GAPI_Assert(false && "unknown MorphTypes value");
|
||||
default: GAPI_Error("unknown MorphTypes value");
|
||||
}
|
||||
#undef CASE
|
||||
return os;
|
||||
@@ -1153,7 +1153,7 @@ inline std::ostream& operator<<(std::ostream& os, DistanceTypes op)
|
||||
CASE(DIST_FAIR);
|
||||
CASE(DIST_WELSCH);
|
||||
CASE(DIST_HUBER);
|
||||
default: GAPI_Assert(false && "unknown DistanceTypes value");
|
||||
default: GAPI_Error("unknown DistanceTypes value");
|
||||
}
|
||||
#undef CASE
|
||||
return os;
|
||||
@@ -1176,7 +1176,7 @@ inline std::ostream& operator<<(std::ostream& os, KmeansFlags op)
|
||||
case KmeansFlags::KMEANS_PP_CENTERS | KmeansFlags::KMEANS_USE_INITIAL_LABELS:
|
||||
os << "KMEANS_PP_CENTERS | KMEANS_USE_INITIAL_LABELS";
|
||||
break;
|
||||
default: GAPI_Assert(false && "unknown KmeansFlags value");
|
||||
default: GAPI_Error("unknown KmeansFlags value");
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ inline cv::GComputation runOCVnGAPIBuildOptFlowPyramid(TestFunctional&,
|
||||
BuildOpticalFlowPyramidTestOutput&,
|
||||
BuildOpticalFlowPyramidTestOutput&)
|
||||
{
|
||||
GAPI_Assert(0 && "This function shouldn't be called without opencv_video");
|
||||
GAPI_Error("This function shouldn't be called without opencv_video");
|
||||
}
|
||||
|
||||
inline cv::GComputation runOCVnGAPIOptFlowLK(TestFunctional&,
|
||||
@@ -444,7 +444,7 @@ inline cv::GComputation runOCVnGAPIOptFlowLK(TestFunctional&,
|
||||
OptFlowLKTestOutput&,
|
||||
OptFlowLKTestOutput&)
|
||||
{
|
||||
GAPI_Assert(0 && "This function shouldn't be called without opencv_video");
|
||||
GAPI_Error("This function shouldn't be called without opencv_video");
|
||||
}
|
||||
|
||||
inline cv::GComputation runOCVnGAPIOptFlowLKForPyr(TestFunctional&,
|
||||
@@ -454,7 +454,7 @@ inline cv::GComputation runOCVnGAPIOptFlowLKForPyr(TestFunctional&,
|
||||
OptFlowLKTestOutput&,
|
||||
OptFlowLKTestOutput&)
|
||||
{
|
||||
GAPI_Assert(0 && "This function shouldn't be called without opencv_video");
|
||||
GAPI_Error("This function shouldn't be called without opencv_video");
|
||||
}
|
||||
|
||||
inline GComputation runOCVnGAPIOptFlowPipeline(TestFunctional&,
|
||||
@@ -463,7 +463,7 @@ inline GComputation runOCVnGAPIOptFlowPipeline(TestFunctional&,
|
||||
OptFlowLKTestOutput&,
|
||||
std::vector<Point2f>&)
|
||||
{
|
||||
GAPI_Assert(0 && "This function shouldn't be called without opencv_video");
|
||||
GAPI_Error("This function shouldn't be called without opencv_video");
|
||||
}
|
||||
|
||||
#endif // HAVE_OPENCV_VIDEO
|
||||
@@ -481,7 +481,7 @@ inline std::ostream& operator<<(std::ostream& os, const BackgroundSubtractorType
|
||||
{
|
||||
CASE(TYPE_BS_MOG2);
|
||||
CASE(TYPE_BS_KNN);
|
||||
default: GAPI_Assert(false && "unknown BackgroundSubtractor type");
|
||||
default: GAPI_Error("unknown BackgroundSubtractor type");
|
||||
}
|
||||
#undef CASE
|
||||
return os;
|
||||
|
||||
Reference in New Issue
Block a user