From: markls Date: Tue, 18 Jan 2011 14:35:37 +0000 (+0000) Subject: added cocci for static vars... X-Git-Tag: v3.6_beta2~496 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/6e69aed5acf2593c8ad81bb88f78a33ab9178cfa added cocci for static vars... git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9432 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/smpi/replace_static.cocci b/src/smpi/replace_static.cocci new file mode 100644 index 0000000000..cda1de2e53 --- /dev/null +++ b/src/smpi/replace_static.cocci @@ -0,0 +1,67 @@ +// FIXME: why can't I just define a static local vardecl the same way as a +// normal local vardecl? + +// Function prototype looks like variable dec, but has parentheses +@funcproto@ +type T; +identifier func; +position p; +@@ +T@p func(...); + +// Define a local variable as one whose declaration is encased in brackets +@localvardecl@ +type T; +identifier var; +position p; +expression E; +@@ +{ +<... +( +T@p +var +; +| +T@p +var = E +; +) +...> +} + +// global variable is one whose declaration is neither local nor a function +// prototype +@globalvardecl@ +type T; +identifier var; +position p != { localvardecl.p, funcproto.p }; +expression value; +// expression size; +@@ +( +T@p var; +| +T@p var = value; +) + +// local static decl is a nonglobal static decl... +@localstaticvardecl@ +type T; +identifier var; +position p != globalvardecl.p; +expression value; +@@ +( +static T@p +- var ++ *var = SMPI_VARINIT_STATIC(var, T) +; +| +static T@p +- var = value ++ *var = SMPI_VARINIT_STATIC_AND_SET(var, T, value) +; +) + +// FIXME: add varaccess...