X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b0b805a773d2c5ed7f2f8bbff2cd80eaae0c4967..255cf4f4bd90c8f8e68204039528f3445d20f2a5:/src/smpi/replace_globals.cocci diff --git a/src/smpi/replace_globals.cocci b/src/smpi/replace_globals.cocci index 59e8aa6db4..5b80e5c2f1 100644 --- a/src/smpi/replace_globals.cocci +++ b/src/smpi/replace_globals.cocci @@ -1,5 +1,14 @@ +// FIXME: seems like cocci has problems manipulating the declarations, at least +// when there is more than one on the same line. We already need perl to split +// up the declarations after the fact, is there another tool we can use to patch +// up and match the declarations? In that case we could consider dropping cocci, +// or just using it to alter global variable accesses. +// // FIXME: problems +// - array declarations not properly matched...can fix, but then can't have +// multiple declarations on one line // - does not match array initializers +// - probably won't fix structure declarations with initialization either // Function prototype looks like variable dec, but has parentheses @funcproto@ @@ -36,30 +45,46 @@ var = E type T; identifier var; position p != { localvardecl.p, funcproto.p }; -expression E; +expression value; +// expression size; @@ ( T@p - var -+ *var = SMPI_INITIALIZE_GLOBAL(T) ++ *var = SMPI_VARINIT_GLOBAL(var, T) ; | T@p -- var = E -+ *var = SMPI_INITIALIZE_AND_SET_GLOBAL(T, E) +- var = value ++ *var = SMPI_VARINIT_GLOBAL_AND_SET(var, T, value) ; +//| +//T@p // FIXME: matches, but complains if more than one decl on a line... +//- var[size] +//+ *var[size] = SMPI_VARINIT_GLOBAL_ARRAY(T, size) +//; +//| +//T@p // FIXME: how to match initializer? +//- var[size] = { ... } +//+ *var[] = SMPI_VARINIT_GLOBAL_ARRAY_AND_SET(T, size, { ... }) +//; +//| +//T@p // FIXME: how to match initializer? how to figure out size? +//- var[] = { ... } +//+ *var[] = SMPI_VARINIT_GLOBAL_ARRAY_AND_SET(T, size, { ... }) // size = ? +//; ) @rewritelocalaccess@ -local idexpression x; +local idexpression lvar; identifier globalvardecl.var; @@ { <... ( -x +lvar | -+SMPI_GLOBAL_VAR_LOCAL_ACCESS( ++SMPI_VARGET_GLOBAL( var +) )