mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@shadowen.org>
To: Mike Frysinger <vapier@gentoo.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: Wed, 12 Nov 2008 14:02:50 +0000	[thread overview]
Message-ID: <20081112140250.GF8302@shadowen.org> (raw)
In-Reply-To: <1226184965-13502-1-git-send-email-vapier@gentoo.org>

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

-apw

  reply	other threads:[~2008-11-12 14:03 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 [this message]
2008-11-16 12:06   ` Mike Frysinger

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