From: "Radim Krčmář" <rkrcmar@redhat.com>
To: kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, Peter Feiner <pfeiner@google.com>
Subject: Re: [kvm-unit-tests PATCH] lib: use %zu conversion for sizeof to fix i386 build
Date: Fri, 12 May 2017 17:28:47 +0200 [thread overview]
Message-ID: <20170512152846.GC13216@potion> (raw)
In-Reply-To: <20170512151545.13507-1-rkrcmar@redhat.com>
2017-05-12 17:15+0200, Radim Krčmář:
> Fixes this GCC error:
>
> In file included from lib/report.c:13:0:
> lib/libcflat.h:134:10: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘unsigned int’ [-Werror=format=]
> printf("%s:%d: assert failed: %s: " fmt "\n", \
> ^
> lib/report.c:53:2: note: in expansion of macro ‘assert_msg’
> assert_msg(len < sizeof(prefixes), "%d >= %lu", len, sizeof(prefixes));
> ^~~~~~~~~~
> lib/report.c:53:46: note: format string is defined here
> assert_msg(len < sizeof(prefixes), "%d >= %lu", len, sizeof(prefixes));
> ~~^
> %u
>
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
Ugh, and I didn't test it ... libcflat doesn't support %z.
Casting the sizeof result to unsigned would work, but I don't like it
one bit. Is there a convention in naming the conversion? (like PRI...)
Thanks.
next prev parent reply other threads:[~2017-05-12 15:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-12 15:15 [kvm-unit-tests PATCH] lib: use %zu conversion for sizeof to fix i386 build Radim Krčmář
2017-05-12 15:23 ` Paolo Bonzini
2017-05-12 16:00 ` Peter Feiner
2017-05-12 15:28 ` Radim Krčmář [this message]
2017-05-12 15:43 ` Paolo Bonzini
2017-05-12 15:57 ` Radim Krčmář
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=20170512152846.GC13216@potion \
--to=rkrcmar@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=pfeiner@google.com \
/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