From 82c4f87e0ed1701c1f51a46a3146643ed89b0bef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philippe=20Mathieu-Daud=C3=A9?= <f4bug@amsat.org> Date: Thu, 21 Jun 2018 14:12:47 -0300 Subject: [PATCH] trace: Fix format string for the struct timeval members casted to size_t MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes when using GCC with -Wformat-signedness: migration/trace.h: In function â_nocheck__trace_dirty_bitmap_load_successâ: migration/trace.h:6368:24: error: format â%zdâ expects argument of type âsigned size_tâ, but argument 3 has type âlong unsigned intâ [-Werror=format=] qemu_log("%d@%zd.%06zd:dirty_bitmap_load_success " "" "\n", ~~^ %ld migration/trace.h:6370:18: (size_t)_now.tv_sec, (size_t)_now.tv_usec ~~~~~~~~~~~~~~~~~~~ migration/trace.h:6368:30: error: format â%zdâ expects argument of type âsigned size_tâ, but argument 4 has type âlong unsigned intâ [-Werror=format=] qemu_log("%d@%zd.%06zd:dirty_bitmap_load_success " "" "\n", ~~~~^ %06ld migration/trace.h:6370:39: (size_t)_now.tv_sec, (size_t)_now.tv_usec ~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> --- scripts/tracetool/backend/log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tracetool/backend/log.py b/scripts/tracetool/backend/log.py index 78933d03ad..6751f41bc5 100644 --- a/scripts/tracetool/backend/log.py +++ b/scripts/tracetool/backend/log.py @@ -38,7 +38,7 @@ def generate_h(event, group): out(' if (%(cond)s && qemu_loglevel_mask(LOG_TRACE)) {', ' struct timeval _now;', ' gettimeofday(&_now, NULL);', - ' qemu_log("%%d@%%zd.%%06zd:%(name)s " %(fmt)s "\\n",', + ' qemu_log("%%d@%%zu.%%06zu:%(name)s " %(fmt)s "\\n",', ' getpid(),', ' (size_t)_now.tv_sec, (size_t)_now.tv_usec', ' %(argnames)s);', -- 2.30.2