public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf_event: fix compile error
@ 2009-12-02  8:08 Xiao Guangrong
  2009-12-02  8:17 ` Ingo Molnar
  2009-12-02  8:31 ` [tip:perf/core] perf_event: Fix " tip-bot for Xiao Guangrong
  0 siblings, 2 replies; 5+ messages in thread
From: Xiao Guangrong @ 2009-12-02  8:08 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, LKML

cc1: warnings being treated as errors
builtin-probe.c: In function ‘cmd_probe’:
builtin-probe.c:163: error: unused variable ‘fd’

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
---
 tools/perf/builtin-probe.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index b5d15cf..64ea038 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -160,7 +160,8 @@ static const struct option options[] = {
 
 int cmd_probe(int argc, const char **argv, const char *prefix __used)
 {
-	int i, j, fd, ret;
+	int i, j, ret;
+	int fd __used;
 	struct probe_point *pp;
 
 	argc = parse_options(argc, argv, options, probe_usage,
-- 
1.6.1.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf_event: fix compile error
  2009-12-02  8:08 [PATCH] perf_event: fix compile error Xiao Guangrong
@ 2009-12-02  8:17 ` Ingo Molnar
  2009-12-02  8:21   ` Xiao Guangrong
  2009-12-02  8:31 ` [tip:perf/core] perf_event: Fix " tip-bot for Xiao Guangrong
  1 sibling, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2009-12-02  8:17 UTC (permalink / raw)
  To: Xiao Guangrong; +Cc: Peter Zijlstra, LKML


* Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> wrote:

> cc1: warnings being treated as errors
> builtin-probe.c: In function ???cmd_probe???:
> builtin-probe.c:163: error: unused variable ???fd???
> 
> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
> ---
>  tools/perf/builtin-probe.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> index b5d15cf..64ea038 100644
> --- a/tools/perf/builtin-probe.c
> +++ b/tools/perf/builtin-probe.c
> @@ -160,7 +160,8 @@ static const struct option options[] = {
>  
>  int cmd_probe(int argc, const char **argv, const char *prefix __used)
>  {
> -	int i, j, fd, ret;
> +	int i, j, ret;
> +	int fd __used;
>  	struct probe_point *pp;

i think it's better to initialize it to -1 instead of turning off the 
warning.

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf_event: fix compile error
  2009-12-02  8:17 ` Ingo Molnar
@ 2009-12-02  8:21   ` Xiao Guangrong
  2009-12-02  8:28     ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Xiao Guangrong @ 2009-12-02  8:21 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Peter Zijlstra, LKML



Ingo Molnar wrote:
> * Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> wrote:
> 
>> cc1: warnings being treated as errors
>> builtin-probe.c: In function ???cmd_probe???:
>> builtin-probe.c:163: error: unused variable ???fd???
>>
>> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
>> ---
>>  tools/perf/builtin-probe.c |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
>> index b5d15cf..64ea038 100644
>> --- a/tools/perf/builtin-probe.c
>> +++ b/tools/perf/builtin-probe.c
>> @@ -160,7 +160,8 @@ static const struct option options[] = {
>>  
>>  int cmd_probe(int argc, const char **argv, const char *prefix __used)
>>  {
>> -	int i, j, fd, ret;
>> +	int i, j, ret;
>> +	int fd __used;
>>  	struct probe_point *pp;
> 
> i think it's better to initialize it to -1 instead of turning off the 
> warning.
> 

Hi Ingo,

I have try this way but the error still exists :-(

Thanks,
Xiao

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf_event: fix compile error
  2009-12-02  8:21   ` Xiao Guangrong
@ 2009-12-02  8:28     ` Ingo Molnar
  0 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2009-12-02  8:28 UTC (permalink / raw)
  To: Xiao Guangrong; +Cc: Peter Zijlstra, LKML, Masami Hiramatsu


* Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> wrote:

> Ingo Molnar wrote:
> > * Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> wrote:
> > 
> >> cc1: warnings being treated as errors
> >> builtin-probe.c: In function ???cmd_probe???:
> >> builtin-probe.c:163: error: unused variable ???fd???
> >>
> >> Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
> >> ---
> >>  tools/perf/builtin-probe.c |    3 ++-
> >>  1 files changed, 2 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> >> index b5d15cf..64ea038 100644
> >> --- a/tools/perf/builtin-probe.c
> >> +++ b/tools/perf/builtin-probe.c
> >> @@ -160,7 +160,8 @@ static const struct option options[] = {
> >>  
> >>  int cmd_probe(int argc, const char **argv, const char *prefix __used)
> >>  {
> >> -	int i, j, fd, ret;
> >> +	int i, j, ret;
> >> +	int fd __used;
> >>  	struct probe_point *pp;
> > 
> > i think it's better to initialize it to -1 instead of turning off the 
> > warning.
> > 
> 
> Hi Ingo,
> 
> I have try this way but the error still exists :-(

ah - unused, not uninitialized.

Then the right fix is to use NO_LIBDWARF, not __used annotation. I've 
changed it to that and committed your fix - thanks!

	Ingo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:perf/core] perf_event: Fix compile error
  2009-12-02  8:08 [PATCH] perf_event: fix compile error Xiao Guangrong
  2009-12-02  8:17 ` Ingo Molnar
@ 2009-12-02  8:31 ` tip-bot for Xiao Guangrong
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Xiao Guangrong @ 2009-12-02  8:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, a.p.zijlstra, xiaoguangrong, tglx,
	mhiramat, mingo

Commit-ID:  bdad0db7dbdb37d0bb3c7d0f65cd3ff599ea6ecb
Gitweb:     http://git.kernel.org/tip/bdad0db7dbdb37d0bb3c7d0f65cd3ff599ea6ecb
Author:     Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
AuthorDate: Wed, 2 Dec 2009 16:08:41 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 2 Dec 2009 09:27:01 +0100

perf_event: Fix compile error

Fix:

 cc1: warnings being treated as errors
 builtin-probe.c: In function 'cmd_probe':
 builtin-probe.c:163: error: unused variable 'fd'

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Cc: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <4B162089.8000907@cn.fujitsu.com>
[ v2: use NO_LIBDWARF instead of __used ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/builtin-probe.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index b5d15cf..a58e11b 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -160,7 +160,10 @@ static const struct option options[] = {
 
 int cmd_probe(int argc, const char **argv, const char *prefix __used)
 {
-	int i, j, fd, ret;
+	int i, j, ret;
+#ifndef NO_LIBDWARF
+	int fd;
+#endif
 	struct probe_point *pp;
 
 	argc = parse_options(argc, argv, options, probe_usage,

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-12-02  8:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-02  8:08 [PATCH] perf_event: fix compile error Xiao Guangrong
2009-12-02  8:17 ` Ingo Molnar
2009-12-02  8:21   ` Xiao Guangrong
2009-12-02  8:28     ` Ingo Molnar
2009-12-02  8:31 ` [tip:perf/core] perf_event: Fix " tip-bot for Xiao Guangrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox