Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753108AbYKLODI (ORCPT ); Wed, 12 Nov 2008 09:03:08 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751654AbYKLOC4 (ORCPT ); Wed, 12 Nov 2008 09:02:56 -0500 Received: from bigben2.bytemark.co.uk ([80.68.81.132]:49259 "EHLO bigben2.bytemark.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750995AbYKLOCz (ORCPT ); Wed, 12 Nov 2008 09:02:55 -0500 Date: Wed, 12 Nov 2008 14:02:50 +0000 From: Andy Whitcroft To: Mike Frysinger Cc: Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH] checkpatch: try to catch missing VMLINUX_SYMBOL() in vmlinux.lds.h Message-ID: <20081112140250.GF8302@shadowen.org> References: <1226184965-13502-1-git-send-email-vapier@gentoo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1226184965-13502-1-git-send-email-vapier@gentoo.org> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1908 Lines: 52 On Sat, Nov 08, 2008 at 05:56:05PM -0500, Mike Frysinger wrote: > Seems like every other release we have someone who updates vmlinux.lds.h and > adds C-visible symbols without VMLINUX_SYMBOL() around them. So start > checking the file and only allow assignments that use one of the following > symbols on a side: > . > ALIGN(...) > VMLINUX_SYMBOL(...) > > Signed-off-by: Mike Frysinger > --- > scripts/checkpatch.pl | 13 +++++++++++++ > 1 files changed, 13 insertions(+), 0 deletions(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index f88bb3e..8e96b42 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -2189,6 +2189,19 @@ sub process { > } > } > > +# make sure symbols are always wrapped with VMLINUX_SYMBOL() ... > +# all assignments may have only one of the following with an assignment: > +# . > +# ALIGN(...) > +# VMLINUX_SYMBOL(...) > + if ($realfile =~ /vmlinux.lds.h$/) { > + if ($line =~ /=/ && > + !($line =~ /([.]|(ALIGN|VMLINUX_SYMBOL)[(][^=]*[)])\s*=\s*([.]|(ALIGN|VMLINUX_SYMBOL)[(][^=]*[)])/)) > + { > + WARN("vmlinux.lds.h needs VMLINUX_SYMBOL() around C-visible symbols\n" . $herecurr); > + } > + } > + > # check for redundant bracing round if etc > if ($line =~ /(^.*)\bif\b/ && $1 !~ /else\s*$/) { > my ($level, $endln, @chunks) = > -- Ok, that seems like a sane check. I think what we are really wanting to check for is assigments with plain identifiers on either side? I've pushed a softened version of this check to my tree for testing. http://www.kernel.org/pub/linux/kernel/people/apw/checkpatch/checkpatch.pl-testing -apw -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/