Commit ef254877 authored by Alexander Alekhin's avatar Alexander Alekhin

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

parent 6b581c4e
...@@ -120,7 +120,9 @@ if(CV_GCC OR CV_CLANG) ...@@ -120,7 +120,9 @@ if(CV_GCC OR CV_CLANG)
add_extra_compiler_option(-Wno-unnamed-type-template-args) add_extra_compiler_option(-Wno-unnamed-type-template-args)
add_extra_compiler_option(-Wno-comment) add_extra_compiler_option(-Wno-comment)
if(NOT OPENCV_SKIP_IMPLICIT_FALLTHROUGH 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) add_extra_compiler_option(-Wimplicit-fallthrough=3)
endif() endif()
if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.2.0) if(CV_GCC AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7.2.0)
......
...@@ -65,7 +65,7 @@ using namespace std; ...@@ -65,7 +65,7 @@ using namespace std;
#if defined(__clang__) #if defined(__clang__)
#pragma clang diagnostic ignored "-Wimplicit-fallthrough" #pragma clang diagnostic ignored "-Wimplicit-fallthrough"
#endif #endif
#if defined(__GNUC__) #if defined(__GNUC__) && __GNUC__ >= 7
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment