Skip to content

Commit

Permalink
Only pass -Wformat-signedness to versions of GCC that support it.
Browse files Browse the repository at this point in the history
Fixes #3478

Signed-off-by: okhowang(王沛文) <[email protected]>
  • Loading branch information
okhowang committed Jul 3, 2020
1 parent 527b878 commit 0cd8e0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions ChangeLog.d/format-signedness.txt
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 0cd8e0f

Please sign in to comment.