perf timechart: Remove the unused use_old_power_events variable
Arnaldo Carvalho de Melo
maintainerPATCH 1/1 perf timechart: Remove the unused use_old_power_events variable
It is set once and never read: its only reader went away in 20c457b8587bee46 ("perf timechart: Adjust perf timechart to the new power events") and nothing used it since, so the assignment was dead code for 13 years.
clang 23 extends -Wunused-but-set-variable to file-scope variables with internal linkage, under the new -Wunused-but-set-global subgroup, and with the -Werror that perf uses by default that turns the dead assignment into a build error:
builtin-timechart.c:355:12: error: variable 'use_old_power_events' set but not used
[-Werror,-Wunused-but-set-global]
as seen building with clang 23.1.1 on Fedora 45 and rawhide, where gcc, older clang and clang without -Werror all keep building it.
--- tools/perf/builtin-timechart.c | 5 ----- 1 file changed, 5 deletions(-)
tools/perf/builtin-timechart.c +0 -5
@@ -351,10 +351,6 @@ static int process_exit_event(const struct perf_tool *tool,return 0 ; } -#ifdef SUPPORT_OLD_POWER_EVENTS -static int use_old_power_events; -#endif -static void c_state_start (int cpu,u64 timestamp,int state) { cpus_cstate_start_times[cpu] = timestamp;
@@ -1943,7 +1939,6 @@ static int timechart__record(struct timechart *tchart, int argc, const char **ar#ifdef SUPPORT_OLD_POWER_EVENTS if (!is_valid_tracepoint ("power:cpu_idle" ) &&is_valid_tracepoint ("power:power_start" )) { - use_old_power_events =1 ; power_args_nr =0 ; }else { old_power_args_nr =0 ;
Signature · 1 line
2.53.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines
It is set once and never read: its only reader went away in
20c457b8587bee46("perf timechart: Adjust perf timechart to the new power events") and nothing used it since, so the assignment was dead code for 13 years.clang 23 extends -Wunused-but-set-variable to file-scope variables with internal linkage, under the new -Wunused-but-set-global subgroup, and with the -Werror that perf uses by default that turns the dead assignment into a build error:
Quoted 8 lines
builtin-timechart.c:355:12: error: variable '
use_old_power_events' set but not used
[-Werror,-Wunused-but-set-global]as seen building with clang 23.1.1 on Fedora 45 and rawhide, where gcc, older clang and clang without -Werror all keep building it.
Assisted-by LLMSigned-off-by Arnaldo Carvalho de Melo <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/argr21X4JoSl1O2W@x2?part=1
Quoted 11 lines · Arnaldo Carvalho de Melo
It is set once and never read: its only reader went away in
20c457b8587bee46("perf timechart: Adjust perf timechart to the new power events") and nothing used it since, so the assignment was dead code for 13 years.clang 23 extends -Wunused-but-set-variable to file-scope variables with internal linkage, under the new -Wunused-but-set-global subgroup, and with the -Werror that perf uses by default that turns the dead assignment into a build error:
Quoted 8 lines
builtin-timechart.c:355:12: error: variable '
use_old_power_events' set but not used
[-Werror,-Wunused-but-set-global]as seen building with clang 23.1.1 on Fedora 45 and rawhide, where gcc, older clang and clang without -Werror all keep building it.
Assisted-by LLMSigned-off-by Arnaldo Carvalho de Melo <[email protected]>
Thanks,
Ian
Quoted 30 lines
--- tools/perf/builtin-timechart.c | 5 ----- 1 file changed, 5 deletions(-)tools/perf/builtin-timechart.c +0
-6@@ -351,10 +351,6 @@ static int process_exit_event(const struct perf_tool *tool,return 0 ; } -#ifdef SUPPORT_OLD_POWER_EVENTS -static int use_old_power_events; -#endif -static void c_state_start (int cpu,u64 timestamp,int state) { cpus_cstate_start_times[cpu] = timestamp;@@ -1943,7 +1939,6 @@ static int timechart__record(struct timechart *tchart, int argc, const char **ar#ifdef SUPPORT_OLD_POWER_EVENTS if (!is_valid_tracepoint ("power:cpu_idle" ) &&is_valid_tracepoint ("power:power_start" )) { - use_old_power_events =1 ; power_args_nr =0 ; }else { old_power_args_nr =0 ; --2.53.0