mirror of
https://github.com/opencv/opencv.git
synced 2026-09-25 04:09:57 +03:00
Merge pull request #30052 from vrabaud:fallthrough
Enable -Wimplicit-fallthrough
This commit is contained in:
@@ -522,6 +522,7 @@ macro(ocv_add_modules_compiler_options)
|
||||
if(${_varname_cxx})
|
||||
add_compile_options(-Wcast-function-type-strict)
|
||||
endif()
|
||||
add_compile_options(-Wimplicit-fallthrough)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
@@ -185,9 +185,9 @@ size_t base64::base64_encode(const uint8_t *src, uint8_t *dst, size_t off, size_
|
||||
switch (rst)
|
||||
{
|
||||
case 1U: *dst_cur++ = base64_padding;
|
||||
/* fallthrough */
|
||||
[[fallthrough]];
|
||||
case 2U: *dst_cur++ = base64_padding;
|
||||
/* fallthrough */
|
||||
[[fallthrough]];
|
||||
default: *dst_cur = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1064,7 +1064,7 @@ static float32_t f32_roundToInt( float32_t a, uint_fast8_t roundingMode, bool ex
|
||||
switch ( roundingMode ) {
|
||||
case round_near_even:
|
||||
if ( ! fracF32UI( uiA ) ) break;
|
||||
/* fallthrough */
|
||||
[[fallthrough]];
|
||||
case round_near_maxMag:
|
||||
if ( exp == 0x7E ) uiZ |= packToF32UI( 0, 0x7F, 0 );
|
||||
break;
|
||||
@@ -1772,7 +1772,7 @@ static float64_t f64_roundToInt( float64_t a, uint_fast8_t roundingMode, bool ex
|
||||
switch ( roundingMode ) {
|
||||
case round_near_even:
|
||||
if ( ! fracF64UI( uiA ) ) break;
|
||||
/* fallthrough */
|
||||
[[fallthrough]];
|
||||
case round_near_maxMag:
|
||||
if ( exp == 0x3FE ) uiZ |= packToF64UI( 0, 0x3FF, 0 );
|
||||
break;
|
||||
|
||||
@@ -2003,11 +2003,11 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da
|
||||
break;
|
||||
#endif //GTK_VERSION3_4
|
||||
case GDK_SCROLL_LEFT: cv_event = cv::EVENT_MOUSEHWHEEL;
|
||||
/* FALLTHRU */
|
||||
[[fallthrough]];
|
||||
case GDK_SCROLL_UP: flags |= ~0xffff;
|
||||
break;
|
||||
case GDK_SCROLL_RIGHT: cv_event = cv::EVENT_MOUSEHWHEEL;
|
||||
/* FALLTHRU */
|
||||
[[fallthrough]];
|
||||
case GDK_SCROLL_DOWN: flags |= (((int)1 << 16));
|
||||
break;
|
||||
default: ;
|
||||
|
||||
@@ -615,10 +615,10 @@ bool Jpeg2KOpjDecoderBase::readData( Mat& img )
|
||||
switch (image_->color_space)
|
||||
{
|
||||
case OPJ_CLRSPC_UNKNOWN:
|
||||
/* FALLTHRU */
|
||||
[[fallthrough]];
|
||||
case OPJ_CLRSPC_UNSPECIFIED:
|
||||
CV_LOG_WARNING(NULL, "OpenJPEG2000: Image has unknown or unspecified color space, SRGB is assumed");
|
||||
/* FALLTHRU */
|
||||
[[fallthrough]];
|
||||
case OPJ_CLRSPC_SRGB:
|
||||
decode = decodeSRGBData;
|
||||
break;
|
||||
|
||||
@@ -478,7 +478,7 @@ static void fixOrientationPartial(Mat &img, uint16_t orientation)
|
||||
case ORIENTATION_RIGHTTOP:
|
||||
case ORIENTATION_LEFTBOT:
|
||||
flip(img, img, -1);
|
||||
/* fall through */
|
||||
[[fallthrough]];
|
||||
|
||||
case ORIENTATION_LEFTTOP:
|
||||
case ORIENTATION_RIGHTBOT:
|
||||
@@ -1473,7 +1473,7 @@ bool TiffEncoder::writeLibTiff( const std::vector<Mat>& img_vec, const std::vect
|
||||
{
|
||||
case CV_8U:
|
||||
sample_format = SAMPLEFORMAT_UINT;
|
||||
/* FALLTHRU */
|
||||
[[fallthrough]];
|
||||
case CV_8S:
|
||||
{
|
||||
bitsPerChannel = 8;
|
||||
@@ -1482,7 +1482,7 @@ bool TiffEncoder::writeLibTiff( const std::vector<Mat>& img_vec, const std::vect
|
||||
|
||||
case CV_16U:
|
||||
sample_format = SAMPLEFORMAT_UINT;
|
||||
/* FALLTHRU */
|
||||
[[fallthrough]];
|
||||
case CV_16S:
|
||||
{
|
||||
bitsPerChannel = 16;
|
||||
|
||||
@@ -1776,7 +1776,7 @@ void cv::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn)
|
||||
case COLOR_BayerBG2BGRA: case COLOR_BayerGB2BGRA: case COLOR_BayerRG2BGRA: case COLOR_BayerGR2BGRA:
|
||||
if (dcn <= 0)
|
||||
dcn = 4;
|
||||
/* fallthrough */
|
||||
[[fallthrough]];
|
||||
case COLOR_BayerBG2BGR: case COLOR_BayerGB2BGR: case COLOR_BayerRG2BGR: case COLOR_BayerGR2BGR:
|
||||
case COLOR_BayerBG2BGR_VNG: case COLOR_BayerGB2BGR_VNG: case COLOR_BayerRG2BGR_VNG: case COLOR_BayerGR2BGR_VNG:
|
||||
{
|
||||
|
||||
@@ -103,7 +103,7 @@ PARAM_TEST_CASE(CvtColor, MatDepth, bool)
|
||||
{
|
||||
case COLOR_RGB2HLS: case COLOR_BGR2HLS:
|
||||
h_limit = 180;
|
||||
/* fallthrough */
|
||||
[[fallthrough]];
|
||||
case COLOR_RGB2HLS_FULL: case COLOR_BGR2HLS_FULL:
|
||||
{
|
||||
ASSERT_EQ(dst_roi.type(), udst_roi.type());
|
||||
|
||||
@@ -3048,7 +3048,7 @@ std::vector<cv::Point2f> Chessboard::Board::getContour()const
|
||||
last = 1;
|
||||
break;
|
||||
}
|
||||
/* fallthrough */
|
||||
[[fallthrough]];
|
||||
case 2: // right
|
||||
if(iter.right(true))
|
||||
{
|
||||
@@ -3058,7 +3058,7 @@ std::vector<cv::Point2f> Chessboard::Board::getContour()const
|
||||
last = 2;
|
||||
break;
|
||||
}
|
||||
/* fallthrough */
|
||||
[[fallthrough]];
|
||||
case 3: // bottom
|
||||
if(iter.bottom(true))
|
||||
{
|
||||
@@ -3068,7 +3068,7 @@ std::vector<cv::Point2f> Chessboard::Board::getContour()const
|
||||
last = 3;
|
||||
break;
|
||||
}
|
||||
/* fallthrough */
|
||||
[[fallthrough]];
|
||||
case 4: // left
|
||||
if(iter.left(true))
|
||||
{
|
||||
|
||||
@@ -149,7 +149,7 @@ void CV_ChessboardDetectorTest::run( int /*start_from */)
|
||||
{
|
||||
case CHESSBOARD_SB:
|
||||
checkByGeneratorHighAccuracy(); // not supported by CHESSBOARD
|
||||
/* fallthrough */
|
||||
[[fallthrough]];
|
||||
case CHESSBOARD_PLAIN:
|
||||
checkByGenerator();
|
||||
if (ts->get_err_code() != cvtest::TS::OK)
|
||||
|
||||
@@ -1769,6 +1769,7 @@ bool CvCaptureCAM_V4L::controlInfo(int property_id, __u32 &_v4l2id, cv::Range &r
|
||||
break;
|
||||
case CAP_PROP_AUTO_EXPOSURE:
|
||||
range = Range(0, 4);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -218,6 +218,7 @@ int main(int argc, const char ** argv)
|
||||
break;
|
||||
case 'c':
|
||||
cv::ocl::setUseOpenCL(!cv::ocl::useOpenCL());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user