From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org
Subject: [PATCH] contrib/plugins: fix -Wformat issues
Date: Thu, 7 Sep 2023 12:34:02 +0200 [thread overview]
Message-ID: <20230907103403.471248-1-pbonzini@redhat.com> (raw)
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
next reply other threads:[~2023-09-07 10:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-07 10:34 Paolo Bonzini [this message]
2023-09-07 10:52 ` [PATCH] contrib/plugins: fix -Wformat issues Philippe Mathieu-Daudé
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=20230907103403.471248-1-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).