Silence implicit fallthrough warning for gcc > 7

In my system I have gcc 7.1.1 and there I get a lot of warnings which
fail the build due to implicit fallthroughs in switch statements.

Some examples can be seen here:
https://gist.github.com/LefterisJP/388c3ba5ad356f92a3b44e7efed89f9f

This PR proposes a simple solution, which is to ignore the warning for
both gcc and clang.
This commit is contained in:
Lefteris Karapetsas 2017-06-29 16:46:55 +02:00 committed by chriseth
parent f5372cda5d
commit 735c977db1

View File

@ -65,7 +65,7 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
# Build everything as shared libraries (.so files)
add_definitions(-DSHAREDLIB)
# If supported for the target machine, emit position-independent code, suitable for dynamic
# linking and avoiding any limit on the size of the global offset table.
add_compile_options(-fPIC)
@ -94,6 +94,12 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
add_compile_options(-fstack-protector)
endif()
# Until https://github.com/ethereum/solidity/issues/2479 is handled
# disable all implicit fallthrough warnings in the codebase for GCC > 7.0
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
add_compile_options(-Wno-implicit-fallthrough)
endif()
# Additional Clang-specific compiler settings.
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")