lkml.org 
[lkml]   [2020]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] x86: kvm: avoid -Wshadow warning in header
On Wed, Oct 28, 2020 at 6:04 PM Sean Christopherson
<sean.j.christopherson@intel.com> wrote:
>
> On Mon, Oct 26, 2020 at 05:14:39PM +0100, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > There are hundreds of warnings in a W=2 build about a local
> > variable shadowing the global 'apic' definition:
> >
> > arch/x86/kvm/lapic.h:149:65: warning: declaration of 'apic' shadows a global declaration [-Wshadow]
> >
> > Avoid this by renaming the local in the kvm/lapic.h header
>
> Rather than change KVM, and presumably other files as well, e.g. kvm/lapic.c and
> apic/io_apic.c also shadow 'apic' all over the place, what about renaming the
> global 'apic' to something more unique? KVM aside, using such a common name for
> a global variable has always struck me as a bit odd/dangerous/confusing.

Yes, good point. I'll send a new patch for it later. Any suggestion
for a better name?

Arnd

\
 
 \ /
  Last update: 2020-10-28 23:08    [W:0.034 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site