[Lldb-commits] fixing build warnings on Linux

Kopec, Matt matt.kopec at intel.com
Thu Nov 29 12:23:29 PST 2012


Yes, these do exist. Initially, I will replace the warning cases. Thanks :)
________________________________________
From: Greg Clayton [gclayton at apple.com]
Sent: Wednesday, November 28, 2012 4:32 PM
To: Kopec, Matt
Cc: lldb-commits at cs.uiuc.edu
Subject: Re: [Lldb-commits] fixing build warnings on Linux

On Nov 28, 2012, at 12:58 PM, "Kopec, Matt" <matt.kopec at intel.com> wrote:

> Hi all,
>
> On Linux, there are hundreds of build warnings and I've taken steps to resolve them. Our goal is to be able to build trunk with -Werror.  Some warnings appear so often a patch would be painful to review. For these cases, I'll start with a category of warnings and a general solution on how to resolve for all instances.
>
> Printf format placeholder warnings:
>
> /home/mkopec1/dev/llvm/tools/lldb/source/API/SBBreakpoint.cpp:482:97: warning: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]
>        log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %llu", m_opaque_sp.get(), (uint64_t)num_resolved);
>                                                                                                                         ~~~                                     ^~~~~~~~~~~~~~~
>                                                                                                                          %lu
>
> On Mac OS X, uint64_t is unsigned long long but on Linux (and FreeBSD) may be unsigned long or unsigned long long. Using the macros in inttypes.h will use the correct format placeholder.
>
>
> -         log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %llu", m_opaque_sp.get(), (uint64_t)num_resolved);
> +        log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %" PRIu64, m_opaque_sp.get(), (uint64_t)num_resolved);
>
> Does this seem reasonable?

Yes, as long asthere are PRI macros for all formats ('i', 'u', 'x', 'o', etc).






More information about the lldb-commits mailing list