On Fri, May 12, 2017 at 8:23 AM, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote: > > > On 12/05/2017 17:15, Radim Krčmář wrote: >> 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@xxxxxxxxxx> >> --- >> lib/report.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/lib/report.c b/lib/report.c >> index f7af596f1fc4..b002d2107e37 100644 >> --- a/lib/report.c >> +++ b/lib/report.c >> @@ -35,14 +35,14 @@ void report_prefix_pushf(const char *prefix_fmt, ...) >> spin_lock(&lock); >> >> len = strlen(prefixes); >> - assert_msg(len < sizeof(prefixes), "%d >= %lu", len, sizeof(prefixes)); >> + assert_msg(len < sizeof(prefixes), "%d >= %zu", len, sizeof(prefixes)); >> start = len; >> >> va_start(va, prefix_fmt); >> len += vsnprintf(&prefixes[len], sizeof(prefixes) - len, prefix_fmt, >> va); >> va_end(va); >> - assert_msg(len < sizeof(prefixes), "%d >= %lu", len, sizeof(prefixes)); >> + assert_msg(len < sizeof(prefixes), "%d >= %zu", len, sizeof(prefixes)); >> >> assert_msg(!strstr(&prefixes[start], PREFIX_DELIMITER), >> "Prefix \"%s\" contains delimiter \"" PREFIX_DELIMITER "\"", >> @@ -50,7 +50,7 @@ void report_prefix_pushf(const char *prefix_fmt, ...) >> >> len += snprintf(&prefixes[len], sizeof(prefixes) - len, >> PREFIX_DELIMITER); >> - assert_msg(len < sizeof(prefixes), "%d >= %lu", len, sizeof(prefixes)); >> + assert_msg(len < sizeof(prefixes), "%d >= %zu", len, sizeof(prefixes)); >> >> spin_unlock(&lock); >> } >> > > Reviewed-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> Reviewed-by: Peter Feiner <pfeiner@xxxxxxxxxx>