]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
build: Opt out from using mingw-w64's replacement printf(), etc.
authorSimon McVittie <smcv@collabora.com>
Fri, 25 Feb 2022 16:06:59 +0000 (16:06 +0000)
committerSimon McVittie <smcv@collabora.com>
Mon, 19 Sep 2022 09:52:38 +0000 (10:52 +0100)
The Windows code in dbus is careful to use Windows-specific equivalents
of the Standard C features that are not implemented by msvcrt.dll, so
we don't need to substitute a Standard C printf implementation.

This avoids compiler warnings/errors when gcc expects us to be using
Microsoft printf syntax (`ms_printf` attribute), but newer versions of
mingw-w64 expect us to be using GNU or Standard C printf syntax
(`gnu_printf` attribute) as a result of `__USE_MINGW_ANSI_STDIO` being
enabled by default if not otherwise specified.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/380
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit daf362ee61170727be0ca5dec1cf39435485ad0c)

cmake/config.h.cmake
configure.ac

index 11191821633267200e8c9c0c390797e21da259e8..2fa2c0403708a0c11ab44785e25171e09d36c322 100644 (file)
@@ -6,6 +6,14 @@
 /* indicate that we are building with cmake */
 #define DBUS_CMAKE 1
 
+/* On Windows, we expect to be using msvcrt.dll-compatible printf
+ * (%I64u instead of %llu) unless otherwise specified. This must be
+ * done near the beginning of config.h, before we have included any
+ * system headers that might check the value of this macro. */
+#ifndef __USE_MINGW_ANSI_STDIO
+#   define __USE_MINGW_ANSI_STDIO 0
+#endif
+
 @AUTOPACKAGE_CONFIG_H_TEMPLATE@
 
 /*
index 3e5a64d84da69393785f4f7eb57bedc11ae4794d..b0acbde2e0b55963f481a5b98444fad73d425d41 100644 (file)
@@ -1726,6 +1726,15 @@ AH_VERBATIM(_DARWIN_ENVIRON,
 #endif
 ])
 
+AH_VERBATIM([USE_MINGW_ANSI_STDIO],
+[
+/* On Windows, we expect to be using msvcrt.dll-compatible printf
+ * (%I64u instead of %llu) unless otherwise specified */
+#ifndef __USE_MINGW_ANSI_STDIO
+#   define __USE_MINGW_ANSI_STDIO 0
+#endif
+])
+
 AC_ARG_ENABLE([stats],
   [AS_HELP_STRING([--disable-stats],
     [disable bus daemon usage statistics])],