Coccinelle release-1.0.0-rc11
[bpt/coccinelle.git] / parsing_cocci / test.cocci
CommitLineData
17ba0788
C
1// Copyright 2012, INRIA
2// Julia Lawall, Gilles Muller
3// Copyright 2010-2011, INRIA, University of Copenhagen
f537ebc4
C
4// Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix
5// Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
6// Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
7// This file is part of Coccinelle.
8//
9// Coccinelle is free software: you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation, according to version 2 of the License.
12//
13// Coccinelle is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
20//
21// The authors reserve the right to distribute this or future versions of
22// Coccinelle under other licenses.
23
24
34e49164
C
25@@
26struct SHT sht;
27local function proc_info_func;
28@@
29 sht.proc_info = proc_info_func;
30
31@@
32identifier buffer, start, offset, length, inout, hostptr, hostno;
33@@
34 proc_info_func (
35+ struct Scsi_Host *hostptr,
36 char *buffer, char **start, off_t offset, int length,
37- int hostno,
38 int inout) {
39 ...
40- struct Scsi_Host *hostptr;
41 ...
42- hostptr = scsi_host_hn_get(hostno);
43 ...
44?- if (!hostptr) { ... }
45 ...
46?- scsi_host_put(hostptr);
47 ...
48 }
49
50@@
51expression E;
52@@
53 proc_info_func(...) {
54 <...
55(
56\+- E->host_no == hostno
57+ E == shpnt
58|
59- hostno
60+ shpnt->host_no
61)
62 ...>
63 }
64
65@@
66struct foo E;
67@@
68 proc_info_func(...) {
69 <...
70(
71\+- E->host_no == hostno
72+ E == shpnt
73|
74- hostno
75+ shpnt->host_no
76)
77 ...>
78 }