[lldb-dev] Patch for addressing format warnings on 32-bit

Zachary Turner via lldb-dev lldb-dev at lists.llvm.org
Mon Jan 4 12:06:58 PST 2016


Incidentally, once we can start requiring VS 2015 %z will be supported
there.  Not sure if MSVC is the only supported platform that currently
doesn't support %z

On Mon, Jan 4, 2016 at 11:24 AM Greg Clayton via lldb-dev <
lldb-dev at lists.llvm.org> wrote:

> Please do cast to 64 bit and user PRI*64 macros. %z isn't supported on all
> platforms and we need to get away from using it.
>
> > On Dec 28, 2015, at 10:32 AM, William Dillon via lldb-dev <
> lldb-dev at lists.llvm.org> wrote:
> >
> > Hi Todd,
> >
> > The example I put in my last email is one of a few (maybe one more)
> instances where the existing code casts to 64-bit and uses PRIu64.  When
> I’m dabbling in existing code I try to copy the conventions that are
> already in place, so that’s why I went this way.  I’m happy to change it to
> %zu.  I was just checking about that.
> >
> > - Will
> >
> >> On Dec 28, 2015, at 10:24 AM, Todd Fiala <todd.fiala at gmail.com> wrote:
> >>
> >> Hi William,
> >>
> >> It looks like just the PRIx64/PRIu64 bits are needed from a visual
> inspection.  The source variables that are printed from already are 64-bit
> always, aren't they?  If they're not but they should be, that seems like
> the real underlying problem rather than needing to cast.
> >>
> >> What kind of warning are you seeing if you just replace the % format
> specifier?
> >>
> >> Thanks!
> >>
> >> -Todd
> >>
> >> On Sun, Dec 27, 2015 at 12:32 PM, William Dillon via lldb-dev <
> lldb-dev at lists.llvm.org> wrote:
> >> > Message: 1
> >> > Date: Sat, 26 Dec 2015 21:15:53 +0100
> >> > From: Joerg Sonnenberger via lldb-dev <lldb-dev at lists.llvm.org>
> >> > To: lldb-dev at lists.llvm.org
> >> > Subject: Re: [lldb-dev] Patch for addressing format warnings on 32-bit
> >> > Message-ID: <20151226201553.GB14119 at britannica.bec.de>
> >> > Content-Type: text/plain; charset=utf-8
> >> >
> >> > On Fri, Dec 25, 2015 at 06:34:09PM -0800, William Dillon via lldb-dev
> wrote:
> >> >> There are a handful of -Wformat warnings on 32-bit platforms.
> >> >> I addressed all those that I’ve seen while working on Swift.
> >> >> Let me know if the git diff format is inappropriate for this.
> >> >
> >> > Don't cast size_t to uint64_t, format it with %zu directly.
> >> >
> >> > Joerg
> >> >
> >>
> >> I can go ahead and do that, but I wonder whether there should be two
> different ways of handling this, even on the same line.  For example:
> >>
> >> -            error.SetErrorStringWithFormat ("SoftwareBreakpointr::%s
> addr=0x%" PRIx64 ": tried to read %lu bytes but only read %" PRIu64,
> __FUNCTION__, m_addr, m_opcode_size, (uint64_t)bytes_read);
> >> +            error.SetErrorStringWithFormat ("SoftwareBreakpointr::%s
> addr=0x%" PRIx64 ": tried to read %" PRIu64 " bytes but only read %"
> PRIu64, __FUNCTION__, m_addr, (uint64_t)m_opcode_size,
> (uint64_t)bytes_read);
> >>
> >> - Will
> >> _______________________________________________
> >> lldb-dev mailing list
> >> lldb-dev at lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
> >>
> >>
> >>
> >> --
> >> -Todd
> >
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20160104/9fee4912/attachment.html>


More information about the lldb-dev mailing list