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

Todd Fiala via lldb-dev lldb-dev at lists.llvm.org
Mon Dec 28 10:24:42 PST 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20151228/021bca5a/attachment.html>


More information about the lldb-dev mailing list