Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1370932 > unrolled thread

[PATCH] perf config: Fix build with older toolchain.

Started byVinson Lee <vlee@freedesktop.org>
First post2016-04-05 00:10 +0200
Last post2016-04-13 09:20 +0200
Articles 6 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] perf config: Fix build with older toolchain. Vinson Lee <vlee@freedesktop.org> - 2016-04-05 00:10 +0200
    Re: [PATCH] perf config: Fix build with older toolchain. Taeung Song <taeung.dev@gmail.com> - 2016-04-05 07:30 +0200
      Re: [PATCH] perf config: Fix build with older toolchain. Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-05 15:40 +0200
        Re: [PATCH] perf config: Fix build with older toolchain. Taeung Song <treeze.taeung@gmail.com> - 2016-04-05 15:50 +0200
    Re: [PATCH] perf config: Fix build with older toolchain. Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-05 15:40 +0200
    [tip:perf/core] perf config: Fix build with older toolchain. tip-bot for Vinson Lee <tipbot@zytor.com> - 2016-04-13 09:20 +0200

#1370932 — [PATCH] perf config: Fix build with older toolchain.

FromVinson Lee <vlee@freedesktop.org>
Date2016-04-05 00:10 +0200
Subject[PATCH] perf config: Fix build with older toolchain.
Message-ID<rkkR4-1n3-7@gated-at.bofh.it>
Fix build error on Ubuntu 12.04.5 with GCC 4.6.3.

  CC       util/config.o
util/config.c: In function ‘perf_buildid_config’:
util/config.c:384:15: error: declaration of ‘dirname’ shadows a global declaration [-Werror=shadow]

Fixes: 9cb5987c8227 ("perf config: Rework buildid_dir_command_config to perf_buildid_config")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
---
 tools/perf/util/config.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 5c20d783423b..a3d80a05e7a2 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -381,11 +381,11 @@ static int perf_buildid_config(const char *var, const char *value)
 {
 	/* same dir for all commands */
 	if (!strcmp(var, "buildid.dir")) {
-		const char *dirname = perf_config_dirname(var, value);
+		const char *v = perf_config_dirname(var, value);
 
-		if (!dirname)
+		if (!v)
 			return -1;
-		strncpy(buildid_dir, dirname, MAXPATHLEN-1);
+		strncpy(buildid_dir, v, MAXPATHLEN-1);
 		buildid_dir[MAXPATHLEN-1] = '\0';
 	}
 
-- 
1.7.9.5

[toc] | [next] | [standalone]


#1371219

FromTaeung Song <taeung.dev@gmail.com>
Date2016-04-05 07:30 +0200
Message-ID<rkrIS-6Ag-13@gated-at.bofh.it>
In reply to#1370932
Hi,

On 04/05/2016 07:07 AM, Vinson Lee wrote:
> Fix build error on Ubuntu 12.04.5 with GCC 4.6.3.
>
>    CC       util/config.o
> util/config.c: In function ‘perf_buildid_config’:
> util/config.c:384:15: error: declaration of ‘dirname’ shadows a global declaration [-Werror=shadow]

I'm sorry, lately I added perf_buildid_config() but I didn't test by 
gcc-4.6.3

> Fixes: 9cb5987c8227 ("perf config: Rework buildid_dir_command_config to perf_buildid_config")
> Signed-off-by: Vinson Lee <vlee@freedesktop.org>
> ---
>   tools/perf/util/config.c |    6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
> index 5c20d783423b..a3d80a05e7a2 100644
> --- a/tools/perf/util/config.c
> +++ b/tools/perf/util/config.c
> @@ -381,11 +381,11 @@ static int perf_buildid_config(const char *var, const char *value)
>   {
>   	/* same dir for all commands */
>   	if (!strcmp(var, "buildid.dir")) {
> -		const char *dirname = perf_config_dirname(var, value);
> +		const char *v = perf_config_dirname(var, value);

Why you use 'v' variable name ?

'v' variable name was used in set_buildid_dir(), too.
But I send a patch renaming 'v' to 'home' because 'home' is more readable.
37194f4 ("perf config: Rename 'v' to 'home' in set_buildid_dir()")
https://lkml.org/lkml/2016/3/27/98

IMHO, I like using 'dir' instead of 'v'.


Thanks,
Taeung

>
> -		if (!dirname)
> +		if (!v)
>   			return -1;
> -		strncpy(buildid_dir, dirname, MAXPATHLEN-1);
> +		strncpy(buildid_dir, v, MAXPATHLEN-1);
>   		buildid_dir[MAXPATHLEN-1] = '\0';
>   	}
>
>

[toc] | [prev] | [next] | [standalone]


#1371576

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-04-05 15:40 +0200
Message-ID<rkzn4-4jC-21@gated-at.bofh.it>
In reply to#1371219
Em Tue, Apr 05, 2016 at 02:24:19PM +0900, Taeung Song escreveu:
> On 04/05/2016 07:07 AM, Vinson Lee wrote:
> >  	if (!strcmp(var, "buildid.dir")) {
> >-		const char *dirname = perf_config_dirname(var, value);
> >+		const char *v = perf_config_dirname(var, value);
> 
> Why you use 'v' variable name ?
> 
> 'v' variable name was used in set_buildid_dir(), too.
> But I send a patch renaming 'v' to 'home' because 'home' is more readable.
> 37194f4 ("perf config: Rename 'v' to 'home' in set_buildid_dir()")
> https://lkml.org/lkml/2016/3/27/98
> 
> IMHO, I like using 'dir' instead of 'v'.

Whatever, I'm switching this to 'dir', but don't pay _that_ much
attention to variables that have such a narrow scope...

- Arnaldo

[toc] | [prev] | [next] | [standalone]


#1371598

FromTaeung Song <treeze.taeung@gmail.com>
Date2016-04-05 15:50 +0200
Message-ID<rkzwK-4pv-9@gated-at.bofh.it>
In reply to#1371576
Hi, Arnaldo

On 04/05/2016 10:38 PM, Arnaldo Carvalho de Melo wrote:
> Em Tue, Apr 05, 2016 at 02:24:19PM +0900, Taeung Song escreveu:
>> On 04/05/2016 07:07 AM, Vinson Lee wrote:
>>>   	if (!strcmp(var, "buildid.dir")) {
>>> -		const char *dirname = perf_config_dirname(var, value);
>>> +		const char *v = perf_config_dirname(var, value);
>>
>> Why you use 'v' variable name ?
>>
>> 'v' variable name was used in set_buildid_dir(), too.
>> But I send a patch renaming 'v' to 'home' because 'home' is more readable.
>> 37194f4 ("perf config: Rename 'v' to 'home' in set_buildid_dir()")
>> https://lkml.org/lkml/2016/3/27/98
>>
>> IMHO, I like using 'dir' instead of 'v'.
>
> Whatever, I'm switching this to 'dir', but don't pay _that_ much
> attention to variables that have such a narrow scope...
>

OK, I got it! :)

Thanks,
Taeung

[toc] | [prev] | [next] | [standalone]


#1371585

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-04-05 15:40 +0200
Message-ID<rkzn6-4jC-41@gated-at.bofh.it>
In reply to#1370932
Em Mon, Apr 04, 2016 at 10:07:39PM +0000, Vinson Lee escreveu:
> Fix build error on Ubuntu 12.04.5 with GCC 4.6.3.

>   CC       util/config.o
> util/config.c: In function ‘perf_buildid_config’:
> util/config.c:384:15: error: declaration of ‘dirname’ shadows a global declaration [-Werror=shadow]

Argh, I was catching these by building on rhel6, but I stopped doing so
since switching to using docker images to do test builds... but I had
none set up for ubuntu 12.04 or any other distro with such breakage in
the headers, not anymore:

[root@jouet ~]# docker run -v /home/acme/git:/git --privileged=true
--rm=true -t -i ubuntu:12.04 /bin/bash
Unable to find image 'ubuntu:12.04' locally
Trying to pull repository docker.io/library/ubuntu ... 12.04: Pulling
from library/ubuntu
e37bb777fc4e: Pull complete

which is indeed:

root@7d7625f390d3:/# cat /etc/os-release 
NAME="Ubuntu"
VERSION="12.04.5 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu precise (12.04.5 LTS)"
VERSION_ID="12.04"
root@7d7625f390d3:/# 

And where I indeed can reproduce this error:

root@7d7625f390d3:/# make JOBS=1 -C /git/linux/tools/perf
O=/tmp/build/perf install-bin 2>&1 | tail
  CC       /tmp/build/perf/util/config.o
util/config.c: In function 'perf_buildid_config':
util/config.c:384:15: error: declaration of 'dirname' shadows a global
declaration [-Werror=shadow]
cc1: all warnings being treated as errors
mv: cannot stat `/tmp/build/perf/util/.config.o.tmp': No such file or
directory
make[3]: *** [/tmp/build/perf/util/config.o] Error 1
make[2]: *** [util] Error 2
make[1]: *** [/tmp/build/perf/libperf-in.o] Error 2
make: *** [install-bin] Error 2
make: Leaving directory `/git/linux/tools/perf'
root@7d7625f390d3:/#

Applying the patch, hopefully with this new distro in the set of build
test images we won't see such problems for a while :-)

- Arnaldo
 
> Fixes: 9cb5987c8227 ("perf config: Rework buildid_dir_command_config to perf_buildid_config")
> Signed-off-by: Vinson Lee <vlee@freedesktop.org>
> ---
>  tools/perf/util/config.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
> index 5c20d783423b..a3d80a05e7a2 100644
> --- a/tools/perf/util/config.c
> +++ b/tools/perf/util/config.c
> @@ -381,11 +381,11 @@ static int perf_buildid_config(const char *var, const char *value)
>  {
>  	/* same dir for all commands */
>  	if (!strcmp(var, "buildid.dir")) {
> -		const char *dirname = perf_config_dirname(var, value);
> +		const char *v = perf_config_dirname(var, value);
>  
> -		if (!dirname)
> +		if (!v)
>  			return -1;
> -		strncpy(buildid_dir, dirname, MAXPATHLEN-1);
> +		strncpy(buildid_dir, v, MAXPATHLEN-1);
>  		buildid_dir[MAXPATHLEN-1] = '\0';
>  	}
>  
> -- 
> 1.7.9.5

[toc] | [prev] | [next] | [standalone]


#1377564 — [tip:perf/core] perf config: Fix build with older toolchain.

Fromtip-bot for Vinson Lee <tipbot@zytor.com>
Date2016-04-13 09:20 +0200
Subject[tip:perf/core] perf config: Fix build with older toolchain.
Message-ID<rnnfH-5N9-1@gated-at.bofh.it>
In reply to#1370932
Commit-ID:  d8e28654f28de74951ab1b7e59d2bebb442972aa
Gitweb:     http://git.kernel.org/tip/d8e28654f28de74951ab1b7e59d2bebb442972aa
Author:     Vinson Lee <vlee@freedesktop.org>
AuthorDate: Mon, 4 Apr 2016 22:07:39 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 6 Apr 2016 10:44:28 -0300

perf config: Fix build with older toolchain.

Fix build error on Ubuntu 12.04.5 with GCC 4.6.3.

    CC       util/config.o
  util/config.c: In function ‘perf_buildid_config’:
  util/config.c:384:15: error: declaration of ‘dirname’ shadows a global declaration [-Werror=shadow]

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Taeung Song <treeze.taeung@gmail.com>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 9cb5987c8227 ("perf config: Rework buildid_dir_command_config to perf_buildid_config")
Link: http://lkml.kernel.org/r/1459807659-9020-1-git-send-email-vlee@freedesktop.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/config.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
index 5c20d78..664490b 100644
--- a/tools/perf/util/config.c
+++ b/tools/perf/util/config.c
@@ -381,11 +381,11 @@ static int perf_buildid_config(const char *var, const char *value)
 {
 	/* same dir for all commands */
 	if (!strcmp(var, "buildid.dir")) {
-		const char *dirname = perf_config_dirname(var, value);
+		const char *dir = perf_config_dirname(var, value);
 
-		if (!dirname)
+		if (!dir)
 			return -1;
-		strncpy(buildid_dir, dirname, MAXPATHLEN-1);
+		strncpy(buildid_dir, dir, MAXPATHLEN-1);
 		buildid_dir[MAXPATHLEN-1] = '\0';
 	}
 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web