Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755859AbcCQAyl (ORCPT ); Wed, 16 Mar 2016 20:54:41 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:38121 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751433AbcCQAyj (ORCPT ); Wed, 16 Mar 2016 20:54:39 -0400 Date: Thu, 17 Mar 2016 01:54:33 +0100 From: Frederic Weisbecker To: Ingo Molnar Cc: Linus Torvalds , Linux Kernel Mailing List , Thomas Gleixner , Peter Zijlstra , Andrew Morton Subject: Re: [PATCH v2] atomic: Fix bugs in 'fetch_or()' and rename it to 'xchg_or()' Message-ID: <20160317005431.GA29781@lerouge> References: <20160314123200.GA15971@gmail.com> <20160315093245.GA7943@gmail.com> <20160315122145.GA7225@gmail.com> <20160315170835.GA5058@lerouge> <20160316081444.GB31133@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160316081444.GB31133@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2641 Lines: 40 On Wed, Mar 16, 2016 at 09:14:44AM +0100, Ingo Molnar wrote: > Yeah, so in the perf tooling build we do have -Wshadow to catch such mishaps, > but not in the main kernel build. > > ... and yes, if I add it via the patch below the bug gets warned about: > > include/linux/atomic.h:561:15: note: shadowed declaration is here > typeof(ptr) __ptr = (ptr); \ > ^ > kernel/sched/core.c:332:11: note: in expansion of macro ‘xchg_or’ > return !(xchg_or(&ti->flags, _TIF_NEED_RESCHED) & _TIF_POLLING_NRFLA > > ... but I also get a ton of other warnings, just when building a single > kernel/sched/core.o file: > > ./arch/x86/include/asm/bitops.h:396:28: warning: declaration of ‘ffs’ shadows a built-in function [-Wshadow] > ./arch/x86/include/asm/bitops.h:396:28: warning: declaration of ‘ffs’ shadows a built-in function [-Wshadow] > include/linux/jiffies.h:422:60: warning: declaration of ‘jiffies’ shadows a global declaration [-Wshadow] > ./arch/x86/include/asm/io_apic.h:187:54: warning: declaration of ‘apic’ shadows a global declaration [-Wshadow] > ./arch/x86/include/asm/bitops.h:396:28: warning: declaration of ‘ffs’ shadows a built-in function [-Wshadow] > include/linux/jiffies.h:422:60: warning: declaration of ‘jiffies’ shadows a global declaration [-Wshadow] > ./arch/x86/include/asm/io_apic.h:187:54: warning: declaration of ‘apic’ shadows a global declaration [-Wshadow] > include/linux/kernel.h:750:12: warning: declaration of ‘_min1’ shadows a previous local [-Wshadow] > include/linux/kernel.h:750:12: warning: declaration of ‘_min1’ shadows a previous local [-Wshadow] > include/linux/kernel.h:751:12: warning: declaration of ‘_min2’ shadows a previous local [-Wshadow] > kernel/sched/sched.h:308:43: warning: declaration of ‘down’ shadows a global declaration [-Wshadow] > kernel/sched/sched.h:308:60: warning: declaration of ‘up’ shadows a global declaration [-Wshadow] > kernel/sched/auto_group.h:44:55: warning: declaration of ‘init_task’ shadows a global declaration [-Wshadow] > kernel/sched/core.c:635:20: warning: declaration of ‘down’ shadows a global declaration [-Wshadow] > kernel/sched/core.c:635:37: warning: declaration of ‘up’ shadows a global declaration [-Wshadow] Heh, what else can we expect from global functions named up() and down() in a millions-lines C project :-) > > and yes, I'd say most of these are signatures of sloppy macros and sloppy variable > names - but it would be a ton of work to eliminate these warnings. Yeah that's what I was afraid of. Thanks for trying it though!