qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] contrib/plugins: fix -Wformat issues


From: Paolo Bonzini
Subject: [PATCH] contrib/plugins: fix -Wformat issues
Date: Thu, 7 Sep 2023 12:34:02 +0200

On macOS, compiling contrib/plugins incurs several -Wformat
warnings; fix them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 contrib/plugins/cache.c    | 10 +++++-----
 contrib/plugins/drcov.c    |  2 +-
 contrib/plugins/howvec.c   |  4 ++--
 contrib/plugins/lockstep.c |  6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c
index 5036213f1b8..4be909848d7 100644
--- a/contrib/plugins/cache.c
+++ b/contrib/plugins/cache.c
@@ -545,7 +545,7 @@ static void append_stats_line(GString *line, uint64_t 
l1_daccess,
     l1_dmiss_rate = ((double) l1_dmisses) / (l1_daccess) * 100.0;
     l1_imiss_rate = ((double) l1_imisses) / (l1_iaccess) * 100.0;
 
-    g_string_append_printf(line, "%-14lu %-12lu %9.4lf%%  %-14lu %-12lu"
+    g_string_append_printf(line, "%-14" PRIu64 " %-12" PRIu64 " %9.4lf%%  
%-14" PRIu64 " %-12" PRIu64
                            " %9.4lf%%",
                            l1_daccess,
                            l1_dmisses,
@@ -556,7 +556,7 @@ static void append_stats_line(GString *line, uint64_t 
l1_daccess,
 
     if (use_l2) {
         l2_miss_rate =  ((double) l2_misses) / (l2_access) * 100.0;
-        g_string_append_printf(line, "  %-12lu %-11lu %10.4lf%%",
+        g_string_append_printf(line, "  %-12" PRIu64 " %-11" PRIu64 " 
%10.4lf%%",
                                l2_access,
                                l2_misses,
                                l2_access ? l2_miss_rate : 0.0);
@@ -662,7 +662,7 @@ static void log_top_insns(void)
         if (insn->symbol) {
             g_string_append_printf(rep, " (%s)", insn->symbol);
         }
-        g_string_append_printf(rep, ", %ld, %s\n", insn->l1_dmisses,
+        g_string_append_printf(rep, ", %" PRId64 ", %s\n", insn->l1_dmisses,
                                insn->disas_str);
     }
 
@@ -675,7 +675,7 @@ static void log_top_insns(void)
         if (insn->symbol) {
             g_string_append_printf(rep, " (%s)", insn->symbol);
         }
-        g_string_append_printf(rep, ", %ld, %s\n", insn->l1_imisses,
+        g_string_append_printf(rep, ", %" PRId64 ", %s\n", insn->l1_imisses,
                                insn->disas_str);
     }
 
@@ -692,7 +692,7 @@ static void log_top_insns(void)
         if (insn->symbol) {
             g_string_append_printf(rep, " (%s)", insn->symbol);
         }
-        g_string_append_printf(rep, ", %ld, %s\n", insn->l2_misses,
+        g_string_append_printf(rep, ", %" PRId64 ", %s\n", insn->l2_misses,
                                insn->disas_str);
     }
 
diff --git a/contrib/plugins/drcov.c b/contrib/plugins/drcov.c
index 686ae0a537d..5edc94dcaf6 100644
--- a/contrib/plugins/drcov.c
+++ b/contrib/plugins/drcov.c
@@ -48,7 +48,7 @@ static void printf_header(unsigned long count)
     uint64_t start_code = qemu_plugin_start_code();
     uint64_t end_code = qemu_plugin_end_code();
     uint64_t entry = qemu_plugin_entry_code();
-    fprintf(fp, "0, 0x%lx, 0x%lx, 0x%lx, %s\n",
+    fprintf(fp, "0, 0x%" PRIx64 ", 0x%" PRIx64 ", 0x%" PRIx64 ", %s\n",
             start_code, end_code, entry, path);
     fprintf(fp, "BB Table: %ld bbs\n", count);
 }
diff --git a/contrib/plugins/howvec.c b/contrib/plugins/howvec.c
index 0ed01ea931e..930d27bce7d 100644
--- a/contrib/plugins/howvec.c
+++ b/contrib/plugins/howvec.c
@@ -181,7 +181,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
         switch (class->what) {
         case COUNT_CLASS:
             if (class->count || verbose) {
-                g_string_append_printf(report, "Class: %-24s\t(%ld hits)\n",
+                g_string_append_printf(report, "Class: %-24s\t(%" PRId64 " 
hits)\n",
                                        class->class,
                                        class->count);
             }
@@ -208,7 +208,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
              i++, counts = g_list_next(counts)) {
             InsnExecCount *rec = (InsnExecCount *) counts->data;
             g_string_append_printf(report,
-                                   "Instr: %-24s\t(%ld 
hits)\t(op=0x%08x/%s)\n",
+                                   "Instr: %-24s\t(%" PRId64 " 
hits)\t(op=0x%08x/%s)\n",
                                    rec->insn,
                                    rec->count,
                                    rec->opcode,
diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c
index 3614c3564c2..bcd3d33535c 100644
--- a/contrib/plugins/lockstep.c
+++ b/contrib/plugins/lockstep.c
@@ -134,7 +134,7 @@ static void report_divergance(ExecState *us, ExecState 
*them)
 
     /* Output short log entry of going out of sync... */
     if (verbose || divrec.distance == 1 || diverged) {
-        g_string_printf(out, "@ 0x%016lx vs 0x%016lx (%d/%d since last)\n",
+        g_string_printf(out, "@ 0x%016" PRIx64 " vs 0x%016" PRIx64 " (%d/%d 
since last)\n",
                         us->pc, them->pc, g_slist_length(divergence_log),
                         divrec.distance);
         qemu_plugin_outs(out->str);
@@ -144,7 +144,7 @@ static void report_divergance(ExecState *us, ExecState 
*them)
         int i;
         GSList *entry;
 
-        g_string_printf(out, "Δ insn_count @ 0x%016lx (%ld) vs 0x%016lx 
(%ld)\n",
+        g_string_printf(out, "Δ insn_count @ 0x%016" PRIx64 " (%ld) vs 0x%016" 
PRIx64 " (%ld)\n",
                         us->pc, us->insn_count, them->pc, them->insn_count);
 
         for (entry = log, i = 0;
@@ -152,7 +152,7 @@ static void report_divergance(ExecState *us, ExecState 
*them)
              entry = g_slist_next(entry), i++) {
             ExecInfo *prev = (ExecInfo *) entry->data;
             g_string_append_printf(out,
-                                   "  previously @ 0x%016lx/%ld (%ld insns)\n",
+                                   "  previously @ 0x%016" PRIx64 "/%" PRId64 
" (%ld insns)\n",
                                    prev->block->pc, prev->block->insns,
                                    prev->insn_count);
         }
-- 
2.41.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]