mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: He Kuang <hekuang@huawei.com>
To: Jiri Olsa <jolsa@redhat.com>, Vinson Lee <vlee@twopensource.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Namhyung Kim <namhyung@kernel.org>,
	David Ahern <dsahern@gmail.com>, "Jiri Olsa" <jolsa@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	<raphael.beamonte@gmail.com>, <matt@codeblueprint.co.uk>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	<linux-tip-commits@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [tip:perf/core] tools: Add err.h with ERR_PTR PTR_ERR interface
Date: Tue, 29 Sep 2015 15:52:09 +0800	[thread overview]
Message-ID: <560A4329.7090100@huawei.com> (raw)
In-Reply-To: <20150929072028.GB27383@krava.redhat.com>

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@twopensource.com>
> Link: http://lkml.kernel.org/n/tip-ujp5f63wvy70jlzeh3rt5f98@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>   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
>


  reply	other threads:[~2015-09-29  7:54 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-07  8:38 [PATCHv2 0/5] perf tools: Enhance parsing events tracepoint error output Jiri Olsa
2015-09-07  8:38 ` [PATCH 1/5] tools: Add err.h with ERR_PTR PTR_ERR interface Jiri Olsa
2015-09-08 20:22   ` Raphaël Beamonte
2015-09-08 20:24     ` Raphaël Beamonte
2015-09-08 21:06     ` Arnaldo Carvalho de Melo
2015-09-08 21:28       ` Raphaël Beamonte
2015-09-08 21:29   ` Raphaël Beamonte
2015-09-16  7:28   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-09-21 23:41     ` Vinson Lee
2015-09-29  6:35       ` Vinson Lee
2015-09-29  7:14         ` Jiri Olsa
2015-09-29  7:20           ` Jiri Olsa
2015-09-29  7:52             ` He Kuang [this message]
2015-09-29  7:57               ` Jiri Olsa
2015-09-29  8:15                 ` He Kuang
2015-09-29 10:41                   ` Jiri Olsa
2015-09-29 14:52                     ` Arnaldo Carvalho de Melo
2015-09-29 15:05                       ` [PATCH] perf tool: Fix shadowed declaration in parse-events.c Jiri Olsa
2015-10-01  7:10                         ` [tip:perf/core] perf tools: " tip-bot for Jiri Olsa
2015-09-07  8:38 ` [PATCH 2/5] perf tools: Add tools/include into tags directories Jiri Olsa
2015-09-15  7:02   ` [tip:perf/core] perf tools: Add tools/ include " tip-bot for Jiri Olsa
2015-09-07  8:38 ` [PATCH 3/5] perf tools: Propagate error info for the tracepoint parsing Jiri Olsa
2015-09-08 21:42   ` Raphaël Beamonte
2015-09-09  7:50     ` Jiri Olsa
2015-09-12 10:54   ` Matt Fleming
2015-09-16  7:29   ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-09-07  8:38 ` [PATCH 4/5] perf tools: Propagate error info from tp_format Jiri Olsa
2015-09-09 20:58   ` Arnaldo Carvalho de Melo
2015-09-10  8:24     ` Jiri Olsa
2015-09-10 14:16       ` Arnaldo Carvalho de Melo
2015-09-14 20:53       ` Arnaldo Carvalho de Melo
2015-09-14 20:59         ` Raphaël Beamonte
2015-09-14 21:36           ` Arnaldo Carvalho de Melo
2015-09-14 22:05             ` Raphaël Beamonte
2015-09-15  2:35               ` Arnaldo Carvalho de Melo
2015-09-14 21:02         ` Arnaldo Carvalho de Melo
2015-09-16  7:29   ` [tip:perf/core] perf evsel: " tip-bot for Jiri Olsa
2015-09-07  8:38 ` [PATCH 5/5] perf tools: Enhance parsing events tracepoint error output Jiri Olsa
2015-09-10  7:00   ` Namhyung Kim
2015-09-10  8:05     ` Jiri Olsa
2015-09-11 16:09       ` Namhyung Kim
2015-09-11 16:16         ` Jiri Olsa
2015-09-11 17:50           ` Raphaël Beamonte
2015-09-11 18:55             ` Arnaldo Carvalho de Melo
2015-09-11 19:56               ` Raphaël Beamonte
2015-09-11 20:22                 ` Arnaldo Carvalho de Melo
2015-09-11 22:01                   ` Raphaël Beamonte
2015-09-14 20:59       ` Arnaldo Carvalho de Melo
2015-09-16  7:29   ` [tip:perf/core] " tip-bot for Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=560A4329.7090100@huawei.com \
    --to=hekuang@huawei.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=raphael.beamonte@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=vlee@twopensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome