[PATCH] perf top: Use a macro instead of a constant variable
From: Arnaldo Carvalho de Melo
Date: Mon Feb 22 2010 - 13:14:51 EST
From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
To overcome a silly gcc warning:
cc1: warnings being treated as errors
builtin-top.c: In function âlookup_sym_sourceâ:
builtin-top.c:291: warning: not protecting local variables: variable length buffer
make: *** [builtin-top.o] Error 1
make: *** Waiting for unfinished jobs....
That is emitted for this:
const size_t pattern_len = BITS_PER_LONG / 4 + 2;
char pattern[pattern_len + 1];
Cc: FrÃdÃric Weisbecker <fweisbec@xxxxxxxxx>
Cc: Mike Galbraith <efault@xxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/builtin-top.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index a457bbb..1a197f4 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -291,7 +291,7 @@ static void lookup_sym_source(struct sym_entry *syme)
{
struct symbol *symbol = sym_entry__symbol(syme);
struct source_line *line;
- const size_t pattern_len = BITS_PER_LONG / 4 + 2;
+#define pattern_len (BITS_PER_LONG / 4 + 2)
char pattern[pattern_len + 1];
sprintf(pattern, "%0*Lx <", BITS_PER_LONG / 4,
@@ -305,6 +305,7 @@ static void lookup_sym_source(struct sym_entry *syme)
}
}
pthread_mutex_unlock(&syme->src->lock);
+#undef pattern_len
}
static void show_lines(struct source_line *queue, int count, int total)
--
1.5.5.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/