Re: [tip:perf/core] tools: Add err.h with ERR_PTR PTR_ERR interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi, jirka

On 2015/9/29 15:20, Jiri Olsa wrote:
On Tue, Sep 29, 2015 at 09:14:10AM +0200, Jiri Olsa wrote:

SNIP

$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Cheers,
Vinson

Hi.

This build error still occurs with next-20150929.

attached patch should fix it

FYI there's another instance of this bug in parse-events.c in
Arnaldo's perf/core due to recent fixes, I'll send out fix shortly

and here it is..

He Kuang,
this might collide with your recent fixes..


Do I need to send new ones based on your patch below now?

jirka


---
The error variable breaks build on CentOS 6.7, due to
collision with global error symbol:

     CC       util/parse-events.o
   cc1: warnings being treated as errors
   util/parse-events.c:419: error: declaration of ‘error’ shadows a global
   declaration
   util/util.h:135: error: shadowed declaration is here
   util/parse-events.c: In function ‘add_tracepoint_multi_event’:
   ...

Using different argument names instead to fix it.

Reported-by: Vinson Lee <vlee@xxxxxxxxxxxxxxxx>
Link: http://lkml.kernel.org/n/tip-ujp5f63wvy70jlzeh3rt5f98@xxxxxxxxxxxxxx
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
  tools/perf/util/parse-events.c |   38 +++++++++++++++++++-------------------
  1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 61c2bc2..626bf85 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -387,7 +387,7 @@ int parse_events_add_cache(struct list_head *list, int *idx,
  	return add_event(list, idx, &attr, name, NULL);
  }

-static void tracepoint_error(struct parse_events_error *error, int err,
+static void tracepoint_error(struct parse_events_error *e, int err,
  			     char *sys, char *name)
  {
  	char help[BUFSIZ];
@@ -400,29 +400,29 @@ static void tracepoint_error(struct parse_events_error *error, int err,

  	switch (err) {
  	case EACCES:
-		error->str = strdup("can't access trace events");
+		e->str = strdup("can't access trace events");
  		break;
  	case ENOENT:
-		error->str = strdup("unknown tracepoint");
+		e->str = strdup("unknown tracepoint");
  		break;
  	default:
-		error->str = strdup("failed to add tracepoint");
+		e->str = strdup("failed to add tracepoint");
  		break;
  	}

  	tracing_path__strerror_open_tp(err, help, sizeof(help), sys, name);
-	error->help = strdup(help);
+	e->help = strdup(help);
  }

  static int add_tracepoint(struct list_head *list, int *idx,
  			  char *sys_name, char *evt_name,
-			  struct parse_events_error *error __maybe_unused)
+			  struct parse_events_error *err __maybe_unused)
  {
  	struct perf_evsel *evsel;

  	evsel = perf_evsel__newtp_idx(sys_name, evt_name, (*idx)++);
  	if (IS_ERR(evsel)) {
-		tracepoint_error(error, PTR_ERR(evsel), sys_name, evt_name);
+		tracepoint_error(err, PTR_ERR(evsel), sys_name, evt_name);
  		return PTR_ERR(evsel);
  	}

@@ -432,7 +432,7 @@ static int add_tracepoint(struct list_head *list, int *idx,

  static int add_tracepoint_multi_event(struct list_head *list, int *idx,
  				      char *sys_name, char *evt_name,
-				      struct parse_events_error *error)
+				      struct parse_events_error *err)
  {
  	char evt_path[MAXPATHLEN];
  	struct dirent *evt_ent;
@@ -442,7 +442,7 @@ static int add_tracepoint_multi_event(struct list_head *list, int *idx,
  	snprintf(evt_path, MAXPATHLEN, "%s/%s", tracing_events_path, sys_name);
  	evt_dir = opendir(evt_path);
  	if (!evt_dir) {
-		tracepoint_error(error, errno, sys_name, evt_name);
+		tracepoint_error(err, errno, sys_name, evt_name);
  		return -1;
  	}

@@ -456,7 +456,7 @@ static int add_tracepoint_multi_event(struct list_head *list, int *idx,
  		if (!strglobmatch(evt_ent->d_name, evt_name))
  			continue;

-		ret = add_tracepoint(list, idx, sys_name, evt_ent->d_name, error);
+		ret = add_tracepoint(list, idx, sys_name, evt_ent->d_name, err);
  	}

  	closedir(evt_dir);
@@ -465,16 +465,16 @@ static int add_tracepoint_multi_event(struct list_head *list, int *idx,

  static int add_tracepoint_event(struct list_head *list, int *idx,
  				char *sys_name, char *evt_name,
-				struct parse_events_error *error)
+				struct parse_events_error *err)
  {
  	return strpbrk(evt_name, "*?") ?
-	       add_tracepoint_multi_event(list, idx, sys_name, evt_name, error) :
-	       add_tracepoint(list, idx, sys_name, evt_name, error);
+	       add_tracepoint_multi_event(list, idx, sys_name, evt_name, err) :
+	       add_tracepoint(list, idx, sys_name, evt_name, err);
  }

  static int add_tracepoint_multi_sys(struct list_head *list, int *idx,
  				    char *sys_name, char *evt_name,
-				    struct parse_events_error *error)
+				    struct parse_events_error *err)
  {
  	struct dirent *events_ent;
  	DIR *events_dir;
@@ -482,7 +482,7 @@ static int add_tracepoint_multi_sys(struct list_head *list, int *idx,

  	events_dir = opendir(tracing_events_path);
  	if (!events_dir) {
-		tracepoint_error(error, errno, sys_name, evt_name);
+		tracepoint_error(err, errno, sys_name, evt_name);
  		return -1;
  	}

@@ -498,7 +498,7 @@ static int add_tracepoint_multi_sys(struct list_head *list, int *idx,
  			continue;

  		ret = add_tracepoint_event(list, idx, events_ent->d_name,
-					   evt_name, error);
+					   evt_name, err);
  	}

  	closedir(events_dir);
@@ -507,12 +507,12 @@ static int add_tracepoint_multi_sys(struct list_head *list, int *idx,

  int parse_events_add_tracepoint(struct list_head *list, int *idx,
  				char *sys, char *event,
-				struct parse_events_error *error)
+				struct parse_events_error *err)
  {
  	if (strpbrk(sys, "*?"))
-		return add_tracepoint_multi_sys(list, idx, sys, event, error);
+		return add_tracepoint_multi_sys(list, idx, sys, event, err);
  	else
-		return add_tracepoint_event(list, idx, sys, event, error);
+		return add_tracepoint_event(list, idx, sys, event, err);
  }

  static int


--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux