From: Frederic Weisbecker <fweisbec@gmail.com>
To: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>
Subject: [PATCH] perf: Fix accidentally preprocessed snprintf callback
Date: Wed, 14 Apr 2010 02:37:48 +0200 [thread overview]
Message-ID: <1271205468-8202-1-git-send-regression-fweisbec@gmail.com> (raw)
struct sort_entry has a callback named snprintf that turns an
entry into a string result.
But there are glibc versions that implement snprintf through a
macro. The following expression is then going to get the snprintf
call preprocessed:
ent->snprintf(...)
to finally end up in a build error:
util/hist.c: Dans la fonction «hist_entry__snprintf» :
util/hist.c:539: erreur: «struct sort_entry» has no member named «__builtin___snprintf_chk»
To fix this, rename struct sort_entry::snprintf() callback to
to_string(), assuming at least Java methods naming won't ever
conflict with perf.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
---
tools/perf/util/hist.c | 4 ++--
tools/perf/util/sort.c | 10 +++++-----
tools/perf/util/sort.h | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 18cf8b3..d07eccd 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -536,8 +536,8 @@ int hist_entry__snprintf(struct hist_entry *self,
continue;
ret += snprintf(s + ret, size - ret, "%s", sep ?: " ");
- ret += se->snprintf(self, s + ret, size - ret,
- se->width ? *se->width : 0);
+ ret += se->to_string(self, s + ret, size - ret,
+ se->width ? *se->width : 0);
}
return ret;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 9d24d4b..b8acf51 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -32,7 +32,7 @@ static int hist_entry__parent_snprintf(struct hist_entry *self, char *bf,
struct sort_entry sort_thread = {
.header = "Command: Pid",
.cmp = sort__thread_cmp,
- .snprintf = hist_entry__thread_snprintf,
+ .to_string = hist_entry__thread_snprintf,
.width = &threads__col_width,
};
@@ -40,27 +40,27 @@ struct sort_entry sort_comm = {
.header = "Command",
.cmp = sort__comm_cmp,
.collapse = sort__comm_collapse,
- .snprintf = hist_entry__comm_snprintf,
+ .to_string = hist_entry__comm_snprintf,
.width = &comms__col_width,
};
struct sort_entry sort_dso = {
.header = "Shared Object",
.cmp = sort__dso_cmp,
- .snprintf = hist_entry__dso_snprintf,
+ .to_string = hist_entry__dso_snprintf,
.width = &dsos__col_width,
};
struct sort_entry sort_sym = {
.header = "Symbol",
.cmp = sort__sym_cmp,
- .snprintf = hist_entry__sym_snprintf,
+ .to_string = hist_entry__sym_snprintf,
};
struct sort_entry sort_parent = {
.header = "Parent symbol",
.cmp = sort__parent_cmp,
- .snprintf = hist_entry__parent_snprintf,
+ .to_string = hist_entry__parent_snprintf,
.width = &parent_symbol__col_width,
};
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 6d7b4be..3a29fb5 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -82,8 +82,8 @@ struct sort_entry {
int64_t (*cmp)(struct hist_entry *, struct hist_entry *);
int64_t (*collapse)(struct hist_entry *, struct hist_entry *);
- int (*snprintf)(struct hist_entry *self, char *bf, size_t size,
- unsigned int width);
+ int (*to_string)(struct hist_entry *self, char *bf, size_t size,
+ unsigned int width);
unsigned int *width;
bool elide;
};
--
1.6.2.3
next reply other threads:[~2010-04-14 0:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-14 0:37 Frederic Weisbecker [this message]
2010-04-14 0:41 ` Frederic Weisbecker
2010-04-14 2:28 ` Arnaldo Carvalho de Melo
2010-04-14 14:55 ` Frederic Weisbecker
2010-04-14 17:09 ` [PATCH v2] struct sort_entry has a callback named snprintf that turns an entry into a string result Frederic Weisbecker
2010-04-14 17:11 ` [PATCH v3] perf: Fix accidentally preprocessed snprintf callback Frederic Weisbecker
2010-04-14 17:31 ` Arnaldo Carvalho de Melo
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=1271205468-8202-1-git-send-regression-fweisbec@gmail.com \
--to=fweisbec@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.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
all inboxes | Powered by JetHome®