lkml.org 
[lkml]   [2023]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: kernel/time/hrtimer.c:1483:14: warning: variable 'expires_in_hardirq' set but not used
On 2023-11-12 08:52:44 [+0800], kernel test robot wrote:
> Hi Sebastian,
Hi,

> FYI, the error/warning still remains.
>
> kernel/time/hrtimer.c:120:35: warning: initialized field overwritten [-Woverride-init]
> 120 | [CLOCK_REALTIME] = HRTIMER_BASE_REALTIME,
> | ^~~~~~~~~~~~~~~~~~~~~
> kernel/time/hrtimer.c:120:35: note: (near initialization for 'hrtimer_clock_to_base_table[0]')
> kernel/time/hrtimer.c:121:35: warning: initialized field overwritten [-Woverride-init]
> 121 | [CLOCK_MONOTONIC] = HRTIMER_BASE_MONOTONIC,
> | ^~~~~~~~~~~~~~~~~~~~~~
> kernel/time/hrtimer.c:121:35: note: (near initialization for 'hrtimer_clock_to_base_table[1]')
> kernel/time/hrtimer.c:122:35: warning: initialized field overwritten [-Woverride-init]
> 122 | [CLOCK_BOOTTIME] = HRTIMER_BASE_BOOTTIME,
> | ^~~~~~~~~~~~~~~~~~~~~
> kernel/time/hrtimer.c:122:35: note: (near initialization for 'hrtimer_clock_to_base_table[7]')
> kernel/time/hrtimer.c:123:35: warning: initialized field overwritten [-Woverride-init]
> 123 | [CLOCK_TAI] = HRTIMER_BASE_TAI,
> | ^~~~~~~~~~~~~~~~
> kernel/time/hrtimer.c:123:35: note: (near initialization for 'hrtimer_clock_to_base_table[11]')

This is "okay". The array is first initialized completely to a safe
value and then a few of the individual values are overwritten.
So this "initialized field overwritten", that the compiler complains
about, is intended here.

> kernel/time/hrtimer.c: In function '__run_hrtimer':
> >> kernel/time/hrtimer.c:1483:14: warning: variable 'expires_in_hardirq' set but not used [-Wunused-but-set-variable]
> 1483 | bool expires_in_hardirq;
> | ^~~~~~~~~~~~~~~~~~

This is because the code using it is disabled at build time. I could
tweak the code to make look it used in the off case so the warning goes
away.

Sebastian

\
 
 \ /
  Last update: 2023-11-20 16:18    [W:0.073 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site