Re: [PATCH] Fix using gnu print on mingw

Orgad Shaneh via Gdb-patches
2021-10-25T15:32:31Z

On Mon, Oct 25, 2021 at 6:05 PM Christian Biesinger <cbiesinger@google.com>
wrote:

> On Mon, Oct 25, 2021 at 3:53 AM Orgad Shaneh via Gdb-patches
> <gdb-patches@sourceware.org> wrote:
> >
> > ---
> > 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)
>
> Can you elaborate some more on what problem this is solving and why
> this is the right way to solve it?
>
> I'm just guessing but maybe you instead want to check
> defined(__MINGW32__) || defined(__MINGW64__)?
>
> Christian
>

MinGW (both 32 and 64) uses (and defines) MSVCRT by default, but it has 2
working modes. If __USE_MINGW_ANSI_STDIO is defined as 1 (this is the case
for C++11, or when _GNU_SOURCE is defined, or some other defines), then
modifiers like %ll ARE supported. If it is 0, then they're not.

Actually the conditions should be ! instead of !defined. I'll fix the patch.

- Orgad