[Lldb-commits] fixing build warnings on Linux
Greg Clayton
gclayton at apple.com
Wed Nov 28 13:32:42 PST 2012
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