Skip to contentSkip to conversation

perf probe: Fix compiles due to declarations using perf_probe_point

PATCH Applied David Ahern 3 participants 3 messages Mar 11, 2015 – Mar 14, 2015 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf probe: Fix compiles due to declarations using perf_probe_point

perf fails to build with gcc "(GCC) 4.4.7 20120313 (Red Hat 4.4.7-4.0.9)" (a.k.a., RHEL6 / CentOS 6 / OL 6):

cc1: warnings being treated as errors
util/probe-event.c: In function ‘get_alternative_line_range’:
util/probe-event.c:359: error: missing initializer util/probe-event.c:359: error: (near initialization for ‘pp.file’) util/probe-event.c:359: error: missing initializer util/probe-event.c:359: error: (near initialization for ‘result.function’)

Fix by bringing in initializers to declaration.

Cc Masami Hiramatsu <[email protected]>
---
 tools/perf/util/probe-event.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
tools/perf/util/probe-event.c +6 -4
index 8af8e7f55254..a9c115d102c4 100644
@@ -356,12 +356,14 @@ static int get_alternative_line_range(struct debuginfo *dinfo,
 				      struct line_range *lr,
 				      const char *target, bool user)
 {
-	struct perf_probe_point pp = { 0 }, result = { 0 };
+	struct perf_probe_point pp = { .function = lr->function,
+				       .file = lr->file,
+				       .line = lr->start };
+	struct perf_probe_point result;
 	int ret, len = 0;
 
-	pp.function = lr->function;
-	pp.file = lr->file;
-	pp.line = lr->start;
+	memset(&result, 0, sizeof(result));
+
 	if (lr->end != INT_MAX)
 		len = lr->end - lr->start;
 	ret = find_alternative_probe_point(dinfo, &pp, &result,
Signature · 1 line
2.3.0
maintainer Applied
#1 lore raw

Em Wed, Mar 11, 2015 at 10:36:20AM -0400, David Ahern escreveu:

Quoted 11 lines

perf fails to build with gcc "(GCC) 4.4.7 20120313 (Red Hat 4.4.7-4.0.9)" (a.k.a., RHEL6 / CentOS 6 / OL 6):

cc1: warnings being treated as errors
util/probe-event.c: In function ‘get_alternative_line_range’:
util/probe-event.c:359: error: missing initializer util/probe-event.c:359: error: (near initialization for ‘pp.file’) util/probe-event.c:359: error: missing initializer util/probe-event.c:359: error: (near initialization for ‘result.function’)

Fix by bringing in initializers to declaration.

Thanks, applied to perf/core.

- Arnaldo

#2 lore raw
In reply to David Ahern
perf probe: Fix compiles due to declarations using perf_probe_point
Commit-ID:  6d4a48968bfb5c67002f253fbaeb5acd41d7897a
Gitweb:     http://git.kernel.org/tip/6d4a48968bfb5c67002f253fbaeb5acd41d7897a
Author:     David Ahern <[email protected]>
AuthorDate: Wed, 11 Mar 2015 10:36:20 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 12 Mar 2015 12:40:00 -0300

perf probe: Fix compiles due to declarations using perf_probe_point

perf fails to build with gcc "(GCC) 4.4.7 20120313 (Red Hat 4.4.7-4.0.9)" (a.k.a., RHEL6 / CentOS 6 / OL 6):

cc1: warnings being treated as errors
util/probe-event.c: In function ‘get_alternative_line_range’:
util/probe-event.c:359: error: missing initializer util/probe-event.c:359: error: (near initialization for ‘pp.file’) util/probe-event.c:359: error: missing initializer util/probe-event.c:359: error: (near initialization for ‘result.function’)

Fix by bringing in initializers to declaration.

---
 tools/perf/util/probe-event.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
tools/perf/util/probe-event.c +6 -4
index e2bf620..f272a71 100644
@@ -356,12 +356,14 @@ static int get_alternative_line_range(struct debuginfo *dinfo,
 				      struct line_range *lr,
 				      const char *target, bool user)
 {
-	struct perf_probe_point pp = { 0 }, result = { 0 };
+	struct perf_probe_point pp = { .function = lr->function,
+				       .file = lr->file,
+				       .line = lr->start };
+	struct perf_probe_point result;
 	int ret, len = 0;
 
-	pp.function = lr->function;
-	pp.file = lr->file;
-	pp.line = lr->start;
+	memset(&result, 0, sizeof(result));
+
 	if (lr->end != INT_MAX)
 		len = lr->end - lr->start;
 	ret = find_alternative_probe_point(dinfo, &pp, &result,