]> 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>
Sun, 27 Feb 2022 17:05:56 +0000 (17:05 +0000)
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>
cmake/config.h.cmake
configure.ac

index 34592372d80e8ba7f51855948230e64a17d4077f..4215a9036ed0e5c460cfc435844a51993667571a 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@
 
 /*
 #cmakedefine01 HAVE_DECL_ENVIRON
 #cmakedefine01 HAVE_DECL_LOG_PERROR
 #cmakedefine01 HAVE_DECL_MSG_NOSIGNAL
+
 #endif  // _DBUS_CONFIG_H
index 78f715b502ad2f706c1176c7c8fac8bb979db7ec..eb2314f2daebb08410473d6cc8e3b00fae993541 100644 (file)
@@ -1694,6 +1694,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])],