From 27c7fbea86b5184b440537f27dfc0cfe726c6400 Mon Sep 17 00:00:00 2001 From: markls Date: Mon, 17 Jan 2011 07:57:19 +0000 Subject: [PATCH] added replace globals cocci patch to repository git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9414 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/smpi/replace_globals.cocci | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 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 ++) +) -- 2.20.1