[Bf-blender-cvs] [bd09b51379e] master: Fix/workaround GCC bug about -Wno-implicit-fallthrough
Sergey Sharybin
noreply at git.blender.org
Mon May 22 11:10:36 CEST 2017
Commit: bd09b51379ee1281cf94f94d2ca58b9658bb49e3
Author: Sergey Sharybin
Date: Mon May 22 11:08:10 2017 +0200
Branches: master
https://developer.blender.org/rBbd09b51379ee1281cf94f94d2ca58b9658bb49e3
Fix/workaround GCC bug about -Wno-implicit-fallthrough
For some reason GCC-6 successfully compiles test program with
-Wno-implicit-fallthrough passed via command line. It just
silently ignores the unknown arguments which are starting with
-Wno-.
The issue is, if some other waning happens in the code, then
GCC will complain about unknown -Wno- argument which is not
supported by current GCC version.
This makes some misleading warning prints about unknown
command line argument when any other warning happens in code
from extern/.
===================================================================
M CMakeLists.txt
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2284146b3ab..5efe96df9e5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1389,7 +1389,10 @@ if(CMAKE_COMPILER_IS_GNUCC)
# flags to undo strict flags
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
+
+ if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
+ ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
+ endif()
if(NOT APPLE)
ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
More information about the Bf-blender-cvs
mailing list