Commit 5a5ab3e8806c2b2a5006d53b75e79b6c90fe810e

Ran Benita 2023-05-06T17:14:04

utils: fix printf format warnings on mingw See: https://github.com/mesonbuild/wrapdb/pull/819 https://github.com/Exiv2/exiv2/blob/c86ae6acf597304db37246434ebc393d732c22c2/src/image_int.hpp#L15 https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/ Signed-off-by: Ran Benita <ran@unusedvar.com>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/utils.h b/src/utils.h
index eec7f10..aacb4a2 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -269,7 +269,9 @@ check_eaccess(const char *path, int mode)
 # define XKB_EXPORT
 #endif
 
-#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
+#if defined(__MINGW32__)
+# define ATTR_PRINTF(x,y) __attribute__((__format__(__MINGW_PRINTF_FORMAT, x, y)))
+#elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 203)
 # define ATTR_PRINTF(x,y) __attribute__((__format__(__printf__, x, y)))
 #else /* not gcc >= 2.3 */
 # define ATTR_PRINTF(x,y)