[PATCH 141/161] perf tools: Fix old GCC build error in 'get_srcline'

From: Arnaldo Carvalho de Melo
Date: Mon Oct 14 2013 - 16:17:51 EST


From: David Ahern <dsahern@xxxxxxxxx>

trace-event-parse.c:parse_proc_kallsyms()

Old GCC (4.4.2) does not see through the code flow of get_srcline() and
gets confused about the status of 'file' and 'line':

CC /tmp/build/perf/util/srcline.o
cc1: warnings being treated as errors
util/srcline.c: In function Âget_srclineÂ:
util/srcline.c:226: error: Âfile may be used uninitialized in this function
util/srcline.c:227: error: Âline may be used uninitialized in this function
make[1]: *** [/tmp/build/perf/util/srcline.o] Error 1
make: *** [install] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf'
[acme@fedora12 linux]$

Help out GCC by initializing 'file' and 'line'.

Signed-off-by: David Ahern <dsahern@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxx>
Link: http://lkml.kernel.org/n/tip-h8k7h49z3cndqgjdftkmm9f8@xxxxxxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/srcline.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index 37353194e0f6..d11aefbc4b8d 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -223,8 +223,8 @@ out:

char *get_srcline(struct dso *dso, unsigned long addr)
{
- char *file;
- unsigned line;
+ char *file = NULL;
+ unsigned line = 0;
char *srcline;
char *dso_name = dso->long_name;
size_t size;
--
1.8.1.4

--
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/