mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Andy Whitcroft <apw@shadowen.org>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] checkpatch: try to catch missing VMLINUX_SYMBOL() in vmlinux.lds.h
Date: Sun, 16 Nov 2008 07:06:34 -0500	[thread overview]
Message-ID: <200811160706.34901.vapier@gentoo.org> (raw)
In-Reply-To: <20081112140250.GF8302@shadowen.org>

On Wednesday 12 November 2008 09:02:50 Andy Whitcroft wrote:
> 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 <vapier@gentoo.org>
> > ---
> >  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

perl isnt my thing so i'm going to assume what you added does as intended (i 
dont really get the regex statement you've added)

all i was using to test was to edit the file and remove VMLINUX_SYMBOL() from 
a place or two and then do:
diff -Nur /dev/null include/asm-generic/vmlinux.lds.h | 
./scripts/checkpatch.pl

thanks for adding this ... it'll save me consistent pain :)
-mike


      reply	other threads:[~2008-11-16 12:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-08 22:56 Mike Frysinger
2008-11-12 14:02 ` Andy Whitcroft
2008-11-16 12:06   ` Mike Frysinger [this message]

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=200811160706.34901.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®