From 9c62d820184b60748d002b4874b87e4b38d6a461 Mon Sep 17 00:00:00 2001
From: Orgad Shaneh <orgads@gmail.com>
Date: Thu, 13 Feb 2020 09:25:02 +0200
Subject: [PATCH 2/5] Fix using gnu print

---
 gdbsupport/format.h         | 6 +++++-
 gnulib/import/inttypes.in.h | 8 ++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/gdbsupport/format.h b/gdbsupport/format.h
index 921fca5e04d..75d12ae531a 100644
--- a/gdbsupport/format.h
+++ b/gdbsupport/format.h
@@ -23,7 +23,11 @@
 #include "gdbsupport/gdb_string_view.h"
 
 #if defined(__MINGW32__) && !defined(PRINTF_HAS_LONG_LONG)
-# define USE_PRINTF_I64 1
+# if !defined(__USE_MINGW_ANSI_STDIO)
+#  define USE_PRINTF_I64 1
+# else
+#  define USE_PRINTF_I64 0
+# endif
 # define PRINTF_HAS_LONG_LONG
 #else
 # define USE_PRINTF_I64 0
diff --git a/gnulib/import/inttypes.in.h b/gnulib/import/inttypes.in.h
index e9ee500e3e6..b1f1f7edd00 100644
--- a/gnulib/import/inttypes.in.h
+++ b/gnulib/import/inttypes.in.h
@@ -171,7 +171,7 @@
 #ifdef INT64_MAX
 # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
 #  define _PRI64_PREFIX "l"
-# elif defined _MSC_VER || defined __MINGW32__
+# elif (defined _MSC_VER || defined __MINGW32__) && !defined(__USE_MINGW_ANSI_STDIO)
 #  define _PRI64_PREFIX "I64"
 # elif LONG_MAX >> 30 == 1
 #  define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX
@@ -186,7 +186,7 @@
 #ifdef UINT64_MAX
 # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
 #  define _PRIu64_PREFIX "l"
-# elif defined _MSC_VER || defined __MINGW32__
+# elif (defined _MSC_VER || defined __MINGW32__) && !defined(__USE_MINGW_ANSI_STDIO)
 #  define _PRIu64_PREFIX "I64"
 # elif ULONG_MAX >> 31 == 1
 #  define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX
@@ -583,7 +583,7 @@
 #ifdef INT64_MAX
 # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
 #  define _SCN64_PREFIX "l"
-# elif defined _MSC_VER || defined __MINGW32__
+# elif (defined _MSC_VER || defined __MINGW32__) && !defined(__USE_MINGW_ANSI_STDIO)
 #  define _SCN64_PREFIX "I64"
 # elif LONG_MAX >> 30 == 1
 #  define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX
@@ -598,7 +598,7 @@
 #ifdef UINT64_MAX
 # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
 #  define _SCNu64_PREFIX "l"
-# elif defined _MSC_VER || defined __MINGW32__
+# elif (defined _MSC_VER || defined __MINGW32__) && !defined(__USE_MINGW_ANSI_STDIO)
 #  define _SCNu64_PREFIX "I64"
 # elif ULONG_MAX >> 31 == 1
 #  define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX
-- 
2.33.1.windows.1

