linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang@pengutronix.de>
To: Nicolas Palix <npalix@diku.dk>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Joe Perches <joe@perches.com>,
	"David S. Miller" <davem@davemloft.net>,
	Michal Marek <mmarek@suse.cz>, Sam Ravnborg <sam@ravnborg.org>,
	Julia Lawall <julia@diku.dk>,
	Gilles Muller <Gilles.Muller@lip6.fr>,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	cocci@diku.dk
Subject: Re: [PATCH 1/4] Add targets to use the Coccinelle checker
Date: Tue, 27 Apr 2010 14:53:34 +0200	[thread overview]
Message-ID: <20100427125334.GE1775@pengutronix.de> (raw)
In-Reply-To: <1272316279-12042-2-git-send-email-npalix@diku.dk>

[-- Attachment #1: Type: text/plain, Size: 3436 bytes --]

On Mon, Apr 26, 2010 at 11:11:16PM +0200, Nicolas Palix wrote:
> Four targets are added. Each one generates a different
> output kind: context, patch, org, report.
> Every SmPL file in 'scripts/smpl' is given to the spatch frontend
> (located in the 'scripts' directory), and applied to the entire
> source tree.
> 
> Signed-off-by: Nicolas Palix <npalix@diku.dk>
> ---
>  MAINTAINERS       |   10 ++++++++++
>  Makefile          |    9 +++++++++
>  scripts/spatch.sh |   14 ++++++++++++++
>  3 files changed, 33 insertions(+), 0 deletions(-)
>  create mode 100755 scripts/spatch.sh
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3d29fa3..2aab763 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1533,6 +1533,16 @@ L:	platform-driver-x86@vger.kernel.org
>  S:	Supported
>  F:	drivers/platform/x86/classmate-laptop.c
>  
> +COCCINELLE
> +M:	Julia Lawall <julia@diku.dk>
> +M:	Gilles Muller <Gilles.Muller@lip6.fr>
> +M:	Nicolas Palix <npalix@diku.dk>
> +L:	cocci@diku.dk
> +W:	http://coccinelle.lip6.fr/
> +S:	Supported
> +F:	scripts/smpl/
> +F:	scripts/spatch.sh
> +
>  CODA FILE SYSTEM
>  M:	Jan Harkes <jaharkes@cs.cmu.edu>
>  M:	coda@cs.cmu.edu
> diff --git a/Makefile b/Makefile
> index 67c1001..293c88b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -325,6 +325,7 @@ INSTALLKERNEL  := installkernel
>  DEPMOD		= /sbin/depmod
>  KALLSYMS	= scripts/kallsyms
>  PERL		= perl
> +SPATCH          = spatch
>  CHECK		= sparse
>  
>  CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
> @@ -1424,6 +1425,14 @@ versioncheck:
>  		-name '*.[hcS]' -type f -print | sort \
>  		| xargs $(PERL) -w $(srctree)/scripts/checkversion.pl
>  
> +coccicheck-context coccicheck-patch coccicheck-org coccicheck-report:
> +	@echo "\nPlease, check for false positive in the output before submitting a patch.\n\n"\
> +		"Take particularly attention when using the \"patch\" mode\n"\
> +		"and carefully review the patch YOU are about to submit.\n"
> +	@find $(srctree)/scripts/smpl/                        \
> +		-name '*.cocci' -type f                       \
> +		-exec $(srctree)/scripts/spatch.sh $(SPATCH) $(@:coccicheck-%=%) \{} $(srctree) \;
> +
>  namespacecheck:
>  	$(PERL) $(srctree)/scripts/namespace.pl
>  
> diff --git a/scripts/spatch.sh b/scripts/spatch.sh
> new file mode 100755
> index 0000000..bdcca15
> --- /dev/null
> +++ b/scripts/spatch.sh
> @@ -0,0 +1,14 @@
> +#!/bin/sh
> +
> +SPATCH="$1"
> +MODE="$2"
> +COCCI="$3"
> +DIR="$4"
> +
> +OPT=`grep "Option" $COCCI | cut -d':' -f2`
> +FILE=`echo $COCCI | sed "s|$DIR/||"`
> +
> +echo Processing `basename $COCCI` with \"$OPT\"
> +echo Message example to submit a patch:
> +grep "^///" $COCCI | sed "s|///||" | sed "s|THISFILE|$FILE|"

I think the part containing "THISFILE" the patches should be generated here at
runtime. Also, the grep-command can be done via sed.

> +$SPATCH -D $MODE -very_quiet -sp_file $COCCI $OPT -dir $DIR
> -- 
> 1.6.3.3
> 
> --
> 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/

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  parent reply	other threads:[~2010-04-27 12:53 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-26 21:11 [PATCH 0/4] Add a Coccinelle front-end script Nicolas Palix
2010-04-26 21:11 ` [PATCH 1/4] Add targets to use the Coccinelle checker Nicolas Palix
2010-04-26 21:37   ` Joe Perches
2010-04-26 22:20     ` Nicolas Palix
2010-04-26 22:23       ` Randy Dunlap
2010-04-29 17:01         ` Roland Dreier
2010-04-30 21:07           ` Randy Dunlap
2010-04-27 12:40       ` Michal Marek
2010-04-27 13:01       ` Michal Marek
2010-04-27 12:53   ` Wolfram Sang [this message]
2010-04-27 20:24   ` Sam Ravnborg
2010-04-27 20:28     ` Sam Ravnborg
2010-04-26 21:11 ` [PATCH 2/4] Add scripts/smpl/drop_kmalloc_cast.cocci Nicolas Palix
2010-04-26 21:11 ` [PATCH 3/4] Add scripts/smpl/kzalloc-simple.cocci Nicolas Palix
2010-04-26 21:11 ` [PATCH 4/4] Add scripts/smpl/resource_size.cocci Nicolas Palix
2010-04-27 12:50 ` [PATCH 0/4] Add a Coccinelle front-end script Wolfram Sang
2010-04-27 12:53   ` Julia Lawall
  -- strict thread matches above, loose matches on Subject: below --
2010-05-10 16:24 Nicolas Palix
2010-05-10 16:24 ` [PATCH 1/4] Add targets to use the Coccinelle checker Nicolas Palix
2010-05-12  6:42   ` Américo Wang
2010-05-28  7:04     ` Joerg Roedel
2010-06-03  9:50   ` Michal Marek
2010-06-03 10:23   ` Sam Ravnborg
2010-06-04  9:56     ` Nicolas Palix
2010-06-04 10:38       ` Sam Ravnborg

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=20100427125334.GE1775@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=Gilles.Muller@lip6.fr \
    --cc=akpm@linux-foundation.org \
    --cc=cocci@diku.dk \
    --cc=davem@davemloft.net \
    --cc=joe@perches.com \
    --cc=julia@diku.dk \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=npalix@diku.dk \
    --cc=sam@ravnborg.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;
as well as URLs for NNTP newsgroup(s).