[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/2] inttypes: force correct mingw PRIdMAX even without <stdio
From: |
Eric Blake |
Subject: |
[PATCH v2 2/2] inttypes: force correct mingw PRIdMAX even without <stdio.h> |
Date: |
Tue, 26 May 2015 15:30:36 -0600 |
The mingw trick of using __USE_MINGW_ANSI_STDIO only changes the
definitions in <inttypes.h> if <stdio.h> is also included. But
since we want to always use the __gnu_printf__ flavor when
available, we want to make sure that including <inttypes.h> in
isolation will give the desired "lld" answer.
Reported by Assaf Gordon.
* modules/inttypes (Depends-on): Require extensions, so that mingw
always uses GNU style inttypes.
* lib/inttypes.in.h: On mingw, include <stdio.h>.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 5 +++++
lib/inttypes.in.h | 4 ++++
modules/inttypes | 1 +
3 files changed, 10 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index a204cac..e96045b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-05-26 Eric Blake <address@hidden>
+ inttypes: force correct mingw PRIdMAX even without <stdio.h>
+ * modules/inttypes (Depends-on): Require extensions, so that mingw
+ always uses GNU style inttypes.
+ * lib/inttypes.in.h: On mingw, include <stdio.h>.
+
stdio: fix probe on mingw under gcc 5.1
* m4/stdio_h.m4 (gl_STDIO_H): Change to compile test, to work
around new gcc preprocessor rules.
diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h
index 13a72be..78846f6 100644
--- a/lib/inttypes.in.h
+++ b/lib/inttypes.in.h
@@ -51,6 +51,10 @@
#endif
/* Get CHAR_BIT. */
#include <limits.h>
+/* On mingw, __USE_MINGW_ANSI_STDIO only works if <stdio.h> is also included */
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# include <stdio.h>
+#endif
#if !(INT_MIN == INT32_MIN && INT_MAX == INT32_MAX)
# error "This file assumes that 'int' has exactly 32 bits. Please report your
platform and compiler to <address@hidden>."
diff --git a/modules/inttypes b/modules/inttypes
index 157b597..6d2b875 100644
--- a/modules/inttypes
+++ b/modules/inttypes
@@ -6,6 +6,7 @@ m4/inttypes-pri.m4
Depends-on:
inttypes-incomplete
+extensions
configure.ac:
gl_INTTYPES_H
--
2.1.0