build: -Wimplicit-fallthrough warning for GCC 7+ only

pull/11381/head
Alexander Alekhin 7 years ago
parent 6b581c4e51
commit ef2548778c
  1. 4
      cmake/OpenCVCompilerOptions.cmake
  2. 2
      modules/videoio/src/cap.cpp

@ -120,7 +120,9 @@ if(CV_GCC OR CV_CLANG)
add_extra_compiler_option(-Wno-unnamed-type-template-args)
add_extra_compiler_option(-Wno-comment)
if(NOT OPENCV_SKIP_IMPLICIT_FALLTHROUGH
AND NOT " ${CMAKE_CXX_FLAGS} ${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_CXX_FLAGS}" MATCHES "implicit-fallthrough")
AND NOT " ${CMAKE_CXX_FLAGS} ${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_CXX_FLAGS}" MATCHES "implicit-fallthrough"
AND (CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)
)
add_extra_compiler_option(-Wimplicit-fallthrough=3)
endif()
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.2.0)

@ -65,7 +65,7 @@ using namespace std;
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
#endif
#if defined(__GNUC__)
#if defined(__GNUC__) && __GNUC__ >= 7
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif

Loading…
Cancel
Save