From 735c977db1824436d09d8e7a5c120fcab21003c3 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 29 Jun 2017 16:46:55 +0200 Subject: 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. --- cmake/EthCompilerSettings.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cmake') diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 97db9168..ea3b185a 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -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") -- cgit v1.2.3