Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org>
To: Christian Biesinger <cbiesinger@google.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH/committed] sim: rx: cast bfd_vma when printing
Date: Mon, 3 May 2021 20:47:09 -0400	[thread overview]
Message-ID: <YJCZjVeLJajWd7AJ@vapier> (raw)
In-Reply-To: <CAPTJ0XEoe+MOrKnE6gkMoy-bS3TDX6HU5P05E6kwnF2wM0hsvA@mail.gmail.com>

On 03 May 2021 16:47, Christian Biesinger via Gdb-patches wrote:
> On Mon, May 3, 2021 at 3:57 PM Mike Frysinger wrote:
> > On 03 May 2021 11:20, Christian Biesinger wrote:
> > > On Sat, May 1, 2021, 15:29 Mike Frysinger wrote:
> > > > A bit of a hack, but it's what we've been doing so far when printing
> > > > bfd_vma's since bfd doesn't provide PRI helper types for us to use.
> > > >
> > > > --- a/sim/rx/load.c
> > > > +++ b/sim/rx/load.c
> > > > @@ -151,7 +151,7 @@ rx_load (bfd *prog, host_callback *callback)
> > > >         }
> > > >        if (bfd_bread (buf, size, prog) != size)
> > > >         {
> > > > -         fprintf (stderr, "Failed to read %lx bytes\n", size);
> > > > +         fprintf (stderr, "Failed to read %lx bytes\n", (long) size);
> > >
> > > Wouldn't it be better to use "long long", especially for mingw?
> >
> > not sure why mingw is special here.  but let's ignore that.
> 
> mingw (and msvc) is special because sizeof(long) is 4, even on a 64-bit system.
> https://stackoverflow.com/questions/22344388/size-of-long-int-and-int-in-c-showing-4-bytes

we have ILP32 models on mips/n32 [2000], x86_64/x32 [2011], and aarch64 [2016],
so i don't think mingw does anything that unique anymore.

we've long known that long is inappropriate for things that could be 64-bit.
the trouble is when we half implement the suite like just coming up with a
typedef and skimping on printf formats :(.
-mike

  reply	other threads:[~2021-05-04  0:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-01 20:29 Mike Frysinger via Gdb-patches
2021-05-03 16:20 ` Christian Biesinger via Gdb-patches
2021-05-03 20:57   ` Mike Frysinger via Gdb-patches
2021-05-03 21:47     ` Christian Biesinger via Gdb-patches
2021-05-04  0:47       ` Mike Frysinger via Gdb-patches [this message]
2021-05-04  2:54         ` Mike Frysinger via Gdb-patches
2021-05-04 12:17           ` [PATCH/committed] sim: clean up bfd_vma printing Mike Frysinger 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=YJCZjVeLJajWd7AJ@vapier \
    --to=gdb-patches@sourceware.org \
    --cc=cbiesinger@google.com \
    --cc=vapier@gentoo.org \
    /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