aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/coccinelle.txt
diff options
context:
space:
mode:
authorNicolas Palix <Nicolas.Palix@inria.fr>2010-10-12 18:49:07 -0400
committerMichal Marek <mmarek@suse.cz>2010-10-13 08:26:06 -0400
commit32af08987b8f093195f8eef3ee4e1dbcfee891cd (patch)
tree165d0a52c607c1ae7110625d8f1787bf761b0802 /Documentation/coccinelle.txt
parentaf78f217127dc0b6d364ca67ce128f7aafed99f9 (diff)
Coccinelle: Update documentation
- Add information about use of the C={1,2} make flag - Add a description of the new chain mode mechanism - Add a link to the wiki Signed-off-by: Nicolas Palix <npalix.work@gmail.com> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'Documentation/coccinelle.txt')
-rw-r--r--Documentation/coccinelle.txt42
1 files changed, 35 insertions, 7 deletions
diff --git a/Documentation/coccinelle.txt b/Documentation/coccinelle.txt
index cd2b02837066..de51a3eb17b3 100644
--- a/Documentation/coccinelle.txt
+++ b/Documentation/coccinelle.txt
@@ -24,6 +24,9 @@ of many distributions, e.g. :
24You can get the latest version released from the Coccinelle homepage at 24You can get the latest version released from the Coccinelle homepage at
25http://coccinelle.lip6.fr/ 25http://coccinelle.lip6.fr/
26 26
27Information and tips about Coccinelle are also provided on the wiki
28pages at http://cocci.ekstranet.diku.dk/wiki/doku.php
29
27Once you have it, run the following command: 30Once you have it, run the following command:
28 31
29 ./configure 32 ./configure
@@ -41,20 +44,22 @@ A Coccinelle-specific target is defined in the top level
41Makefile. This target is named 'coccicheck' and calls the 'coccicheck' 44Makefile. This target is named 'coccicheck' and calls the 'coccicheck'
42front-end in the 'scripts' directory. 45front-end in the 'scripts' directory.
43 46
44Four modes are defined: report, patch, context, and org. The mode to 47Four modes are defined: patch, report, context, and org. The mode to
45use is specified by setting the MODE variable with 'MODE=<mode>'. 48use is specified by setting the MODE variable with 'MODE=<mode>'.
46 49
50'patch' proposes a fix, when possible.
51
47'report' generates a list in the following format: 52'report' generates a list in the following format:
48 file:line:column-column: message 53 file:line:column-column: message
49 54
50'patch' proposes a fix, when possible.
51
52'context' highlights lines of interest and their context in a 55'context' highlights lines of interest and their context in a
53diff-like style.Lines of interest are indicated with '-'. 56diff-like style.Lines of interest are indicated with '-'.
54 57
55'org' generates a report in the Org mode format of Emacs. 58'org' generates a report in the Org mode format of Emacs.
56 59
57Note that not all semantic patches implement all modes. 60Note that not all semantic patches implement all modes. For easy use
61of Coccinelle, the default mode is "chain" which tries the previous
62modes in the order above until one succeeds.
58 63
59To make a report for every semantic patch, run the following command: 64To make a report for every semantic patch, run the following command:
60 65
@@ -68,9 +73,9 @@ To produce patches, run:
68 73
69 74
70The coccicheck target applies every semantic patch available in the 75The coccicheck target applies every semantic patch available in the
71subdirectories of 'scripts/coccinelle' to the entire Linux kernel. 76sub-directories of 'scripts/coccinelle' to the entire Linux kernel.
72 77
73For each semantic patch, a changelog message is proposed. It gives a 78For each semantic patch, a commit message is proposed. It gives a
74description of the problem being checked by the semantic patch, and 79description of the problem being checked by the semantic patch, and
75includes a reference to Coccinelle. 80includes a reference to Coccinelle.
76 81
@@ -93,12 +98,35 @@ or
93 make coccicheck COCCI=<my_SP.cocci> MODE=report 98 make coccicheck COCCI=<my_SP.cocci> MODE=report
94 99
95 100
101 Using Coccinelle on (modified) files
102~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
103
104To apply Coccinelle on a file basis, instead of a directory basis, the
105following command may be used:
106
107 make C=1 CHECK="scripts/coccicheck"
108
109To check only newly edited code, use the value 2 for the C flag, i.e.
110
111 make C=2 CHECK="scripts/coccicheck"
112
113This runs every semantic patch in scripts/coccinelle by default. The
114COCCI variable may additionally be used to only apply a single
115semantic patch as shown in the previous section.
116
117The "chain" mode is the default. You can select another one with the
118MODE variable explained above.
119
120In this mode, there is no information about semantic patches
121displayed, and no commit message proposed.
122
123
96 Proposing new semantic patches 124 Proposing new semantic patches
97~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 125~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98 126
99New semantic patches can be proposed and submitted by kernel 127New semantic patches can be proposed and submitted by kernel
100developers. For sake of clarity, they should be organized in the 128developers. For sake of clarity, they should be organized in the
101subdirectories of 'scripts/coccinelle/'. 129sub-directories of 'scripts/coccinelle/'.
102 130
103 131
104 Detailed description of the 'report' mode 132 Detailed description of the 'report' mode