From cf16e7124437e49ddddc3b52f27029ba4fc038d8 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 7 Sep 2023 23:44:31 +0200 Subject: [PATCH] Fix cmake, stringop-overflow false positives are not specific to MINGW --- client/CMakeLists.txt | 22 +++++++++++----------- client/experimental_lib/CMakeLists.txt | 22 +++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 5090dab63..eaee2f0f0 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -656,21 +656,21 @@ if (MINGW) set(CMAKE_C_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_CXX_FLAGS}") - # GCC 10 has issues with false positives on stringop-overflow, - # let's disable them for now (cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335) - # beware these flags didn't exist for GCC < 7 - if(CMAKE_COMPILER_IS_GNUCXX) - execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) - if (GCC_VERSION VERSION_GREATER 10.0 OR GCC_VERSION VERSION_EQUAL 10.0) - set(CMAKE_C_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_CXX_FLAGS}") - endif() - endif(CMAKE_COMPILER_IS_GNUCXX) - # link Winsock2 set(ADDITIONAL_LNK ws2_32 ${ADDITIONAL_LNK}) endif (MINGW) +# GCC 10 has issues with false positives on stringop-overflow, +# let's disable them for now (cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335) +# beware these flags didn't exist for GCC < 7 +if(CMAKE_COMPILER_IS_GNUCXX) + execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) + if (GCC_VERSION VERSION_GREATER 10.0 OR GCC_VERSION VERSION_EQUAL 10.0) + set(CMAKE_C_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_CXX_FLAGS}") + endif() +endif(CMAKE_COMPILER_IS_GNUCXX) + target_include_directories(proxmark3 PRIVATE ${PM3_ROOT}/common ${PM3_ROOT}/common_fpga diff --git a/client/experimental_lib/CMakeLists.txt b/client/experimental_lib/CMakeLists.txt index f08ccdd6c..a5caeb014 100644 --- a/client/experimental_lib/CMakeLists.txt +++ b/client/experimental_lib/CMakeLists.txt @@ -656,19 +656,19 @@ if (MINGW) set(CMAKE_C_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_C_FLAGS}") set(CMAKE_CXX_FLAGS "-mno-ms-bitfields -fexec-charset=cp850 ${CMAKE_CXX_FLAGS}") - # GCC 10 has issues with false positives on stringop-overflow, - # let's disable them for now (cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335) - # beware these flags didn't exist for GCC < 7 - if(CMAKE_COMPILER_IS_GNUCXX) - execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) - if (GCC_VERSION VERSION_GREATER 10.0 OR GCC_VERSION VERSION_EQUAL 10.0) - set(CMAKE_C_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_C_FLAGS}") - set(CMAKE_CXX_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_CXX_FLAGS}") - endif() - endif(CMAKE_COMPILER_IS_GNUCXX) - endif (MINGW) +# GCC 10 has issues with false positives on stringop-overflow, +# let's disable them for now (cf https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92955, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94335) +# beware these flags didn't exist for GCC < 7 +if(CMAKE_COMPILER_IS_GNUCXX) + execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) + if (GCC_VERSION VERSION_GREATER 10.0 OR GCC_VERSION VERSION_EQUAL 10.0) + set(CMAKE_C_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_C_FLAGS}") + set(CMAKE_CXX_FLAGS "-Wno-stringop-overflow -Wno-error=stringop-overflow ${CMAKE_CXX_FLAGS}") + endif() +endif(CMAKE_COMPILER_IS_GNUCXX) + target_include_directories(pm3rrg_rdv4 PRIVATE ${PM3_ROOT}/common ${PM3_ROOT}/common_fpga