Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Orgad Shaneh via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Orgad Shaneh <orgads@gmail.com>
Subject: [PATCH] Fix using gnu print on mingw
Date: Mon, 25 Oct 2021 07:52:44 +0000	[thread overview]
Message-ID: <20211025075244.1527116-1-orgads@gmail.com> (raw)

---
 bfd/bfd-in.h                | 2 +-
 bfd/bfd-in2.h               | 2 +-
 gdbsupport/format.h         | 6 +++++-
 gnulib/import/inttypes.in.h | 8 ++++----
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 286afc607a3..6bb9622a514 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -131,7 +131,7 @@ typedef BFD_HOST_U_64_BIT symvalue;
 
 #if BFD_HOST_64BIT_LONG
 #define BFD_VMA_FMT "l"
-#elif defined (__MSVCRT__)
+#elif defined(__MSVCRT__) && !defined( __USE_MINGW_ANSI_STDIO)
 #define BFD_VMA_FMT "I64"
 #else
 #define BFD_VMA_FMT "ll"
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 669f250d0e5..dd74c4c8eb3 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -138,7 +138,7 @@ typedef BFD_HOST_U_64_BIT symvalue;
 
 #if BFD_HOST_64BIT_LONG
 #define BFD_VMA_FMT "l"
-#elif defined (__MSVCRT__)
+#elif defined (__MSVCRT__) && !defined(__USE_MINGW_ANSI_STDIO)
 #define BFD_VMA_FMT "I64"
 #else
 #define BFD_VMA_FMT "ll"
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.25.1


             reply	other threads:[~2021-10-25  7:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25  7:52 Orgad Shaneh via Gdb-patches [this message]
2021-10-25 15:04 ` Christian Biesinger via Gdb-patches
2021-10-25 15:14   ` Orgad Shaneh via Gdb-patches
2021-10-25 15:42 Orgad Shaneh via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211025075244.1527116-1-orgads@gmail.com \
    --to=gdb-patches@sourceware.org \
    --cc=orgads@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox