Commit 78a95b9b authored by Nicolas Palix's avatar Nicolas Palix Committed by Michal Marek

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: default avatarNicolas Palix <nicolas.palix@imag.fr>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
parent 4b92b2aa
...@@ -48,7 +48,7 @@ A Coccinelle-specific target is defined in the top level ...@@ -48,7 +48,7 @@ A Coccinelle-specific target is defined in the top level
Makefile. This target is named 'coccicheck' and calls the 'coccicheck' Makefile. This target is named 'coccicheck' and calls the 'coccicheck'
front-end in the 'scripts' directory. front-end in the 'scripts' directory.
Four modes are defined: patch, report, context, and org. The mode to Four basic modes are defined: patch, report, context, and org. The mode to
use is specified by setting the MODE variable with 'MODE=<mode>'. use is specified by setting the MODE variable with 'MODE=<mode>'.
'patch' proposes a fix, when possible. 'patch' proposes a fix, when possible.
...@@ -62,16 +62,22 @@ diff-like style.Lines of interest are indicated with '-'. ...@@ -62,16 +62,22 @@ diff-like style.Lines of interest are indicated with '-'.
'org' generates a report in the Org mode format of Emacs. 'org' generates a report in the Org mode format of Emacs.
Note that not all semantic patches implement all modes. For easy use Note that not all semantic patches implement all modes. For easy use
of Coccinelle, the default mode is "chain" which tries the previous of Coccinelle, the default mode is "report".
modes in the order above until one succeeds.
To make a report for every semantic patch, run the following command: Two other modes provide some common combinations of these modes.
make coccicheck MODE=report 'chain' tries the previous modes in the order above until one succeeds.
'rep+ctxt' runs successively the report mode and the context mode.
It should be used with the C option (described later)
which checks the code on a file basis.
NB: The 'report' mode is the default one. Examples:
To make a report for every semantic patch, run the following command:
make coccicheck MODE=report
To produce patches, run: To produce patches, run:
make coccicheck MODE=patch make coccicheck MODE=patch
...@@ -129,26 +135,33 @@ To check only newly edited code, use the value 2 for the C flag, i.e. ...@@ -129,26 +135,33 @@ To check only newly edited code, use the value 2 for the C flag, i.e.
make C=2 CHECK="scripts/coccicheck" make C=2 CHECK="scripts/coccicheck"
In these modes, which works on a file basis, there is no information
about semantic patches displayed, and no commit message proposed.
This runs every semantic patch in scripts/coccinelle by default. The This runs every semantic patch in scripts/coccinelle by default. The
COCCI variable may additionally be used to only apply a single COCCI variable may additionally be used to only apply a single
semantic patch as shown in the previous section. semantic patch as shown in the previous section.
The "chain" mode is the default. You can select another one with the The "report" mode is the default. You can select another one with the
MODE variable explained above. MODE variable explained above.
In this mode, there is no information about semantic patches
displayed, and no commit message proposed.
Additional flags Additional flags
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
Additional flags can be passed to spatch through the SPFLAGS Additional flags can be passed to spatch through the SPFLAGS
variable. variable.
make SPFLAGS=--use_glimpse coccicheck make SPFLAGS=--use-glimpse coccicheck
make SPFLAGS=--use-idutils coccicheck
See spatch --help to learn more about spatch options. See spatch --help to learn more about spatch options.
Note that the '--use-glimpse' and '--use-idutils' options
require external tools for indexing the code. None of them is
thus active by default. However, by indexing the code with
one of these tools, and according to the cocci file used,
spatch could proceed the entire code base more quickly.
Proposing new semantic patches Proposing new semantic patches
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment