aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/coccinelle.txt
diff options
context:
space:
mode:
authorNicolas Palix <nicolas.palix@imag.fr>2013-06-20 08:00:19 -0400
committerMichal Marek <mmarek@suse.cz>2013-07-03 09:41:02 -0400
commit78a95b9b4b3dcb53736a1834e8557d3e1668562a (patch)
treeff5ae582ffef7d0ad009988e0da5d1b328cc5da9 /Documentation/coccinelle.txt
parent4b92b2aa98d917a379512b82cf94ea1ffcfc97af (diff)
Coccinelle: Update the documentation
- The new default mode is 'report'. - The available modes are detailed a bit more. - Some information about the use of spatch options are also given concerning the use of indexing tools. Signed-off-by: Nicolas Palix <nicolas.palix@imag.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'Documentation/coccinelle.txt')
-rw-r--r--Documentation/coccinelle.txt39
1 files changed, 26 insertions, 13 deletions
diff --git a/Documentation/coccinelle.txt b/Documentation/coccinelle.txt
index 408439d07889..81a329fcd532 100644
--- a/Documentation/coccinelle.txt
+++ b/Documentation/coccinelle.txt
@@ -48,7 +48,7 @@ A Coccinelle-specific target is defined in the top level
48Makefile. This target is named 'coccicheck' and calls the 'coccicheck' 48Makefile. This target is named 'coccicheck' and calls the 'coccicheck'
49front-end in the 'scripts' directory. 49front-end in the 'scripts' directory.
50 50
51Four modes are defined: patch, report, context, and org. The mode to 51Four basic modes are defined: patch, report, context, and org. The mode to
52use is specified by setting the MODE variable with 'MODE=<mode>'. 52use is specified by setting the MODE variable with 'MODE=<mode>'.
53 53
54'patch' proposes a fix, when possible. 54'patch' proposes a fix, when possible.
@@ -62,18 +62,24 @@ diff-like style.Lines of interest are indicated with '-'.
62'org' generates a report in the Org mode format of Emacs. 62'org' generates a report in the Org mode format of Emacs.
63 63
64Note that not all semantic patches implement all modes. For easy use 64Note that not all semantic patches implement all modes. For easy use
65of Coccinelle, the default mode is "chain" which tries the previous 65of Coccinelle, the default mode is "report".
66modes in the order above until one succeeds.
67 66
68To make a report for every semantic patch, run the following command: 67Two other modes provide some common combinations of these modes.
69 68
70 make coccicheck MODE=report 69'chain' tries the previous modes in the order above until one succeeds.
71 70
72NB: The 'report' mode is the default one. 71'rep+ctxt' runs successively the report mode and the context mode.
72 It should be used with the C option (described later)
73 which checks the code on a file basis.
73 74
74To produce patches, run: 75Examples:
76 To make a report for every semantic patch, run the following command:
75 77
76 make coccicheck MODE=patch 78 make coccicheck MODE=report
79
80 To produce patches, run:
81
82 make coccicheck MODE=patch
77 83
78 84
79The coccicheck target applies every semantic patch available in the 85The coccicheck target applies every semantic patch available in the
@@ -129,26 +135,33 @@ To check only newly edited code, use the value 2 for the C flag, i.e.
129 135
130 make C=2 CHECK="scripts/coccicheck" 136 make C=2 CHECK="scripts/coccicheck"
131 137
138In these modes, which works on a file basis, there is no information
139about semantic patches displayed, and no commit message proposed.
140
132This runs every semantic patch in scripts/coccinelle by default. The 141This runs every semantic patch in scripts/coccinelle by default. The
133COCCI variable may additionally be used to only apply a single 142COCCI variable may additionally be used to only apply a single
134semantic patch as shown in the previous section. 143semantic patch as shown in the previous section.
135 144
136The "chain" mode is the default. You can select another one with the 145The "report" mode is the default. You can select another one with the
137MODE variable explained above. 146MODE variable explained above.
138 147
139In this mode, there is no information about semantic patches
140displayed, and no commit message proposed.
141
142 Additional flags 148 Additional flags
143~~~~~~~~~~~~~~~~~~ 149~~~~~~~~~~~~~~~~~~
144 150
145Additional flags can be passed to spatch through the SPFLAGS 151Additional flags can be passed to spatch through the SPFLAGS
146variable. 152variable.
147 153
148 make SPFLAGS=--use_glimpse coccicheck 154 make SPFLAGS=--use-glimpse coccicheck
155 make SPFLAGS=--use-idutils coccicheck
149 156
150See spatch --help to learn more about spatch options. 157See spatch --help to learn more about spatch options.
151 158
159Note that the '--use-glimpse' and '--use-idutils' options
160require external tools for indexing the code. None of them is
161thus active by default. However, by indexing the code with
162one of these tools, and according to the cocci file used,
163spatch could proceed the entire code base more quickly.
164
152 Proposing new semantic patches 165 Proposing new semantic patches
153~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 166~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
154 167