From 2802b166f59bb5c116384bdaa01691824b149a76 Mon Sep 17 00:00:00 2001 From: navarro Date: Thu, 25 Oct 2012 10:27:57 -0700 Subject: [PATCH] Tranform extern for XBT_PUBLIC --- include/gras/process.h | 2 +- include/gras/virtu.h | 16 +++---- include/msg/msg.h | 2 +- include/surf/surf_routing.h | 56 ++++++++++++------------ include/xbt/ex.h | 4 +- include/xbt/misc.h | 2 +- include/xbt/mmalloc.h | 18 ++++---- include/xbt/module.h | 2 +- src/include/simgrid/platf_interface.h | 61 +++++++++++++-------------- src/include/surf/maxmin.h | 2 +- src/simix/smx_network.c | 2 +- src/surf/surfxml_parseplatf.c | 4 +- src/xbt/mmalloc/mmprivate.h | 6 +-- tools/gras/stub_generator.c | 2 +- 14 files changed, 89 insertions(+), 90 deletions(-) diff --git a/include/gras/process.h b/include/gras/process.h index 073df64e27..5fe6d6ead0 100644 --- a/include/gras/process.h +++ b/include/gras/process.h @@ -18,7 +18,7 @@ SG_BEGIN_DECL() * @{ */ /** \brief Create a new thread */ -void gras_agent_spawn(const char *name, xbt_main_func_t code, +XBT_PUBLIC(void) gras_agent_spawn(const char *name, xbt_main_func_t code, int argc, char *argv[], xbt_dict_t properties); /** @} */ diff --git a/include/gras/virtu.h b/include/gras/virtu.h index d4b80ca809..c735cdf0b8 100644 --- a/include/gras/virtu.h +++ b/include/gras/virtu.h @@ -17,14 +17,14 @@ SG_BEGIN_DECL() /* Initialization of the simulation world. Do not call them in RL. Indeed, do not call them at all. Let gras_stub_generator do it for you. */ -void gras_global_init(int *argc, char **argv); -void gras_create_environment(const char *file); -void gras_function_register(const char *name, xbt_main_func_t code); -void gras_function_register_default(xbt_main_func_t code); -void gras_launch_application(const char *file); -void gras_load_environment_script(const char *file); -void gras_clean(void); -void gras_main(void); +XBT_PUBLIC(void) gras_global_init(int *argc, char **argv); +XBT_PUBLIC(void) gras_create_environment(const char *file); +XBT_PUBLIC(void) gras_function_register(const char *name, xbt_main_func_t code); +XBT_PUBLIC(void) gras_function_register_default(xbt_main_func_t code); +XBT_PUBLIC(void) gras_launch_application(const char *file); +XBT_PUBLIC(void) gras_load_environment_script(const char *file); +XBT_PUBLIC(void) gras_clean(void); +XBT_PUBLIC(void) gras_main(void); /** @addtogroup GRAS_virtu diff --git a/include/msg/msg.h b/include/msg/msg.h index 19f733a196..a0f6261927 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -273,7 +273,7 @@ void MSG_mailbox_set_async(const char *alias); /************************** Action handling **********************************/ -msg_error_t MSG_action_trace_run(char *path); +XBT_PUBLIC(msg_error_t) MSG_action_trace_run(char *path); #ifdef MSG_USE_DEPRECATED diff --git a/include/surf/surf_routing.h b/include/surf/surf_routing.h index 2d0e95ed6c..86379ba18c 100644 --- a/include/surf/surf_routing.h +++ b/include/surf/surf_routing.h @@ -10,34 +10,34 @@ #include "xbt/lib.h" #include "simgrid/platf_interface.h" -extern xbt_lib_t host_lib; -extern int ROUTING_HOST_LEVEL; //Routing level -extern int SURF_CPU_LEVEL; //Surf cpu level -extern int SURF_WKS_LEVEL; //Surf workstation level -extern int SIMIX_HOST_LEVEL; //Simix level -extern int MSG_HOST_LEVEL; //Msg level -extern int SD_HOST_LEVEL; //Simdag level -extern int COORD_HOST_LEVEL; //Coordinates level -extern int NS3_HOST_LEVEL; //host node for ns3 - -extern xbt_lib_t link_lib; -extern int SD_LINK_LEVEL; //Simdag level -extern int SURF_LINK_LEVEL; //Surf level -extern int NS3_LINK_LEVEL; //link for ns3 - -extern xbt_lib_t as_router_lib; -extern int ROUTING_ASR_LEVEL; //Routing level -extern int COORD_ASR_LEVEL; //Coordinates level -extern int NS3_ASR_LEVEL; //host node for ns3 -extern int ROUTING_PROP_ASR_LEVEL; //Properties for AS and router - -extern xbt_lib_t storage_lib; -extern int ROUTING_STORAGE_LEVEL; //Routing storage level -extern int ROUTING_STORAGE_HOST_LEVEL; -extern int SURF_STORAGE_LEVEL; - -extern xbt_lib_t storage_type_lib; -extern int ROUTING_STORAGE_TYPE_LEVEL; //Routing storage_type level +XBT_PUBLIC(xbt_lib_t) host_lib; +XBT_PUBLIC(int) ROUTING_HOST_LEVEL; //Routing level +XBT_PUBLIC(int) SURF_CPU_LEVEL; //Surf cpu level +XBT_PUBLIC(int) SURF_WKS_LEVEL; //Surf workstation level +XBT_PUBLIC(int) SIMIX_HOST_LEVEL; //Simix level +XBT_PUBLIC(int) MSG_HOST_LEVEL; //Msg level +XBT_PUBLIC(int) SD_HOST_LEVEL; //Simdag level +XBT_PUBLIC(int) COORD_HOST_LEVEL; //Coordinates level +XBT_PUBLIC(int) NS3_HOST_LEVEL; //host node for ns3 + +XBT_PUBLIC(xbt_lib_t) link_lib; +XBT_PUBLIC(int) SD_LINK_LEVEL; //Simdag level +XBT_PUBLIC(int) SURF_LINK_LEVEL; //Surf level +XBT_PUBLIC(int) NS3_LINK_LEVEL; //link for ns3 + +XBT_PUBLIC(xbt_lib_t) as_router_lib; +XBT_PUBLIC(int) ROUTING_ASR_LEVEL; //Routing level +XBT_PUBLIC(int) COORD_ASR_LEVEL; //Coordinates level +XBT_PUBLIC(int) NS3_ASR_LEVEL; //host node for ns3 +XBT_PUBLIC(int) ROUTING_PROP_ASR_LEVEL; //Properties for AS and router + +XBT_PUBLIC(xbt_lib_t) storage_lib; +XBT_PUBLIC(int) ROUTING_STORAGE_LEVEL; //Routing storage level +XBT_PUBLIC(int) ROUTING_STORAGE_HOST_LEVEL; +XBT_PUBLIC(int) SURF_STORAGE_LEVEL; + +XBT_PUBLIC(xbt_lib_t) storage_type_lib; +XBT_PUBLIC(int) ROUTING_STORAGE_TYPE_LEVEL; //Routing storage_type level /* The callbacks to register for the routing to work */ void routing_AS_begin(sg_platf_AS_cbarg_t AS); diff --git a/include/xbt/ex.h b/include/xbt/ex.h index a6db6fc792..2d17bffe1c 100644 --- a/include/xbt/ex.h +++ b/include/xbt/ex.h @@ -313,12 +313,12 @@ XBT_PUBLIC_DATA(const xbt_running_ctx_t) __xbt_ex_ctx_initializer; /* the exception context */ typedef xbt_running_ctx_t *(*xbt_running_ctx_fetcher_t) (void); XBT_PUBLIC_DATA(xbt_running_ctx_fetcher_t) __xbt_running_ctx_fetch; -extern xbt_running_ctx_t *__xbt_ex_ctx_default(void); +XBT_PUBLIC( xbt_running_ctx_t *)__xbt_ex_ctx_default(void); /* the termination handler */ typedef void (*ex_term_cb_t) (xbt_ex_t *); XBT_PUBLIC_DATA(ex_term_cb_t) __xbt_ex_terminate; -extern void __xbt_ex_terminate_default(xbt_ex_t * e); +XBT_PUBLIC( void )__xbt_ex_terminate_default(xbt_ex_t * e); /** @brief Introduce a block where exception may be dealed with * @hideinitializer diff --git a/include/xbt/misc.h b/include/xbt/misc.h index ab21baf066..529bfc6365 100644 --- a/include/xbt/misc.h +++ b/include/xbt/misc.h @@ -181,7 +181,7 @@ # define XBT_PUBLIC_DATA(type) extern type /* Link against the DLL */ -#elif (defined(_WIN32) && !defined(DLL_EXPORT) && !defined(DLL_STATIC)) +#elif (defined(_XBT_WIN32) && !defined(DLL_EXPORT) && !defined(DLL_STATIC)) # define XBT_PUBLIC(type) __declspec(dllimport) type # define XBT_EXPORT_NO_IMPORT(type) type # define XBT_IMPORT_NO_EXPORT(type) __declspec(dllimport) type diff --git a/include/xbt/mmalloc.h b/include/xbt/mmalloc.h index 6963c4a7e3..74904083c6 100644 --- a/include/xbt/mmalloc.h +++ b/include/xbt/mmalloc.h @@ -30,32 +30,32 @@ typedef struct mdesc *xbt_mheap_t; /* Allocate SIZE bytes of memory (and memset it to 0). */ -extern void *mmalloc(xbt_mheap_t md, size_t size); +XBT_PUBLIC( void ) *mmalloc(xbt_mheap_t md, size_t size); /* Allocate SIZE bytes of memory (and don't mess with it) */ void *mmalloc_no_memset(xbt_mheap_t mdp, size_t size); /* Re-allocate the previously allocated block in void*, making the new block SIZE bytes long. */ -extern void *mrealloc(xbt_mheap_t md, void *ptr, size_t size); +XBT_PUBLIC( void ) *mrealloc(xbt_mheap_t md, void *ptr, size_t size); /* Free a block allocated by `mmalloc', `mrealloc' or `mcalloc'. */ -extern void mfree(xbt_mheap_t md, void *ptr); +XBT_PUBLIC( void ) mfree(xbt_mheap_t md, void *ptr); /* Allocate SIZE bytes allocated to ALIGNMENT bytes. */ -extern void *mmemalign(xbt_mheap_t md, size_t alignment, size_t size); +XBT_PUBLIC( void ) *mmemalign(xbt_mheap_t md, size_t alignment, size_t size); /* Allocate SIZE bytes on a page boundary. */ -extern void *mvalloc(xbt_mheap_t md, size_t size); +XBT_PUBLIC( void ) *mvalloc(xbt_mheap_t md, size_t size); -extern xbt_mheap_t xbt_mheap_new(int fd, void *baseaddr); +XBT_PUBLIC( xbt_mheap_t ) xbt_mheap_new(int fd, void *baseaddr); -extern void xbt_mheap_destroy_no_free(xbt_mheap_t md); +XBT_PUBLIC( void ) xbt_mheap_destroy_no_free(xbt_mheap_t md); -extern void *xbt_mheap_destroy(xbt_mheap_t md); +XBT_PUBLIC( void ) *xbt_mheap_destroy(xbt_mheap_t md); /* return the heap used when NULL is passed as first argument to any mm* function */ -extern xbt_mheap_t mmalloc_get_default_md(void); +XBT_PUBLIC( xbt_mheap_t ) mmalloc_get_default_md(void); /* To change the heap used when using the legacy version malloc/free/realloc and such */ void mmalloc_set_current_heap(xbt_mheap_t new_heap); diff --git a/include/xbt/module.h b/include/xbt/module.h index af669467bf..f3f5a44d22 100644 --- a/include/xbt/module.h +++ b/include/xbt/module.h @@ -11,7 +11,7 @@ #include /* XBT_PUBLIC */ -extern char *xbt_binary_name; +XBT_PUBLIC(char *)xbt_binary_name; XBT_PUBLIC(void) xbt_init(int *argc, char **argv); XBT_PUBLIC(void) xbt_exit(void); diff --git a/src/include/simgrid/platf_interface.h b/src/include/simgrid/platf_interface.h index 691f2381fb..63cff21115 100644 --- a/src/include/simgrid/platf_interface.h +++ b/src/include/simgrid/platf_interface.h @@ -13,8 +13,8 @@ #include "xbt/RngStream.h" /* Module management functions */ -void sg_platf_init(void); -void sg_platf_exit(void); +XBT_PUBLIC(void) sg_platf_init(void); +XBT_PUBLIC(void) sg_platf_exit(void); /* Managing the parsing callbacks */ @@ -42,43 +42,42 @@ typedef void (*sg_platf_mstorage_cb_t)(sg_platf_mstorage_cbarg_t); /* TUTORIAL: New TAG */ typedef void (*sg_platf_gpu_cb_t)(sg_platf_gpu_cbarg_t); -void sg_platf_gpu_add_cb(sg_platf_gpu_cb_t); +XBT_PUBLIC(void) sg_platf_gpu_add_cb(sg_platf_gpu_cb_t); /* ***************************************** */ - -void sg_platf_host_add_cb(sg_platf_host_cb_t); -void sg_platf_host_link_add_cb(sg_platf_host_link_cb_t); -void sg_platf_router_add_cb(sg_platf_router_cb_t); -void sg_platf_link_add_cb(sg_platf_link_cb_t); -void sg_platf_peer_add_cb(sg_platf_peer_cb_t fct); -void sg_platf_cluster_add_cb(sg_platf_cluster_cb_t fct); -void sg_platf_cabinet_add_cb(sg_platf_cabinet_cb_t fct); -void sg_platf_postparse_add_cb(void_f_void_t fct); -void sg_platf_AS_begin_add_cb(sg_platf_AS_cb_t fct); -void sg_platf_AS_end_add_cb(sg_platf_AS_cb_t fct); -void sg_platf_prop_add_cb(sg_platf_prop_cb_t fct); - -void sg_platf_route_add_cb(sg_platf_route_cb_t); -void sg_platf_ASroute_add_cb(sg_platf_route_cb_t); -void sg_platf_bypassRoute_add_cb(sg_platf_route_cb_t); -void sg_platf_bypassASroute_add_cb(sg_platf_route_cb_t); - -void sg_platf_trace_add_cb(sg_platf_trace_cb_t); -void sg_platf_trace_connect_add_cb(sg_platf_trace_connect_cb_t); - -void sg_platf_storage_add_cb(sg_platf_storage_cb_t fct); -void sg_platf_mstorage_add_cb(sg_platf_mstorage_cb_t fct); -void sg_platf_storage_type_add_cb(sg_platf_storage_type_cb_t fct); -void sg_platf_mount_add_cb(sg_platf_mount_cb_t fct); +XBT_PUBLIC(void) sg_platf_host_add_cb(sg_platf_host_cb_t); +XBT_PUBLIC(void) sg_platf_host_link_add_cb(sg_platf_host_link_cb_t); +XBT_PUBLIC(void) sg_platf_router_add_cb(sg_platf_router_cb_t); +XBT_PUBLIC(void) sg_platf_link_add_cb(sg_platf_link_cb_t); +XBT_PUBLIC(void) sg_platf_peer_add_cb(sg_platf_peer_cb_t fct); +XBT_PUBLIC(void) sg_platf_cluster_add_cb(sg_platf_cluster_cb_t fct); +XBT_PUBLIC(void) sg_platf_cabinet_add_cb(sg_platf_cabinet_cb_t fct); +XBT_PUBLIC(void) sg_platf_postparse_add_cb(void_f_void_t fct); +XBT_PUBLIC(void) sg_platf_AS_begin_add_cb(sg_platf_AS_cb_t fct); +XBT_PUBLIC(void) sg_platf_AS_end_add_cb(sg_platf_AS_cb_t fct); +XBT_PUBLIC(void) sg_platf_prop_add_cb(sg_platf_prop_cb_t fct); + +XBT_PUBLIC(void) sg_platf_route_add_cb(sg_platf_route_cb_t); +XBT_PUBLIC(void) sg_platf_ASroute_add_cb(sg_platf_route_cb_t); +XBT_PUBLIC(void) sg_platf_bypassRoute_add_cb(sg_platf_route_cb_t); +XBT_PUBLIC(void) sg_platf_bypassASroute_add_cb(sg_platf_route_cb_t); + +XBT_PUBLIC(void) sg_platf_trace_add_cb(sg_platf_trace_cb_t); +XBT_PUBLIC(void) sg_platf_trace_connect_add_cb(sg_platf_trace_connect_cb_t); + +XBT_PUBLIC(void) sg_platf_storage_add_cb(sg_platf_storage_cb_t fct); +XBT_PUBLIC(void) sg_platf_mstorage_add_cb(sg_platf_mstorage_cb_t fct); +XBT_PUBLIC(void) sg_platf_storage_type_add_cb(sg_platf_storage_type_cb_t fct); +XBT_PUBLIC(void) sg_platf_mount_add_cb(sg_platf_mount_cb_t fct); /** \brief Pick the right models for CPU, net and workstation, and call their model_init_preparse * * Must be called within parsing/creating the environment (after the s, if any, and before or friends such as ) */ -void surf_config_models_setup(void); +XBT_PUBLIC(void) surf_config_models_setup(void); /* RngStream management functions */ -void sg_platf_rng_stream_init(unsigned long seed[6]); -RngStream sg_platf_rng_stream_get(const char* id); +XBT_PUBLIC(void) sg_platf_rng_stream_init(unsigned long seed[6]); +XBT_PUBLIC(RngStream) sg_platf_rng_stream_get(const char* id); #endif /* SG_PLATF_INTERFACE_H */ diff --git a/src/include/surf/maxmin.h b/src/include/surf/maxmin.h index 9fd51c0725..5445c62471 100644 --- a/src/include/surf/maxmin.h +++ b/src/include/surf/maxmin.h @@ -46,7 +46,7 @@ XBT_PUBLIC(lmm_variable_t) lmm_variable_new(lmm_system_t sys, void *id, double weight_value, double bound, int number_of_constraints); -void lmm_variable_free(lmm_system_t sys, lmm_variable_t var); +XBT_PUBLIC(void) lmm_variable_free(lmm_system_t sys, lmm_variable_t var); XBT_PUBLIC(double) lmm_variable_getvalue(lmm_variable_t var); XBT_PUBLIC(double) lmm_variable_getbound(lmm_variable_t var); diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index 6a7a7a4a7d..8ca62bbfea 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -13,7 +13,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_network, simix, "Logging specific to SIMIX (network)"); static xbt_dict_t rdv_points = NULL; -unsigned long int smx_total_comms = 0; +XBT_PUBLIC(unsigned long int) smx_total_comms = 0; static void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall); static void SIMIX_comm_copy_data(smx_action_t comm); diff --git a/src/surf/surfxml_parseplatf.c b/src/surf/surfxml_parseplatf.c index 92040f056d..0a404f2621 100644 --- a/src/surf/surfxml_parseplatf.c +++ b/src/surf/surfxml_parseplatf.c @@ -25,8 +25,8 @@ int surfxml_bufferstack_size = 2048; static char *old_buff = NULL; -unsigned int surfxml_buffer_stack_stack_ptr; -unsigned int surfxml_buffer_stack_stack[1024]; +XBT_PUBLIC(unsigned int) surfxml_buffer_stack_stack_ptr; +XBT_PUBLIC(unsigned int) surfxml_buffer_stack_stack[1024]; void surfxml_bufferstack_push(int new) diff --git a/src/xbt/mmalloc/mmprivate.h b/src/xbt/mmalloc/mmprivate.h index 4fce4c64d0..a0c0b560a7 100644 --- a/src/xbt/mmalloc/mmprivate.h +++ b/src/xbt/mmalloc/mmprivate.h @@ -263,16 +263,16 @@ struct mdesc { /* A default malloc descriptor for the single sbrk() managed region. */ -extern struct mdesc *__mmalloc_default_mdp; +XBT_PUBLIC( struct mdesc ) *__mmalloc_default_mdp; /* Remap a mmalloc region that was previously mapped. */ -extern void *__mmalloc_remap_core(xbt_mheap_t mdp); +XBT_PUBLIC( void *)__mmalloc_remap_core(xbt_mheap_t mdp); /* Get core for the memory region specified by MDP, using SIZE as the amount to either add to or subtract from the existing region. Works like sbrk(), but using mmap(). */ -extern void *mmorecore(struct mdesc *mdp, int size); +XBT_PUBLIC( void *)mmorecore(struct mdesc *mdp, int size); /* Thread-safety (if the sem is already created) * diff --git a/tools/gras/stub_generator.c b/tools/gras/stub_generator.c index bdd5613d64..3d32883591 100644 --- a/tools/gras/stub_generator.c +++ b/tools/gras/stub_generator.c @@ -21,7 +21,7 @@ #include "gras_stub_generator.h" #include -extern char *xbt_binary_name; +XBT_PUBLIC(char*)xbt_binary_name; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(stubgen, gras, "Stub generator"); -- 2.20.1