From patchwork Mon Apr 26 21:11:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Palix X-Patchwork-Id: 95201 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3QLDL91031180 for ; Mon, 26 Apr 2010 21:13:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753664Ab0DZVL7 (ORCPT ); Mon, 26 Apr 2010 17:11:59 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:50064 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754690Ab0DZVL5 (ORCPT ); Mon, 26 Apr 2010 17:11:57 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id 922FF19BB64; Mon, 26 Apr 2010 23:11:56 +0200 (CEST) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 30925-01; Mon, 26 Apr 2010 23:11:52 +0200 (CEST) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw2.diku.dk (Postfix) with ESMTP id 1B66619BB61; Mon, 26 Apr 2010 23:11:52 +0200 (CEST) Received: from localhost.localdomain (tyr.diku.dk [130.225.96.226]) by nhugin.diku.dk (Postfix) with ESMTP id F0FD56DFC49; Mon, 26 Apr 2010 23:05:03 +0200 (CEST) From: Nicolas Palix To: Andrew Morton , Joe Perches , "David S. Miller" , Michal Marek , Sam Ravnborg , Julia Lawall , Gilles Muller , Nicolas Palix , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, cocci@diku.dk Subject: [PATCH 1/4] Add targets to use the Coccinelle checker Date: Mon, 26 Apr 2010 23:11:16 +0200 Message-Id: <1272316279-12042-2-git-send-email-npalix@diku.dk> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1272316279-12042-1-git-send-email-npalix@diku.dk> References: <1272316279-12042-1-git-send-email-npalix@diku.dk> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 26 Apr 2010 21:13:22 +0000 (UTC) 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 +M: Gilles Muller +M: Nicolas Palix +L: cocci@diku.dk +W: http://coccinelle.lip6.fr/ +S: Supported +F: scripts/smpl/ +F: scripts/spatch.sh + CODA FILE SYSTEM M: Jan Harkes 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|" +$SPATCH -D $MODE -very_quiet -sp_file $COCCI $OPT -dir $DIR