Skip to content

carotene: possible fall through #15226

@tomoaki0705

Description

@tomoaki0705
System information (version)
  • OpenCV => recent 3.4( b584c23 ) /master( f9cefc8 )
  • Operating System / Platform => Ubuntu 18.04 Aarch64
  • Compiler => GCC 7.4.0
Detailed description

Warning was raised and I think it's worth fixing it

[ 33%] Building CXX object modules/imgproc/CMakeFiles/opencv_imgproc.dir/src/filter.dispatch.cpp.o
In file included from /home/odroid/opencv-fork/build/custom_hal.hpp:5:0,
                 from /home/odroid/opencv-fork/modules/imgproc/src/hal_replacement.hpp:783,
                 from /home/odroid/opencv-fork/modules/imgproc/src/precomp.hpp:54,
                 from /home/odroid/opencv-fork/modules/imgproc/src/filter.dispatch.cpp:43:
/home/odroid/opencv-fork/build/carotene/tegra_hal.hpp: In function ‘int TEGRA_FILTERINIT(cvhalFilter2D**, uchar*, size_t, int, int, int, int, int, int, int, int, double, int, int, bool, bool)’:
/home/odroid/opencv-fork/build/carotene/tegra_hal.hpp:1129:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
         }
         ^
/home/odroid/opencv-fork/build/carotene/tegra_hal.hpp:1130:5: note: here
     default:
     ^~~~~~~
/home/odroid/opencv-fork/build/carotene/tegra_hal.hpp: In function ‘int TEGRA_SEPFILTERINIT(cvhalFilter2D**, int, int, int, uchar*, int, uchar*, int, int, int, double, int)’:
/home/odroid/opencv-fork/build/carotene/tegra_hal.hpp:1245:29: warning: this statement may fall through [-Wimplicit-fallthrough=]
         ctx->kernely_data[2]=((int16_t*)kernely_data)[2];
         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/odroid/opencv-fork/build/carotene/tegra_hal.hpp:1246:5: note: here
     default:
     ^~~~~~~

The code is here and here

case CV_16UC1:
for(int j = 0; j < kernel_height; ++j)
{
std::memcpy(ctx->kernel_data + kernel_width * j, kernel_data + kernel_step * j, kernel_width * sizeof(int16_t));
}
default:

case CV_16UC1:
ctx->kernelx_data[0]=((int16_t*)kernelx_data)[0];
ctx->kernelx_data[1]=((int16_t*)kernelx_data)[1];
ctx->kernelx_data[2]=((int16_t*)kernelx_data)[2];
ctx->kernely_data[0]=((int16_t*)kernely_data)[0];
ctx->kernely_data[1]=((int16_t*)kernely_data)[1];
ctx->kernely_data[2]=((int16_t*)kernely_data)[2];
default:

The code is untouched for long time, so it doesn't make big difference, but reading carefully before and after the spotted line, I guess break is missing

Steps to reproduce

Build with GCC 7.4.0 on Aarch64

I'll send a patch later

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions