Skip to contentSkip to conversation

4.2-rc2 perf build error builtin-stat.c:346: error: declaration of ‘close’ shadows a global declaration

PATCH New Vinson Lee 3 participants 3 messages Jul 7, 2015 – Jul 10, 2015 perf events

lore
Share & tools
lore

Vinson Lee

author
#0 lore raw

Hi.

4.2-rc1 commit 106a94a0f8c207ef4113ce7e32f34a00b3b174e7 "perf stat:
Introduce read_counters function" introduced a build error with older toolchains.

This is the build error on CentOS 6.

CC builtin-stat.o
cc1: warnings being treated as errors
builtin-stat.c: In function ‘read_counters’:
builtin-stat.c:346: error: declaration of ‘close’ shadows a global declaration /usr/include/unistd.h:350: error: shadowed declaration is here

Cheers,
Vinson

#1 lore raw

PATCH 1/1 perf stat: Fix shadow declaration of close

Quoted 6 lines · Vinson Lee

Hi.

4.2-rc1 commit 106a94a0f8c207ef4113ce7e32f34a00b3b174e7 "perf stat:
Introduce read_counters function" introduced a build error with older toolchains.

Quoted 7 lines

This is the build error on CentOS 6.

CC builtin-stat.o
cc1: warnings being treated as errors
builtin-stat.c: In function ‘read_counters’:
builtin-stat.c:346: error: declaration of ‘close’ shadows a global declaration /usr/include/unistd.h:350: error: shadowed declaration is here

hi,
oops, sry.. patch attached

thanks,
jirka

---
Vinson reported shadow declaration of close introduced by following commit:
106a94a0f8c2 perf stat: Introduce read_counters function

Using close_counters name instead.

---
 tools/perf/builtin-stat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-stat.c +2 -2
index de9577503ea6..2c9edd22e6e8 100644
@@ -297,7 +297,7 @@ static int read_counter(struct perf_evsel *counter)
 	return 0;
 }
 
-static void read_counters(bool close)
+static void read_counters(bool close_counters)
 {
 	struct perf_evsel *counter;
 
@@ -308,7 +308,7 @@ static void read_counters(bool close)
 		if (perf_stat_process_counter(&stat_config, counter))
 			pr_warning("failed to process counter %s\n", counter->name);
 
-		if (close) {
+		if (close_counters) {
 			perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter),
 					     thread_map__nr(evsel_list->threads));
 		}
Signature · 1 line
2.4.3
#2 lore raw

[tip:perf/urgent] perf stat: Fix shadow declaration of close

perf stat: Fix shadow declaration of close
Commit-ID:  5fc472a628edb8ad83016a063329e8b589a04060
Gitweb:     http://git.kernel.org/tip/5fc472a628edb8ad83016a063329e8b589a04060
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 8 Jul 2015 13:17:31 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 8 Jul 2015 10:04:58 -0300

perf stat: Fix shadow declaration of close

Vinson reported shadow declaration of close introduced by the following commit:

106a94a0f8c2 perf stat: Introduce read_counters function

Using close_counters name instead.

Cc Jiri Olsa <[email protected]>
Cc Peter Zijlstra <[email protected]>
Fixes 106a94a0f8c2 ("perf stat: Introduce read_counters function")
---
 tools/perf/builtin-stat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-stat.c +2 -2
index 37e301a..d99d850 100644
@@ -343,7 +343,7 @@ static int read_counter(struct perf_evsel *counter)
 	return 0;
 }
 
-static void read_counters(bool close)
+static void read_counters(bool close_counters)
 {
 	struct perf_evsel *counter;
 
@@ -354,7 +354,7 @@ static void read_counters(bool close)
 		if (process_counter(counter))
 			pr_warning("failed to process counter %s\n", counter->name);
 
-		if (close) {
+		if (close_counters) {
 			perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter),
 					     thread_map__nr(evsel_list->threads));
 		}