Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1672369
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init |
| Date | 2017-06-22 09:30 +0200 |
| Message-ID | <tV4IX-1sJ-29@gated-at.bofh.it> (permalink) |
| References | <tUVPk-3BI-31@gated-at.bofh.it> <tUW8G-3Zg-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
* Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
> On Wed, Jun 21, 2017 at 11:57:28PM +0200, Arnd Bergmann wrote:
> > Without CONFIG_SMP, we get a harmless warning about
> > an unused variable:
> >
> > kernel/cpu.c: In function 'boot_cpu_state_init':
> > kernel/cpu.c:1778:6: error: unused variable 'cpu' [-Werror=unused-variable]
> >
> > This reworks the function to have the declaration inside
> > of the #ifdef.
> >
> > Fixes: faeb334286b7 ("rcu: Migrate callbacks earlier in the CPU-offline timeline")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> I simply added a __maybe_unused in 6441c656acde ("rcu: Migrate callbacks
> earlier in the CPU-offline timeline") in my -rcu tree. However, your
> approach does have the advantage of complaining if the code using that
> variable is removed.
>
> So, would you be OK with my folding your approach into my commit with
> attribution?
Also, note that __maybe_unused can be dangerous: it can hide a build warning where
there's a _real_ unused variable bug now or due to future changes, causing a real
runtime bug.
So I think we should consider it a syntactic construct to avoid.
Thanks,
Ingo
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] rcu: remove unused variable in boot_cpu_state_init Arnd Bergmann <arnd@arndb.de> - 2017-06-22 00:00 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-22 00:20 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Arnd Bergmann <arnd@arndb.de> - 2017-06-22 00:20 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-22 16:40 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-22 23:20 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Ingo Molnar <mingo@kernel.org> - 2017-06-22 09:30 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Arnd Bergmann <arnd@arndb.de> - 2017-06-22 09:50 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Ingo Molnar <mingo@kernel.org> - 2017-06-22 10:00 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Ingo Molnar <mingo@kernel.org> - 2017-06-22 10:00 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Ingo Molnar <mingo@kernel.org> - 2017-06-22 10:00 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Arnd Bergmann <arnd@arndb.de> - 2017-06-22 11:00 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Ingo Molnar <mingo@kernel.org> - 2017-06-22 11:10 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init Arnd Bergmann <arnd@arndb.de> - 2017-06-22 11:50 +0200
Re: [PATCH] rcu: remove unused variable in boot_cpu_state_init "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-06-22 17:00 +0200
csiph-web