Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Multiple .so support for region snapshots
[simgrid.git] / src / smpi / replace_static.cocci
1 // FIXME: why can't I just define a static local vardecl the same way as a
2 // normal local vardecl?
3
4 // Function prototype looks like variable dec, but has parentheses
5 @funcproto@
6 type T;
7 identifier func;
8 position p;
9 @@
10 T@p func(...);
11
12 // Define a local variable as one whose declaration is encased in brackets
13 @localvardecl@
14 type T;
15 identifier var;
16 position p;
17 expression E;
18 @@
19 {
20 <...
21 (
22 T@p
23 var
24 ;
25 |
26 T@p
27 var = E
28 ;
29 )
30 ...>
31 }
32
33 // global variable is one whose declaration is neither local nor a function
34 // prototype
35 @globalvardecl@
36 type T;
37 identifier var;
38 position p != { localvardecl.p, funcproto.p };
39 expression value;
40 // expression size;
41 @@
42 (
43 T@p var;
44 |
45 T@p var = value;
46 )
47
48 // local static decl is a nonglobal static decl...
49 @localstaticvardecl@
50 type T;
51 identifier var;
52 position p != globalvardecl.p;
53 expression value;
54 @@
55 (
56 static T@p
57 - var
58 + *var = SMPI_VARINIT_STATIC(var, T)
59 ;
60 |
61 static T@p
62 - var = value
63 + *var = SMPI_VARINIT_STATIC_AND_SET(var, T, value)
64 ;
65 )
66
67 // FIXME: add varaccess...