diff options
author | Nicolas Palix <nicolas.palix@imag.fr> | 2013-06-20 08:00:19 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2013-07-03 09:41:02 -0400 |
commit | 78a95b9b4b3dcb53736a1834e8557d3e1668562a (patch) | |
tree | ff5ae582ffef7d0ad009988e0da5d1b328cc5da9 /Documentation/coccinelle.txt | |
parent | 4b92b2aa98d917a379512b82cf94ea1ffcfc97af (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.txt | 39 |
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 | |||
48 | Makefile. This target is named 'coccicheck' and calls the 'coccicheck' | 48 | Makefile. This target is named 'coccicheck' and calls the 'coccicheck' |
49 | front-end in the 'scripts' directory. | 49 | front-end in the 'scripts' directory. |
50 | 50 | ||
51 | Four modes are defined: patch, report, context, and org. The mode to | 51 | Four basic modes are defined: patch, report, context, and org. The mode to |
52 | use is specified by setting the MODE variable with 'MODE=<mode>'. | 52 | use 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 | ||
64 | Note that not all semantic patches implement all modes. For easy use | 64 | Note that not all semantic patches implement all modes. For easy use |
65 | of Coccinelle, the default mode is "chain" which tries the previous | 65 | of Coccinelle, the default mode is "report". |
66 | modes in the order above until one succeeds. | ||
67 | 66 | ||
68 | To make a report for every semantic patch, run the following command: | 67 | Two 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 | ||
72 | NB: 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 | ||
74 | To produce patches, run: | 75 | Examples: |
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 | ||
79 | The coccicheck target applies every semantic patch available in the | 85 | The 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 | ||
138 | In these modes, which works on a file basis, there is no information | ||
139 | about semantic patches displayed, and no commit message proposed. | ||
140 | |||
132 | This runs every semantic patch in scripts/coccinelle by default. The | 141 | This runs every semantic patch in scripts/coccinelle by default. The |
133 | COCCI variable may additionally be used to only apply a single | 142 | COCCI variable may additionally be used to only apply a single |
134 | semantic patch as shown in the previous section. | 143 | semantic patch as shown in the previous section. |
135 | 144 | ||
136 | The "chain" mode is the default. You can select another one with the | 145 | The "report" mode is the default. You can select another one with the |
137 | MODE variable explained above. | 146 | MODE variable explained above. |
138 | 147 | ||
139 | In this mode, there is no information about semantic patches | ||
140 | displayed, and no commit message proposed. | ||
141 | |||
142 | Additional flags | 148 | Additional flags |
143 | ~~~~~~~~~~~~~~~~~~ | 149 | ~~~~~~~~~~~~~~~~~~ |
144 | 150 | ||
145 | Additional flags can be passed to spatch through the SPFLAGS | 151 | Additional flags can be passed to spatch through the SPFLAGS |
146 | variable. | 152 | variable. |
147 | 153 | ||
148 | make SPFLAGS=--use_glimpse coccicheck | 154 | make SPFLAGS=--use-glimpse coccicheck |
155 | make SPFLAGS=--use-idutils coccicheck | ||
149 | 156 | ||
150 | See spatch --help to learn more about spatch options. | 157 | See spatch --help to learn more about spatch options. |
151 | 158 | ||
159 | Note that the '--use-glimpse' and '--use-idutils' options | ||
160 | require external tools for indexing the code. None of them is | ||
161 | thus active by default. However, by indexing the code with | ||
162 | one of these tools, and according to the cocci file used, | ||
163 | spatch could proceed the entire code base more quickly. | ||
164 | |||
152 | Proposing new semantic patches | 165 | Proposing new semantic patches |
153 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 166 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
154 | 167 | ||