[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210911122049.GW4323@worktop.programming.kicks-ass.net>
Date: Sat, 11 Sep 2021 14:20:49 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: kernel test robot <lkp@...el.com>
Cc: Yafang Shao <laoar.shao@...il.com>, kbuild-all@...ts.01.org,
linux-kernel@...r.kernel.org, linux-toolchains@...r.kernel.org
Subject: Re: [peterz-queue:sched/core 13/19] kernel/sched/fair.c:892:34:
warning: variable 'stats' set but not used
On Sat, Sep 11, 2021 at 02:21:26AM +0800, kernel test robot wrote:
> compiler: m68k-linux-gcc (GCC) 11.2.0
> kernel/sched/fair.c: In function 'update_curr':
> kernel/sched/fair.c:860:42: warning: unused variable 'stats' [-Wunused-variable]
> 860 | struct sched_statistics *stats = __schedstats_from_se(curr);
> | ^~~~~
OK, compiler guys, this code reads like:
#define schedstats_enabled() (0)
#define __schedstat_set(x, y) do { } while (0)
if (schedstats_enabled()) {
struct sched_statistics *stats = __schedstats_from_se(curr);
__schedstat_set(stats->exec_max,
max(delta_exec, stats->exec_max));
}
So yes, we initialize a variable that then isn't used, but the whole
bloody thing is inside if (0) which will not ever get ran *anyway*.
This is a crap warning if ever I saw one...
Powered by blists - more mailing lists