perf_counter tools: Add more warnings and fix/annotate them
Enable -Wextra. This found a few real bugs plus a number
of signed/unsigned type mismatches/uncleanlinesses. It
also required a few annotations
All things considered it was still worth it so lets try with
this enabled for now.
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 440db12..3dceabd 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -92,7 +92,7 @@
fill_node(struct callchain_node *node, struct ip_callchain *chain,
int start, struct symbol **syms)
{
- int i;
+ unsigned int i;
for (i = start; i < chain->nr; i++) {
struct callchain_list *call;
@@ -135,7 +135,7 @@
{
struct callchain_node *new;
struct list_head *old_tail;
- int idx_total = idx_parents + idx_local;
+ unsigned int idx_total = idx_parents + idx_local;
/* split */
new = create_child(parent, true);
@@ -164,17 +164,18 @@
static int
__append_chain(struct callchain_node *root, struct ip_callchain *chain,
- int start, struct symbol **syms);
+ unsigned int start, struct symbol **syms);
static void
__append_chain_children(struct callchain_node *root, struct ip_callchain *chain,
- struct symbol **syms, int start)
+ struct symbol **syms, unsigned int start)
{
struct callchain_node *rnode;
/* lookup in childrens */
list_for_each_entry(rnode, &root->children, brothers) {
- int ret = __append_chain(rnode, chain, start, syms);
+ unsigned int ret = __append_chain(rnode, chain, start, syms);
+
if (!ret)
return;
}
@@ -184,10 +185,10 @@
static int
__append_chain(struct callchain_node *root, struct ip_callchain *chain,
- int start, struct symbol **syms)
+ unsigned int start, struct symbol **syms)
{
struct callchain_list *cnode;
- int i = start;
+ unsigned int i = start;
bool found = false;
/*