diff options
| author | Nicolas Palix <Nicolas.Palix@inria.fr> | 2010-10-12 18:49:07 -0400 |
|---|---|---|
| committer | Michal Marek <mmarek@suse.cz> | 2010-10-13 08:26:06 -0400 |
| commit | 32af08987b8f093195f8eef3ee4e1dbcfee891cd (patch) | |
| tree | 165d0a52c607c1ae7110625d8f1787bf761b0802 | |
| parent | af78f217127dc0b6d364ca67ce128f7aafed99f9 (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>
| -rw-r--r-- | Documentation/coccinelle.txt | 42 |
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. : | |||
| 24 | You can get the latest version released from the Coccinelle homepage at | 24 | You can get the latest version released from the Coccinelle homepage at |
| 25 | http://coccinelle.lip6.fr/ | 25 | http://coccinelle.lip6.fr/ |
| 26 | 26 | ||
| 27 | Information and tips about Coccinelle are also provided on the wiki | ||
| 28 | pages at http://cocci.ekstranet.diku.dk/wiki/doku.php | ||
| 29 | |||
| 27 | Once you have it, run the following command: | 30 | Once 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 | |||
| 41 | Makefile. This target is named 'coccicheck' and calls the 'coccicheck' | 44 | Makefile. This target is named 'coccicheck' and calls the 'coccicheck' |
| 42 | front-end in the 'scripts' directory. | 45 | front-end in the 'scripts' directory. |
| 43 | 46 | ||
| 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 |
| 45 | use is specified by setting the MODE variable with 'MODE=<mode>'. | 48 | use 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 |
| 53 | diff-like style.Lines of interest are indicated with '-'. | 56 | diff-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 | ||
| 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. | ||
| 58 | 63 | ||
| 59 | To make a report for every semantic patch, run the following command: | 64 | To 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 | ||
| 70 | The coccicheck target applies every semantic patch available in the | 75 | 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. |
| 72 | 77 | ||
| 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 |
| 74 | description of the problem being checked by the semantic patch, and | 79 | description of the problem being checked by the semantic patch, and |
| 75 | includes a reference to Coccinelle. | 80 | includes 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 | |||
| 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 | |||
| 96 | Proposing new semantic patches | 124 | Proposing new semantic patches |
| 97 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 125 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 98 | 126 | ||
| 99 | New semantic patches can be proposed and submitted by kernel | 127 | New semantic patches can be proposed and submitted by kernel |
| 100 | developers. For sake of clarity, they should be organized in the | 128 | developers. For sake of clarity, they should be organized in the |
| 101 | subdirectories of 'scripts/coccinelle/'. | 129 | sub-directories of 'scripts/coccinelle/'. |
| 102 | 130 | ||
| 103 | 131 | ||
| 104 | Detailed description of the 'report' mode | 132 | Detailed description of the 'report' mode |
