Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid multiple declaration on the same line/statement
authorGabriel Corona <gabriel.corona@loria.fr>
Mon, 30 May 2016 10:18:13 +0000 (12:18 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Mon, 30 May 2016 14:00:50 +0000 (16:00 +0200)
15 files changed:
include/simgrid/datatypes.h
include/simgrid/msg.h
include/xbt/RngStream.h
include/xbt/lib.h
include/xbt/log.h
include/xbt/strbuff.h
include/xbt/swag.h
src/bindings/java/jmsg_host.cpp
src/include/mc/datatypes.h
src/include/smpi/smpi_interface.h
src/include/surf/surf.h
src/instr/instr_paje_types.cpp
src/mc/mc_base.h
src/mc/mc_protocol.h
src/msg/msg_io.cpp

index 035a6af..dd73424 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <simgrid/forward.h>
 
-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_ */
index c570f1e..2759482 100644 (file)
@@ -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);
index 9da40c1..06ade63 100644 (file)
@@ -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;
index 404ed25..5e10edd 100644 (file)
@@ -48,11 +48,13 @@ SG_BEGIN_DECL()
  *  xbt_lib_set(foo_lib, id, AUTH_FOO_LEVEL, auth);
  *  </pre>
  */
-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
 
index ea7d3ae..93dabef 100644 (file)
@@ -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? */
 
index 7b9e44a..ace5e34 100644 (file)
 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);
index e406066..2431b30 100644 (file)
@@ -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 */
 /* @} */
 
index aa84bd2..a2cbb89 100644 (file)
@@ -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);
index ff7fa02..54c004d 100644 (file)
@@ -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()
 
index 4f5686a..6f6c9d0 100644 (file)
@@ -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
index 77ad4d0..478cf52 100644 (file)
@@ -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);
index 68ab444..d985564 100644 (file)
@@ -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) {
index 9e74d39..fc1c184 100644 (file)
@@ -13,7 +13,8 @@
 
 #include <xbt/base.h>
 
-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
 
index e93295a..3e1da82 100644 (file)
@@ -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);
 
index 845998b..b5f2a2b 100644 (file)
@@ -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;