Commit 54a60ced5c456f46dcc2fcadbe286e94ab067861

Edward Thomson 2019-06-15T21:45:26

mingw: disable format specification warnings MinGW uses gcc, which expects POSIX formatting for printf, but uses the Windows C library, which uses its own format specifiers. Therefore, it gets confused about format specifiers. Disable warnings for format specifiers.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6e633f1..85c170e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -239,10 +239,18 @@ ELSE ()
 	ENABLE_WARNINGS(shift-count-overflow)
 	ENABLE_WARNINGS(unused-const-variable)
 	ENABLE_WARNINGS(unused-function)
-	ENABLE_WARNINGS(format)
-	ENABLE_WARNINGS(format-security)
 	ENABLE_WARNINGS(int-conversion)
-	DISABLE_WARNINGS(documentation-deprecated-sync)
+
+	# MinGW uses gcc, which expects POSIX formatting for printf, but
+	# uses the Windows C library, which uses its own format specifiers.
+	# Disable format specifier warnings.
+	IF(MINGW)
+		DISABLE_WARNINGS(format)
+		DISABLE_WARNINGS(format-security)
+	ELSE()
+		ENABLE_WARNINGS(format)
+		ENABLE_WARNINGS(format-security)
+	ENDIF()
 
 	IF (PROFILE)
 		SET(CMAKE_C_FLAGS "-pg ${CMAKE_C_FLAGS}")