diff options
author | Allen Winter <allen.winter@kdab.com> | 2022-10-03 11:43:20 -0400 |
---|---|---|
committer | Allen Winter <allen.winter@kdab.com> | 2022-10-03 11:43:20 -0400 |
commit | 0fe0d9d4ef152243f47f9c8e17520d10a67ba2c6 (patch) | |
tree | 8a8b85e3090f5bc3a048fe7f9c261a6af9d61578 /CMakeLists.txt | |
parent | 8b681837b7345b720dd57e81bb3dbf726577422a (diff) | |
download | libical-git-0fe0d9d4ef152243f47f9c8e17520d10a67ba2c6.tar.gz |
add clang diagnostic pragmas to quiet unreachable-code warnings
fixes: #486
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f889f985..6ac0c7f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -510,6 +510,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang") check_c_compiler_flag(-Wsizeof-pointer-memaccess HAVE_GCC_POINTER_MEMACCESS) check_c_compiler_flag(-Wformat-security HAVE_GCC_FORMAT_SECURITY) check_c_compiler_flag(-Wredundant-decls HAVE_GCC_REDUNDANT_DECLS) + check_c_compiler_flag(-Wunreachable-code HAVE_GCC_UNREACHABLE_CODE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -Wno-deprecated -Wall -Wno-unknown-pragmas -Wextra -Winit-self -Wunused -Wno-div-by-zero -Wundef -Wpointer-arith -Wtype-limits -Wwrite-strings -Werror=return-type") if(HAVE_GCC_UNUSED_BUT_SET) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused-but-set-variable") @@ -526,6 +527,9 @@ if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang") if(HAVE_GCC_REDUNDANT_DECLS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wredundant-decls") endif() + if(HAVE_GCC_UNREACHABLE_CODE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunreachable-code") + endif() if(CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=500 -D_DEFAULT_SOURCE -D_GNU_SOURCE") endif() @@ -542,6 +546,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") check_cxx_compiler_flag(-Wreorder HAVE_GXX_REORDER) check_cxx_compiler_flag(-Wformat-security HAVE_GXX_FORMAT_SECURITY) check_cxx_compiler_flag(-Wredundant-decls HAVE_GXX_REDUNDANT_DECLS) + check_cxx_compiler_flag(-Wunreachable-code HAVE_GXX_UNREACHABLE_CODE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Weffc++ -Wno-deprecated -Wall -Wextra -Woverloaded-virtual -Winit-self -Wunused -Wno-div-by-zero -Wundef -Wpointer-arith -Wtype-limits -Wwrite-strings -Werror=return-type") if(HAVE_GXX_UNUSED_BUT_SET) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-but-set-variable") @@ -561,6 +566,9 @@ if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") if(HAVE_GXX_REDUNDANT_DECLS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wredundant-decls") endif() + if(HAVE_GXX_UNREACHABLE_CODE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunreachable-code") + endif() if(CMAKE_SYSTEM_NAME MATCHES Linux OR CMAKE_SYSTEM_NAME STREQUAL GNU) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_XOPEN_SOURCE=500 -D_DEFAULT_SOURCE -D_GNU_SOURCE") endif() |