Coccinelle archive on lore.kernel.org
 help / color / Atom feed
From: zhongshiqi <zhong.shiqi@zte.com.cn>
To: Julia.Lawall@lip6.fr
Cc: wang.yi59@zte.com.cn, michal.lkml@markovi.net, corbet@lwn.net,
	linux-doc@vger.kernel.org, nicolas.palix@imag.fr,
	linux-kernel@vger.kernel.org, xue.zhihong@zte.com.cn,
	cheng.shengyu@zte.com.cn, zhongshiqi <zhong.shiqi@zte.com.cn>,
	cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH v6] coccicheck: Support search for SmPL scripts within selected directory hierarchy
Date: Mon, 4 Nov 2019 11:35:55 +0800
Message-ID: <1572838555-12101-1-git-send-email-zhong.shiqi@zte.com.cn> (raw)

*Allow defining the environment variable “COCCI” as a directory to
search SmPL scripts.

*Start a corresponding file determination if it contains an acceptable
path.

*Update coccinelle.rst documents for use coccicheck with a directory
selection

Signed-off-by: zhongshiqi <zhong.shiqi@zte.com.cn>
---
Changes in v6:
	update coccinelle.rst documents and add instructions for use this

Changes in v5:
	rewrite change description as an enumeration

Changes in v4:
	rewrite change description in another wording

Changes in v3:
	1:rewrite change description
	2:fix patch subject
	3:modify commit log

Changes in v2:
	1.fix patch subject according to the reply by Markus
	<Markus.Elfring@web.de>
	2.change description in “imperative mood”

 Documentation/dev-tools/coccinelle.rst | 51 ++++++++++++++++++++++------------
 scripts/coccicheck                     |  4 +++
 2 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/Documentation/dev-tools/coccinelle.rst b/Documentation/dev-tools/coccinelle.rst
index 00a3409..6af3201 100644
--- a/Documentation/dev-tools/coccinelle.rst
+++ b/Documentation/dev-tools/coccinelle.rst
@@ -100,8 +100,8 @@ Two other modes provide some common combinations of these modes.
   It should be used with the C option (described later)
   which checks the code on a file basis.
 
-Examples
-~~~~~~~~
+Using Coccinelle with defalut value
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 To make a report for every semantic patch, run the following command::
 
@@ -127,6 +127,38 @@ To enable verbose messages set the V= variable, for example::
 
    make coccicheck MODE=report V=1
 
+Using Coccinelle with a single file selection
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The optional make variable COCCI can be used to check a single
+semantic patch. In that case, the variable must be initialized with
+the name of the semantic patch to apply.
+
+For instance::
+
+	make coccicheck COCCI=<my_SP.cocci> MODE=patch
+
+or::
+
+	make coccicheck COCCI=<my_SP.cocci> MODE=report
+
+
+Using Coccinelle with directory selection
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The optional make variable COCCI can be used to search SmPL scripts in a
+directory. In that case, the variable must be initialized with the name of
+a directory which contains scripts for the semantic patch language.
+
+For instance::
+
+	make coccicheck COCCI=<my_SPDIR> MODE=patch
+
+or::
+
+	make coccicheck COCCI=<my_SPDIR> MODE=report
+
+
 Coccinelle parallelization
 ---------------------------
 
@@ -148,21 +180,6 @@ When parmap is enabled, if an error occurs in Coccinelle, this error
 value is propagated back, the return value of the ``make coccicheck``
 captures this return value.
 
-Using Coccinelle with a single semantic patch
----------------------------------------------
-
-The optional make variable COCCI can be used to check a single
-semantic patch. In that case, the variable must be initialized with
-the name of the semantic patch to apply.
-
-For instance::
-
-	make coccicheck COCCI=<my_SP.cocci> MODE=patch
-
-or::
-
-	make coccicheck COCCI=<my_SP.cocci> MODE=report
-
 
 Controlling Which Files are Processed by Coccinelle
 ---------------------------------------------------
diff --git a/scripts/coccicheck b/scripts/coccicheck
index e04d328..bfe0c94 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -257,6 +257,10 @@ if [ "$COCCI" = "" ] ; then
     for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
 	coccinelle $f
     done
+elif [ -d "$COCCI" ] ; then
+    for f in `find $COCCI/ -name '*.cocci' -type f | sort`; do
+       coccinelle $f
+    done
 else
     coccinelle $COCCI
 fi
-- 
2.9.5

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

             reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-04  3:35 zhongshiqi [this message]
2019-11-04 15:40 ` Markus Elfring

Reply instructions:

You may reply publically 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=1572838555-12101-1-git-send-email-zhong.shiqi@zte.com.cn \
    --to=zhong.shiqi@zte.com.cn \
    --cc=Julia.Lawall@lip6.fr \
    --cc=cheng.shengyu@zte.com.cn \
    --cc=cocci@systeme.lip6.fr \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=nicolas.palix@imag.fr \
    --cc=wang.yi59@zte.com.cn \
    --cc=xue.zhihong@zte.com.cn \
    /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

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr
	public-inbox-index cocci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git