Peter Zijlstra 0a008c5098 sched: Fix DEBUG && !SCHEDSTATS warn
commit 769fdf83df57b373660343ef4270b3ada91ef434 upstream.

When !SCHEDSTATS schedstat_enabled() is an unconditional 0 and the
whole block doesn't exist, however GCC figures the scoped variable
'stats' is unused and complains about it.

Upgrade the warning from -Wunused-variable to -Wunused-but-set-variable
by writing it in two statements. This fixes the build because the new
warning is in W=1.

Given that whole if(0) {} thing, I don't feel motivated to change
things overly much and quite strongly feel this is the compiler being
daft.

Fixes: cb3e971c435d ("sched: Make struct sched_statistics independent of fair sched class")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-11 23:00:40 +09:00
..
2021-03-22 00:11:52 +01:00
2021-03-22 00:11:52 +01:00
2020-10-29 11:00:30 +01:00
2023-05-11 23:00:40 +09:00
2021-03-22 00:11:52 +01:00
2023-04-26 13:51:53 +02:00
2021-03-22 00:11:52 +01:00
2021-12-14 10:57:15 +01:00