Skip to content

Commit e596c79

Browse files
committed
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6: (39 commits) Revert "namespace: add source file location exceptions" Coccinelle: Add contextual message Coccinelle: Fix documentation Coccinelle: Find doubled arguments to boolean or bit operators. Coccinelle: Find nested lock+irqsave functions that use the same flags variables. namespace: add source file location exceptions scripts/extract-ikconfig: add support for bzip2, lzma and lzo kbuild: check return value of asprintf() scripts/namespace.pl: improve to get more correct results scripts/namespace.pl: some bug fixes scripts/namespace.pl: update file exclusion list scripts/namespace.pl: fix wrong source path Coccinelle: Use the -no_show_diff option for org and report mode Coccinelle: Add a new mode named 'chain' Coccinelle: Use new comment format to explain kfree.cocci Coccinelle: Improve user information with a new kind of comment Coccinelle: Update documentation MAINTAINERS: Coccinelle: Update email address Documentation/kbuild: modules.txt cleanup Documentation/kbuild: major edit of modules.txt sections 5-8 ...
2 parents 51399a3 + 9231d9e commit e596c79

29 files changed

+1597
-476
lines changed

Documentation/coccinelle.txt

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ of many distributions, e.g. :
2424
You can get the latest version released from the Coccinelle homepage at
2525
http://coccinelle.lip6.fr/
2626

27+
Information and tips about Coccinelle are also provided on the wiki
28+
pages at http://cocci.ekstranet.diku.dk/wiki/doku.php
29+
2730
Once you have it, run the following command:
2831

2932
./configure
@@ -41,20 +44,22 @@ A Coccinelle-specific target is defined in the top level
4144
Makefile. This target is named 'coccicheck' and calls the 'coccicheck'
4245
front-end in the 'scripts' directory.
4346

44-
Four modes are defined: report, patch, context, and org. The mode to
47+
Four modes are defined: patch, report, context, and org. The mode to
4548
use is specified by setting the MODE variable with 'MODE=<mode>'.
4649

50+
'patch' proposes a fix, when possible.
51+
4752
'report' generates a list in the following format:
4853
file:line:column-column: message
4954

50-
'patch' proposes a fix, when possible.
51-
5255
'context' highlights lines of interest and their context in a
5356
diff-like style.Lines of interest are indicated with '-'.
5457

5558
'org' generates a report in the Org mode format of Emacs.
5659

57-
Note that not all semantic patches implement all modes.
60+
Note that not all semantic patches implement all modes. For easy use
61+
of Coccinelle, the default mode is "chain" which tries the previous
62+
modes in the order above until one succeeds.
5863

5964
To make a report for every semantic patch, run the following command:
6065

@@ -68,9 +73,9 @@ To produce patches, run:
6873

6974

7075
The coccicheck target applies every semantic patch available in the
71-
subdirectories of 'scripts/coccinelle' to the entire Linux kernel.
76+
sub-directories of 'scripts/coccinelle' to the entire Linux kernel.
7277

73-
For each semantic patch, a changelog message is proposed. It gives a
78+
For each semantic patch, a commit message is proposed. It gives a
7479
description of the problem being checked by the semantic patch, and
7580
includes a reference to Coccinelle.
7681

@@ -93,12 +98,35 @@ or
9398
make coccicheck COCCI=<my_SP.cocci> MODE=report
9499

95100

101+
Using Coccinelle on (modified) files
102+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
103+
104+
To apply Coccinelle on a file basis, instead of a directory basis, the
105+
following command may be used:
106+
107+
make C=1 CHECK="scripts/coccicheck"
108+
109+
To check only newly edited code, use the value 2 for the C flag, i.e.
110+
111+
make C=2 CHECK="scripts/coccicheck"
112+
113+
This runs every semantic patch in scripts/coccinelle by default. The
114+
COCCI variable may additionally be used to only apply a single
115+
semantic patch as shown in the previous section.
116+
117+
The "chain" mode is the default. You can select another one with the
118+
MODE variable explained above.
119+
120+
In this mode, there is no information about semantic patches
121+
displayed, and no commit message proposed.
122+
123+
96124
Proposing new semantic patches
97125
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98126

99127
New semantic patches can be proposed and submitted by kernel
100128
developers. For sake of clarity, they should be organized in the
101-
subdirectories of 'scripts/coccinelle/'.
129+
sub-directories of 'scripts/coccinelle/'.
102130

103131

104132
Detailed description of the 'report' mode
@@ -111,7 +139,7 @@ Example:
111139

112140
Running
113141

114-
make coccicheck MODE=report COCCI=scripts/coccinelle/err_cast.cocci
142+
make coccicheck MODE=report COCCI=scripts/coccinelle/api/err_cast.cocci
115143

116144
will execute the following part of the SmPL script.
117145

@@ -149,7 +177,7 @@ identified.
149177
Example:
150178

151179
Running
152-
make coccicheck MODE=patch COCCI=scripts/coccinelle/err_cast.cocci
180+
make coccicheck MODE=patch COCCI=scripts/coccinelle/api/err_cast.cocci
153181

154182
will execute the following part of the SmPL script.
155183

@@ -193,7 +221,7 @@ NOTE: The diff-like output generated is NOT an applicable patch. The
193221
Example:
194222

195223
Running
196-
make coccicheck MODE=context COCCI=scripts/coccinelle/err_cast.cocci
224+
make coccicheck MODE=context COCCI=scripts/coccinelle/api/err_cast.cocci
197225

198226
will execute the following part of the SmPL script.
199227

@@ -228,7 +256,7 @@ diff -u -p /home/user/linux/crypto/ctr.c /tmp/nothing
228256
Example:
229257

230258
Running
231-
make coccicheck MODE=org COCCI=scripts/coccinelle/err_cast.cocci
259+
make coccicheck MODE=org COCCI=scripts/coccinelle/api/err_cast.cocci
232260

233261
will execute the following part of the SmPL script.
234262

0 commit comments

Comments
 (0)