X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/45a36ed14ce7262382679eace2faa2bcfc996964..27c7fbea86b5184b440537f27dfc0cfe726c6400:/src/smpi/replace_globals.cocci diff --git a/src/smpi/replace_globals.cocci b/src/smpi/replace_globals.cocci new file mode 100644 index 0000000000..a49237c80b --- /dev/null +++ b/src/smpi/replace_globals.cocci @@ -0,0 +1,60 @@ +// Function prototype looks like variable dec, but has parentheses +@funcproto@ +type T; +identifier f; +position p; +@@ +T f@p(...); + +// Define a local variable as one whose declaration is encased in brackets +@localvardecl@ +type T; +identifier a; +position p; +expression E; +@@ +{ +<... +( + T a@p; +| + T a@p = E; +) +...> +} + +// global variable is one whose declaration is neither local nor a function +// prototype +@globalvardecl@ +type T; +identifier b; +position p != { localvardecl.p, funcproto.p }; +expression E; +@@ +( +-T ++T* +b@p ++ = SMPI_INITIALIZE_GLOBAL(T) +; +| +-T ++T* +b@p = ++ SMPI_INITIALIZE_AND_SET_GLOBAL(T, +E ++) +; +) + +@rewritelocalaccess@ +local idexpression x; +identifier globalvardecl.b; +@@ +( +x +| ++SMPI_GLOBAL_VAR_LOCAL_ACCESS( +b ++) +)