summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-02-25 16:06:59 +0000
committerSimon McVittie <smcv@collabora.com>2022-02-27 17:05:56 +0000
commitdaf362ee61170727be0ca5dec1cf39435485ad0c (patch)
treebdf3957cff88c33aa5e77fafa6ad21917730ba5b /cmake
parent71f74ee53094340118918ba384ac7165045075cf (diff)
downloaddbus-daf362ee61170727be0ca5dec1cf39435485ad0c.tar.gz
build: Opt out from using mingw-w64's replacement printf(), etc.
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>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/config.h.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
index 34592372..4215a903 100644
--- a/cmake/config.h.cmake
+++ b/cmake/config.h.cmake
@@ -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@
/*
@@ -317,4 +325,5 @@
#cmakedefine01 HAVE_DECL_ENVIRON
#cmakedefine01 HAVE_DECL_LOG_PERROR
#cmakedefine01 HAVE_DECL_MSG_NOSIGNAL
+
#endif // _DBUS_CONFIG_H