From: Gabriel Corona Date: Mon, 30 May 2016 10:18:13 +0000 (+0200) Subject: Avoid multiple declaration on the same line/statement X-Git-Tag: v3_14~1100 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/64ea8dcf1daac53da58d65aa91b7452aae8b13b7?hp=ae87d9697ce445eaa3221750fc5e18553f879498 Avoid multiple declaration on the same line/statement --- diff --git a/include/simgrid/datatypes.h b/include/simgrid/datatypes.h index 035a6af3d5..dd73424d05 100644 --- a/include/simgrid/datatypes.h +++ b/include/simgrid/datatypes.h @@ -9,7 +9,7 @@ #include -typedef struct vm_params { +struct vm_params { int ncpus; sg_size_t ramsize; int overcommit; @@ -26,6 +26,8 @@ typedef struct vm_params { /* set migration speed */ double mig_speed; -} s_vm_params_t, *vm_params_t; +}; +typedef struct vm_params s_vm_params_t; +typedef struct vm_params* vm_params_t; #endif /* SIMGRID_DATATYPES_H_ */ diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index c570f1e61a..27594822dd 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -89,7 +89,7 @@ typedef s_xbt_dictelm_t s_msg_file_t; extern int MSG_FILE_LEVEL; typedef struct simdata_file *simdata_file_t; -typedef struct msg_file_priv { +struct msg_file_priv { char *fullpath; sg_size_t size; char* mount_point; @@ -99,7 +99,9 @@ typedef struct msg_file_priv { int desc_id; void *data; simdata_file_t simdata; -} s_msg_file_priv_t, *msg_file_priv_t; +}; +typedef struct msg_file_priv s_msg_file_priv_t; +typedef struct msg_file_priv* msg_file_priv_t; static inline msg_file_priv_t MSG_file_priv(msg_file_t file){ return (msg_file_priv_t )xbt_lib_get_level(file, MSG_FILE_LEVEL); @@ -118,10 +120,12 @@ extern int MSG_STORAGE_LEVEL; typedef xbt_dictelm_t msg_storage_t; typedef s_xbt_dictelm_t s_msg_storage_t; -typedef struct msg_storage_priv { +struct msg_storage_priv { const char *hostname; void *data; -} s_msg_storage_priv_t, *msg_storage_priv_t; +}; +typedef struct msg_storage_priv s_msg_storage_priv_t; +typedef struct msg_storage_priv* msg_storage_priv_t; static inline msg_storage_priv_t MSG_storage_priv(msg_storage_t storage){ return (msg_storage_priv_t )xbt_lib_get_level(storage, MSG_STORAGE_LEVEL); diff --git a/include/xbt/RngStream.h b/include/xbt/RngStream.h index 9da40c1068..06ade631f9 100644 --- a/include/xbt/RngStream.h +++ b/include/xbt/RngStream.h @@ -13,7 +13,9 @@ typedef struct RngStream_InfoState * RngStream; struct RngStream_InfoState { - double Cg[6], Bg[6], Ig[6]; + double Cg[6]; + double Bg[6]; + double Ig[6]; int Anti; int IncPrec; char *name; diff --git a/include/xbt/lib.h b/include/xbt/lib.h index 404ed253c0..5e10edd13f 100644 --- a/include/xbt/lib.h +++ b/include/xbt/lib.h @@ -48,11 +48,13 @@ SG_BEGIN_DECL() * xbt_lib_set(foo_lib, id, AUTH_FOO_LEVEL, auth); * */ -typedef struct s_xbt_lib { +struct s_xbt_lib { xbt_dict_t dict; int levels; void_f_pvoid_t *free_f; /* This is actually a table */ -} s_xbt_lib_t, *xbt_lib_t; +}; +typedef struct s_xbt_lib s_xbt_lib_t; +typedef struct s_xbt_lib* xbt_lib_t; #define xbt_lib_cursor_t xbt_dict_cursor_t diff --git a/include/xbt/log.h b/include/xbt/log.h index ea7d3ae615..93dabefe76 100644 --- a/include/xbt/log.h +++ b/include/xbt/log.h @@ -239,10 +239,14 @@ typedef enum { XBT_PUBLIC(void) xbt_log_control_set(const char *cs); /* Forward declarations */ -typedef struct xbt_log_appender_s s_xbt_log_appender_t, *xbt_log_appender_t; -typedef struct xbt_log_layout_s s_xbt_log_layout_t, *xbt_log_layout_t; -typedef struct xbt_log_event_s s_xbt_log_event_t, *xbt_log_event_t; -typedef struct xbt_log_category_s s_xbt_log_category_t, *xbt_log_category_t; +typedef struct xbt_log_appender_s s_xbt_log_appender_t; +typedef struct xbt_log_appender_s* xbt_log_appender_t; +typedef struct xbt_log_layout_s s_xbt_log_layout_t; +typedef struct xbt_log_layout_s* xbt_log_layout_t; +typedef struct xbt_log_event_s s_xbt_log_event_t; +typedef struct xbt_log_event_s* xbt_log_event_t; +typedef struct xbt_log_category_s s_xbt_log_category_t; +typedef struct xbt_log_category_s* xbt_log_category_t; /* Do NOT access any members of this structure directly. FIXME: move to private? */ diff --git a/include/xbt/strbuff.h b/include/xbt/strbuff.h index 7b9e44aa33..ace5e34c85 100644 --- a/include/xbt/strbuff.h +++ b/include/xbt/strbuff.h @@ -18,10 +18,12 @@ SG_BEGIN_DECL() /** Buffer code **/ -typedef struct { +struct xbt_strbuff { char *data; int used, size; -} s_xbt_strbuff_t, *xbt_strbuff_t; +}; +typedef struct xbt_strbuff s_xbt_strbuff_t; +typedef struct xbt_strbuff* xbt_strbuff_t; XBT_PUBLIC(void) xbt_strbuff_empty(xbt_strbuff_t b); XBT_PUBLIC(xbt_strbuff_t) xbt_strbuff_new(void); diff --git a/include/xbt/swag.h b/include/xbt/swag.h index e406066160..2431b3088c 100644 --- a/include/xbt/swag.h +++ b/include/xbt/swag.h @@ -65,12 +65,15 @@ typedef struct foo { */ typedef s_xbt_swag_hookup_t *xbt_swag_hookup_t; -typedef struct xbt_swag { +struct xbt_swag { void *head; void *tail; size_t offset; int count; -} s_xbt_swag_t, *xbt_swag_t; +}; +typedef struct xbt_swag s_xbt_swag_t; +typedef struct xbt_swag* xbt_swag_t; + /**< A typical swag */ /* @} */ diff --git a/src/bindings/java/jmsg_host.cpp b/src/bindings/java/jmsg_host.cpp index aa84bd2837..a2cbb893a1 100644 --- a/src/bindings/java/jmsg_host.cpp +++ b/src/bindings/java/jmsg_host.cpp @@ -265,7 +265,8 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getMountedStorage(JNIEn } xbt_dict_cursor_t cursor=NULL; - const char *mount_name, *storage_name; + const char* mount_name; + const char* storage_name; xbt_dict_foreach(dict,cursor,mount_name,storage_name) { jname = env->NewStringUTF(storage_name); diff --git a/src/include/mc/datatypes.h b/src/include/mc/datatypes.h index ff7fa02fa4..54c004d13b 100644 --- a/src/include/mc/datatypes.h +++ b/src/include/mc/datatypes.h @@ -16,7 +16,7 @@ SG_BEGIN_DECL() -typedef struct s_stack_region{ +struct s_stack_region{ void *address; #if HAVE_UCONTEXT_H ucontext_t* context; @@ -24,7 +24,9 @@ typedef struct s_stack_region{ size_t size; int block; int process_index; -}s_stack_region_t, *stack_region_t; +}; +typedef struct s_stack_region s_stack_region_t; +typedef struct s_stack_region* stack_region_t; SG_END_DECL() diff --git a/src/include/smpi/smpi_interface.h b/src/include/smpi/smpi_interface.h index 4f5686aef9..6f6c9d0392 100644 --- a/src/include/smpi/smpi_interface.h +++ b/src/include/smpi/smpi_interface.h @@ -12,11 +12,13 @@ SG_BEGIN_DECL() /** \brief MPI collective description */ -typedef struct mpi_coll_description { +struct mpi_coll_description { const char *name; const char *description; void *coll; -} s_mpi_coll_description_t, *mpi_coll_description_t; +}; +typedef struct mpi_coll_description s_mpi_coll_description_t; +typedef struct mpi_coll_description* mpi_coll_description_t; /** \ingroup MPI gather * \brief The list of all available allgather collectives diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 77ad4d0662..478cf521d9 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -125,11 +125,13 @@ typedef struct surf_file *surf_file_t; /** \brief Resource model description */ -typedef struct surf_model_description { +struct surf_model_description { const char *name; const char *description; void_f_void_t model_init_preparse; -} s_surf_model_description_t, *surf_model_description_t; +}; +typedef struct surf_model_description s_surf_model_description_t; +typedef struct surf_model_description* surf_model_description_t; XBT_PUBLIC(int) find_model_description(s_surf_model_description_t * table, const char *name); XBT_PUBLIC(void) model_help(const char *category, s_surf_model_description_t * table); diff --git a/src/instr/instr_paje_types.cpp b/src/instr/instr_paje_types.cpp index 68ab4440a4..d9855644db 100644 --- a/src/instr/instr_paje_types.cpp +++ b/src/instr/instr_paje_types.cpp @@ -99,7 +99,8 @@ type_t PJ_type_get_or_null (const char *name, type_t father) THROWF (tracing_error, 0, "can't get type with a NULL name or from a NULL father"); } - type_t ret = NULL, child; + type_t ret = NULL; + type_t child; char *child_name; xbt_dict_cursor_t cursor = NULL; xbt_dict_foreach(father->children, cursor, child_name, child) { diff --git a/src/mc/mc_base.h b/src/mc/mc_base.h index 9e74d3976f..fc1c184061 100644 --- a/src/mc/mc_base.h +++ b/src/mc/mc_base.h @@ -13,7 +13,8 @@ #include -typedef struct s_smx_simcall s_smx_simcall_t, *smx_simcall_t; +typedef struct s_smx_simcall s_smx_simcall_t; +typedef struct s_smx_simcall* smx_simcall_t; #ifdef __cplusplus diff --git a/src/mc/mc_protocol.h b/src/mc/mc_protocol.h index e93295a6ea..3e1da82718 100644 --- a/src/mc/mc_protocol.h +++ b/src/mc/mc_protocol.h @@ -58,51 +58,67 @@ typedef enum { * This is the basic structure shared by all messages: all message start with a message * type. */ -typedef struct s_mc_message { +struct s_mc_message { e_mc_message_type type; -} s_mc_message_t, *mc_message_t; +}; +typedef struct s_mc_message s_mc_message_t; +typedef struct s_mc_message* mc_message_t; -typedef struct s_mc_int_message { +struct s_mc_int_message { e_mc_message_type type; uint64_t value; -} s_mc_int_message_t, *mc_int_message_t; +}; +typedef struct s_mc_int_message s_mc_int_message_t; +typedef struct s_mc_int_message* mc_int_message_t; -typedef struct s_mc_ignore_heap_message { +struct s_mc_ignore_heap_message { e_mc_message_type type; int block; int fragment; void *address; size_t size; -} s_mc_ignore_heap_message_t, *mc_ignore_heap_message_t; +}; +typedef struct s_mc_ignore_heap_message s_mc_ignore_heap_message_t; +typedef struct s_mc_ignore_heap_message* mc_ignore_heap_message_t; -typedef struct s_mc_ignore_memory_message { +struct s_mc_ignore_memory_message { e_mc_message_type type; uint64_t addr; size_t size; -} s_mc_ignore_memory_message_t, *mc_ignore_memory_message_t; +}; +typedef struct s_mc_ignore_memory_message s_mc_ignore_memory_message_t; +typedef struct s_mc_ignore_memory_message* mc_ignore_memory_message_t; -typedef struct s_mc_stack_region_message { +struct s_mc_stack_region_message { e_mc_message_type type; s_stack_region_t stack_region; -} s_mc_stack_region_message_t, *mc_stack_region_message_t; +}; +typedef struct s_mc_stack_region_message s_mc_stack_region_message_t; +typedef struct s_mc_stack_region_message* mc_stack_region_message_t; -typedef struct s_mc_simcall_handle_message { +struct s_mc_simcall_handle_message { e_mc_message_type type; unsigned long pid; int value; -} s_mc_simcall_handle_message_t, *mc_simcall_handle_message; +}; +typedef struct s_mc_simcall_handle_message s_mc_simcall_handle_message_t; +typedef struct s_mc_simcall_handle_message* mc_simcall_handle_message; -typedef struct s_mc_register_symbol_message { +struct s_mc_register_symbol_message { e_mc_message_type type; char name[128]; int (*callback)(void*); void* data; -} s_mc_register_symbol_message_t, * mc_register_symbol_message_t; +}; +typedef struct s_mc_register_symbol_message s_mc_register_symbol_message_t; +typedef struct s_mc_register_symbol_message* mc_register_symbol_message_t; -typedef struct s_mc_restore_message { +struct s_mc_restore_message { e_mc_message_type type; int index; -} s_mc_restore_message_t, *mc_restore_message_t; +}; +typedef struct s_mc_restore_message s_mc_restore_message_t; +typedef struct s_mc_restore_message* mc_restore_message_t; XBT_PRIVATE const char* MC_message_type_name(e_mc_message_type type); diff --git a/src/msg/msg_io.cpp b/src/msg/msg_io.cpp index 845998bc7e..b5f2a2b21e 100644 --- a/src/msg/msg_io.cpp +++ b/src/msg/msg_io.cpp @@ -136,7 +136,6 @@ sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size) sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size) { msg_file_priv_t file_priv = MSG_file_priv(fd); - sg_size_t write_size, offset; /* Find the host where the file is physically located (remote or local)*/ msg_storage_t storage_src =(msg_storage_t) xbt_lib_get_elm_or_null(storage_lib, file_priv->storageId); @@ -169,8 +168,8 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size) } } /* Write file on local or remote host */ - offset = simcall_file_tell(file_priv->simdata->smx_file); - write_size = simcall_file_write(file_priv->simdata->smx_file, size, attached_host); + sg_size_t offset = simcall_file_tell(file_priv->simdata->smx_file); + sg_size_t write_size = simcall_file_write(file_priv->simdata->smx_file, size, attached_host); file_priv->size = offset+write_size; return write_size; @@ -325,14 +324,14 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa /* Find the real host destination where the file will be physically stored */ xbt_dict_cursor_t cursor = NULL; - char *mount_name, *storage_name, *file_mount_name, *host_name_dest; msg_storage_t storage_dest = NULL; msg_host_t host_dest; size_t longest_prefix_length = 0; xbt_dict_t storage_list = host->mountedStoragesAsDict(); + char *mount_name, *storage_name; xbt_dict_foreach(storage_list,cursor,mount_name,storage_name){ - file_mount_name = (char *) xbt_malloc ((strlen(mount_name)+1)); + char* file_mount_name = (char *) xbt_malloc ((strlen(mount_name)+1)); strncpy(file_mount_name,fullpath,strlen(mount_name)+1); file_mount_name[strlen(mount_name)] = '\0'; @@ -345,12 +344,12 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa } xbt_dict_free(&storage_list); + char* host_name_dest = nullptr; if(longest_prefix_length>0){ /* Mount point found, retrieve the host the storage is attached to */ msg_storage_priv_t storage_dest_priv = MSG_storage_priv(storage_dest); host_name_dest = (char*)storage_dest_priv->hostname; host_dest = MSG_host_by_name(host_name_dest); - }else{ XBT_WARN("Can't find mount point for '%s' on destination host '%s'", fullpath, sg_host_get_name(host)); return MSG_TASK_CANCELED;