From: Arnaldo Carvalho de Melo <[email protected]>
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 <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
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