From 0cd8e0f6a70fd17a3565ce41620355244a8f7344 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?okhowang=28=E7=8E=8B=E6=B2=9B=E6=96=87=29?= Date: Fri, 3 Jul 2020 11:41:38 +0800 Subject: [PATCH] Only pass -Wformat-signedness to versions of GCC that support it. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #3478 Signed-off-by: okhowang(王沛文) --- CMakeLists.txt | 5 ++++- ChangeLog.d/format-signedness.txt | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 ChangeLog.d/format-signedness.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index f7e2ed08b..f8df14007 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,7 +165,10 @@ if(CMAKE_COMPILER_IS_GNU) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wlogical-op") endif() if (GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow -Wformat-signedness") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow") + endif() + if (GCC_VERSION VERSION_GREATER 5.0) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wformat-signedness") endif() set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-O0 -g3") diff --git a/ChangeLog.d/format-signedness.txt b/ChangeLog.d/format-signedness.txt new file mode 100644 index 000000000..ee1ee4bb3 --- /dev/null +++ b/ChangeLog.d/format-signedness.txt @@ -0,0 +1,3 @@ +Changes + * Only pass -Wformat-signedness to versions of GCC that support it. Reported + in #3478 and fix contributed in #3479 by okhowang.