public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: kernel/time/hrtimer.c:1483:14: warning: variable 'expires_in_hardirq' set but not used
Date: Mon, 20 Nov 2023 16:17:14 +0100	[thread overview]
Message-ID: <20231120151714.ttaFVMK0@linutronix.de> (raw)
In-Reply-To: <202311120815.33YfGjzD-lkp@intel.com>

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

  reply	other threads:[~2023-11-20 15:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-12  0:52 kernel/time/hrtimer.c:1483:14: warning: variable 'expires_in_hardirq' set but not used kernel test robot
2023-11-20 15:17 ` Sebastian Andrzej Siewior [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-11-19  4:35 kernel test robot
2023-09-11  7:54 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231120151714.ttaFVMK0@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox