Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
added replace globals cocci patch to repository
authormarkls <markls@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 17 Jan 2011 07:57:19 +0000 (07:57 +0000)
committermarkls <markls@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 17 Jan 2011 07:57:19 +0000 (07:57 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9414 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/smpi/replace_globals.cocci [new file with mode: 0644]

diff --git a/src/smpi/replace_globals.cocci b/src/smpi/replace_globals.cocci
new file mode 100644 (file)
index 0000000..a49237c
--- /dev/null
@@ -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
++)
+)