permit multiline comments and strings in macros
[bpt/coccinelle.git] / demos / proc_info.cocci
CommitLineData
34e49164
C
1@ rule1 @
2identifier buffer, start, offset, length, inout, hostno;
3identifier hostptr;
4identifier proc_info_func;
5@@
6 proc_info_func (
7+ struct Scsi_Host *hostptr,
8 char *buffer, char **start, off_t offset, int length,
9- int hostno,
10 int inout) {
11 ...
12- struct Scsi_Host *hostptr;
13 ...
14- hostptr = scsi_host_hn_get(hostno);
15 ...
16?- if (!hostptr) { ... return ...; }
17 ...
18?- scsi_host_put(hostptr);
19 ...
20 }
21
22//alt:
23//- proc_info_func(char *buffer, char **start, off_t offset, int length,
24//- int hostno, int inout)
25//+ proc_info_func(struct Scsi_Host *hostptr, char *buffer, char **start,
26//+ off_t offset, int length, int inout)
27//{
28
29
30
31@@
32identifier rule1.proc_info_func;
33identifier rule1.hostno;
34@@
35 proc_info_func(...) {
36 <...
37- hostno
38+ hostptr->host_no
39 ...>
40 }
41
42@@
43identifier func;
44expression buffer, start, offset, length, inout, hostno;
45identifier hostptr;
46identifier rule1.proc_info_func;
47@@
48
49 func(..., struct Scsi_Host *hostptr, ...) {
50 <...
51 proc_info_func(
52+ hostptr,
53 buffer, start, offset, length,
54- hostno,
55 inout)
56 ...>
57 }