| 1 |
Examples |
| 2 |
============== |
| 3 |
|
| 4 |
Each example has four corresponding files: |
| 5 |
|
| 6 |
- name.c: C source file that returns matches/patches for the corresponding cocci file. Can be tested with |
| 7 |
|
| 8 |
spatch --sp-file name.cocci name.c |
| 9 |
|
| 10 |
- name.cocci: simple, unhardened Coccinelle script. |
| 11 |
- name.config: spgen configuration file for specifying preface and rule information. |
| 12 |
- name_.cocci: expected output when running spgen on the unhardened Coccinelle script with the config file. Should be a valid, hardened Coccinelle script. Can be tested on the C file with e.g. |
| 13 |
|
| 14 |
spatch --sp-file name_.cocci name.c -D report --no-show-diff |
| 15 |
|
| 16 |
Examples: |
| 17 |
|
| 18 |
- addvoid: minimal patch example |
| 19 |
- context: context example (all others are patches) |
| 20 |
- disj: example of using spgen on a rule with pattern-matching disjunctions |
| 21 |
- inherited: example of metavariable inheritance and usage for printing modes |