From: Gabriel Corona Date: Thu, 26 May 2016 11:18:31 +0000 (+0200) Subject: [simix] Declare the real type of the argument od run_kernel() X-Git-Tag: v3_14~1159^2~3 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c5b66507bed01d07f72d09e96250a1cdfeaa90a4?ds=sidebyside [simix] Declare the real type of the argument od run_kernel() --- diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 115a0e8468..5f66232d2b 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -1126,7 +1126,7 @@ xbt_dict_t simcall_storage_get_content(smx_storage_t storage) void simcall_run_kernel(std::function const& code) { - return simcall_BODY_run_kernel((void*) &code); + return simcall_BODY_run_kernel(&code); } int simcall_mc_random(int min, int max) { diff --git a/src/simix/popping.cpp b/src/simix/popping.cpp index 832686daa6..8e938734d8 100644 --- a/src/simix/popping.cpp +++ b/src/simix/popping.cpp @@ -40,8 +40,7 @@ void SIMIX_simcall_exit(smx_synchro_t synchro) synchro->post(); } -void SIMIX_run_kernel(void* code) +void SIMIX_run_kernel(std::function const* code) { - std::function* function = (std::function*) code; - (*function)(); + (*code)(); } diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index 84a2a0f23f..5e913d9bf4 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -1143,11 +1143,11 @@ static inline void simcall_set_category__set__category(smx_simcall_t simcall, co simgrid::simix::marshal(simcall->args[1], arg); } -static inline void* simcall_run_kernel__get__code(smx_simcall_t simcall) { - return simgrid::simix::unmarshal(simcall->args[0]); +static inline std::function const* simcall_run_kernel__get__code(smx_simcall_t simcall) { + return simgrid::simix::unmarshal const*>(simcall->args[0]); } -static inline void simcall_run_kernel__set__code(smx_simcall_t simcall, void* arg) { - simgrid::simix::marshal(simcall->args[0], arg); +static inline void simcall_run_kernel__set__code(smx_simcall_t simcall, std::function const* arg) { + simgrid::simix::marshal const*>(simcall->args[0], arg); } /* The prototype of all simcall handlers, automatically generated for you */ diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index 5a5ef80273..74b4dcfec0 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -13,6 +13,7 @@ * That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :) */ +#include #include "smx_private.h" #include "src/mc/mc_forward.hpp" #include "xbt/ex.h" @@ -436,8 +437,8 @@ inline static void simcall_BODY_set_category(smx_synchro_t synchro, const char* return simcall(SIMCALL_SET_CATEGORY, synchro, category); } -inline static void simcall_BODY_run_kernel(void* code) { +inline static void simcall_BODY_run_kernel(std::function const* code) { /* Go to that function to follow the code flow through the simcall barrier */ if (0) SIMIX_run_kernel(code); - return simcall(SIMCALL_RUN_KERNEL, code); + return simcall const*>(SIMCALL_RUN_KERNEL, code); }/** @endcond */ diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index 77604abaa4..f7b5259cc1 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -420,7 +420,7 @@ case SIMCALL_SET_CATEGORY: break; case SIMCALL_RUN_KERNEL: - SIMIX_run_kernel(simgrid::simix::unmarshal(simcall->args[0])); + SIMIX_run_kernel(simgrid::simix::unmarshal const*>(simcall->args[0])); SIMIX_simcall_answer(simcall); break; case NUM_SIMCALLS: diff --git a/src/simix/popping_private.h b/src/simix/popping_private.h index 341536202a..93f0bfee5e 100644 --- a/src/simix/popping_private.h +++ b/src/simix/popping_private.h @@ -59,7 +59,7 @@ XBT_PRIVATE void SIMIX_simcall_answer(smx_simcall_t); XBT_PRIVATE void SIMIX_simcall_handle(smx_simcall_t, int); XBT_PRIVATE void SIMIX_simcall_exit(smx_synchro_t); XBT_PRIVATE const char *SIMIX_simcall_name(e_smx_simcall_t kind); -XBT_PRIVATE void SIMIX_run_kernel(void* code); +XBT_PRIVATE void SIMIX_run_kernel(std::function const* code); SG_END_DECL() diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 75cb831bf4..c8cf97346f 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -115,4 +115,4 @@ xbt_dict_t asr_get_properties(const char* name); int mc_random(int min, int max); void set_category(smx_synchro_t synchro, const char* category) [[nohandler]]; -void run_kernel(void* code) [[nohandler]]; +void run_kernel(std::function const* code) [[nohandler]]; diff --git a/src/simix/simcalls.py b/src/simix/simcalls.py index 83f7d024b2..adca70962c 100755 --- a/src/simix/simcalls.py +++ b/src/simix/simcalls.py @@ -171,7 +171,7 @@ def parse(fn): if line.startswith('#') or not line: continue match = re.match( - r'^(\S+)\s+([^\)\(\s]+)\s*\(*([^\(\)]*)\)\s*(\[\[.*\]\])?\s*;\s*?$', line) + r'^(\S+)\s+([^\)\(\s]+)\s*\(*(.*)\)\s*(\[\[.*\]\])?\s*;\s*?$', line) assert match, line ret, name, args, attrs = match.groups() sargs = [] @@ -344,6 +344,7 @@ if __name__ == '__main__': # smx_popping_bodies.cpp # fd = header('popping_bodies.cpp') + fd.write('#include \n') fd.write('#include "smx_private.h"\n') fd.write('#include "src/mc/mc_forward.hpp"\n') fd.write('#include "xbt/ex.h"\n')