Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
smells--
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 24 Jun 2016 08:38:47 +0000 (10:38 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 24 Jun 2016 08:38:47 +0000 (10:38 +0200)
examples/msg/async-wait/async-wait.c
examples/msg/dht-pastry/dht-pastry.c
examples/msg/energy-pstate/energy-pstate.c
include/simgrid/simix.h
include/xbt/fifo.h
src/include/surf/maxmin.h
src/smpi/private.h
teshsuite/xbt/parmap_bench/parmap_bench.c

index a25df32..cb851d8 100644 (file)
@@ -38,7 +38,7 @@ static int sender(int argc, char *argv[])
     if (sleep_test_time > 0) { /* - "test_time" is set to 0, wait on @ref MSG_comm_wait */
       while (MSG_comm_test(comm) == 0) { /* - Call @ref MSG_comm_test every "test_time" otherwise */
         MSG_process_sleep(sleep_test_time);
-      };
+      }
     } else {
       MSG_comm_wait(comm, -1);
     }
index 214e509..4c20cb5 100644 (file)
@@ -7,7 +7,7 @@
 #include <math.h>
 #include "simgrid/msg.h"
 
-       XBT_LOG_NEW_DEFAULT_CATEGORY(msg_pastry, "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_pastry, "Messages specific for this msg example");
 
 /* TODO:                               *
  *  - handle node departure            *
index ff9e2e7..fc055b7 100644 (file)
@@ -19,7 +19,7 @@ static int dvfs(int argc, char *argv[])
 {
   double workload = 100E6;
   int new_peak_index=2;
-  msg_host_t host = MSG_host_self();; //MSG_get_host_by_name("MyHost1");
+  msg_host_t host = MSG_host_self();
 
   int nb = MSG_host_get_nb_pstates(host);
   XBT_INFO("Count of Processor states=%d", nb);
index 87ba0bc..762e7aa 100644 (file)
@@ -16,7 +16,6 @@
 #include "simgrid/datatypes.h"
 #include "simgrid/host.h"
 
-
 #ifdef __cplusplus
 
 namespace simgrid {
@@ -128,17 +127,17 @@ extern int smx_context_guard_size_was_set;
 
 SG_BEGIN_DECL()
 
-XBT_PUBLIC(xbt_dynar_t) SIMIX_process_get_runnable(void);
+XBT_PUBLIC(xbt_dynar_t) SIMIX_process_get_runnable();
 XBT_PUBLIC(smx_process_t) SIMIX_process_from_PID(int PID);
-XBT_PUBLIC(xbt_dynar_t) SIMIX_processes_as_dynar(void);
+XBT_PUBLIC(xbt_dynar_t) SIMIX_processes_as_dynar();
 
 /* parallelism */
-XBT_PUBLIC(int) SIMIX_context_is_parallel(void);
-XBT_PUBLIC(int) SIMIX_context_get_nthreads(void);
+XBT_PUBLIC(int) SIMIX_context_is_parallel();
+XBT_PUBLIC(int) SIMIX_context_get_nthreads();
 XBT_PUBLIC(void) SIMIX_context_set_nthreads(int nb_threads);
-XBT_PUBLIC(int) SIMIX_context_get_parallel_threshold(void);
+XBT_PUBLIC(int) SIMIX_context_get_parallel_threshold();
 XBT_PUBLIC(void) SIMIX_context_set_parallel_threshold(int threshold);
-XBT_PUBLIC(e_xbt_parmap_mode_t) SIMIX_context_get_parallel_mode(void);
+XBT_PUBLIC(e_xbt_parmap_mode_t) SIMIX_context_get_parallel_mode();
 XBT_PUBLIC(void) SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode);
 XBT_PUBLIC(int) SIMIX_is_maestro();
 
@@ -157,18 +156,18 @@ XBT_PUBLIC(void) SIMIX_function_register_process_cleanup(void_pfn_smxprocess_t f
 XBT_PUBLIC(void) SIMIX_function_register_process_kill(void_pfn_smxprocess_t function);
 
 /* Simulation execution */
-XBT_PUBLIC(void) SIMIX_run(void);
-XBT_PUBLIC(double) SIMIX_get_clock(void);
+XBT_PUBLIC(void) SIMIX_run();
+XBT_PUBLIC(double) SIMIX_get_clock();
 
 /* Timer functions FIXME: should these be public? */
 typedef struct s_smx_timer* smx_timer_t;
 
 XBT_PUBLIC(smx_timer_t) SIMIX_timer_set(double date, void (*function)(void*), void *arg);
 XBT_PUBLIC(void) SIMIX_timer_remove(smx_timer_t timer);
-XBT_PUBLIC(double) SIMIX_timer_next(void);
+XBT_PUBLIC(double) SIMIX_timer_next();
 XBT_PUBLIC(double) SIMIX_timer_get_date(smx_timer_t timer);
 
-XBT_PUBLIC(void) SIMIX_display_process_status(void);
+XBT_PUBLIC(void) SIMIX_display_process_status();
 
 /******************************* Environment **********************************/
 XBT_PUBLIC(void) SIMIX_create_environment(const char *file);
@@ -177,7 +176,7 @@ XBT_PUBLIC(void) SIMIX_create_environment(const char *file);
 
 XBT_PUBLIC(void) SIMIX_function_register(const char *name, xbt_main_func_t code);
 XBT_PUBLIC(void) SIMIX_function_register_default(xbt_main_func_t code);
-XBT_PUBLIC(void) SIMIX_init_application(void);
+XBT_PUBLIC(void) SIMIX_init_application();
 XBT_PUBLIC(void) SIMIX_launch_application(const char *file);
 
 XBT_PUBLIC(void) SIMIX_process_set_function(const char* process_host,
@@ -202,25 +201,25 @@ XBT_PUBLIC(smx_process_t) SIMIX_process_attach(
   const char* hostname,
   xbt_dict_t properties,
   smx_process_t parent_process);
-XBT_PUBLIC(void) SIMIX_process_detach(void);
+XBT_PUBLIC(void) SIMIX_process_detach();
 
 /*********************************** Host *************************************/
-XBT_PUBLIC(sg_host_t) SIMIX_host_self(void);
-XBT_PUBLIC(const char*) SIMIX_host_self_get_name(void);
+XBT_PUBLIC(sg_host_t) SIMIX_host_self();
+XBT_PUBLIC(const char*) SIMIX_host_self_get_name();
 XBT_PUBLIC(void) SIMIX_host_on(sg_host_t host);
 XBT_PUBLIC(void) SIMIX_host_off(sg_host_t host, smx_process_t issuer);
 XBT_PUBLIC(void) SIMIX_host_self_set_data(void *data);
-XBT_PUBLIC(void*) SIMIX_host_self_get_data(void);
+XBT_PUBLIC(void*) SIMIX_host_self_get_data();
 
 /********************************* Process ************************************/
 XBT_PUBLIC(smx_process_t) SIMIX_process_ref(smx_process_t process);
 XBT_PUBLIC(void) SIMIX_process_unref(smx_process_t process);
-XBT_PUBLIC(int) SIMIX_process_count(void);
-XBT_PUBLIC(smx_process_t) SIMIX_process_self(void);
-XBT_PUBLIC(const char*) SIMIX_process_self_get_name(void);
+XBT_PUBLIC(int) SIMIX_process_count();
+XBT_PUBLIC(smx_process_t) SIMIX_process_self();
+XBT_PUBLIC(const char*) SIMIX_process_self_get_name();
 XBT_PUBLIC(void) SIMIX_process_self_set_data(void *data);
-XBT_PUBLIC(void*) SIMIX_process_self_get_data(void);
-XBT_PUBLIC(smx_context_t) SIMIX_process_get_context(smx_process_t);
+XBT_PUBLIC(void*) SIMIX_process_self_get_data();
+XBT_PUBLIC(smx_context_t) SIMIX_process_get_context(smx_process_t process);
 XBT_PUBLIC(void) SIMIX_process_set_context(smx_process_t p,smx_context_t c);
 XBT_PUBLIC(int) SIMIX_process_has_pending_comms(smx_process_t process);
 XBT_PUBLIC(void) SIMIX_process_on_exit_runall(smx_process_t process);
index 1f152d5..61879ca 100644 (file)
@@ -14,8 +14,8 @@ SG_BEGIN_DECL()
 /** @addtogroup XBT_fifo
  *  @brief This section describes the API to generic workqueue.
  *
- * These functions provide the same kind of functionnality as dynamic arrays but in time O(1).
- * However these functions use malloc/free way too much often.            
+ * These functions provide the same kind of functionality as dynamic arrays but in time O(1).
+ * However these functions use malloc/free way too much often.
  */
 /** @defgroup XBT_fifo_cons Fifo constructor and destructor
  *  @ingroup XBT_fifo
@@ -31,8 +31,8 @@ typedef struct xbt_fifo_item *xbt_fifo_item_t;
 typedef struct xbt_fifo *xbt_fifo_t;
 
 XBT_PUBLIC(xbt_fifo_t) xbt_fifo_new(void);
-XBT_PUBLIC(void) xbt_fifo_free(xbt_fifo_t);
-XBT_PUBLIC(void) xbt_fifo_reset(xbt_fifo_t);
+XBT_PUBLIC(void) xbt_fifo_free(xbt_fifo_t l);
+XBT_PUBLIC(void) xbt_fifo_reset(xbt_fifo_t l);
 /** @} */
 
 /** @defgroup XBT_fifo_perl Fifo perl-like functions
@@ -40,12 +40,12 @@ XBT_PUBLIC(void) xbt_fifo_reset(xbt_fifo_t);
  *
  *  @{
  */
-XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_push(xbt_fifo_t, void *);
-XBT_PUBLIC(void *) xbt_fifo_pop(xbt_fifo_t);
-XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_unshift(xbt_fifo_t, void *);
-XBT_PUBLIC(void *) xbt_fifo_shift(xbt_fifo_t);
-XBT_PUBLIC(int) xbt_fifo_size(xbt_fifo_t);
-XBT_PUBLIC(int) xbt_fifo_is_in(xbt_fifo_t, void *);
+XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_push(xbt_fifo_t l, void *t);
+XBT_PUBLIC(void *) xbt_fifo_pop(xbt_fifo_t l);
+XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_unshift(xbt_fifo_t l, void *t);
+XBT_PUBLIC(void *) xbt_fifo_shift(xbt_fifo_t l);
+XBT_PUBLIC(int) xbt_fifo_size(xbt_fifo_t l);
+XBT_PUBLIC(int) xbt_fifo_is_in(xbt_fifo_t l, void *t);
 XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_search_item(xbt_fifo_t f, int_f_pvoid_pvoid_t cmp_fun, void *closure);
 /** @} */
 
@@ -56,18 +56,18 @@ XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_search_item(xbt_fifo_t f, int_f_pvoid_pvoid
  */
 
 XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_new_item(void);
-XBT_PUBLIC(void) xbt_fifo_set_item_content(xbt_fifo_item_t, void *);
-XBT_PUBLIC(void *) xbt_fifo_get_item_content(xbt_fifo_item_t);
-XBT_PUBLIC(void) xbt_fifo_free_item(xbt_fifo_item_t);
+XBT_PUBLIC(void) xbt_fifo_set_item_content(xbt_fifo_item_t i, void *v);
+XBT_PUBLIC(void *) xbt_fifo_get_item_content(xbt_fifo_item_t i);
+XBT_PUBLIC(void) xbt_fifo_free_item(xbt_fifo_item_t i);
 
-XBT_PUBLIC(void) xbt_fifo_push_item(xbt_fifo_t, xbt_fifo_item_t);
-XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_pop_item(xbt_fifo_t);
-XBT_PUBLIC(void) xbt_fifo_unshift_item(xbt_fifo_t, xbt_fifo_item_t);
-XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_shift_item(xbt_fifo_t);
+XBT_PUBLIC(void) xbt_fifo_push_item(xbt_fifo_t l, xbt_fifo_item_t i);
+XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_pop_item(xbt_fifo_t i);
+XBT_PUBLIC(void) xbt_fifo_unshift_item(xbt_fifo_t l, xbt_fifo_item_t i);
+XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_shift_item(xbt_fifo_t l);
 
-XBT_PUBLIC(int) xbt_fifo_remove(xbt_fifo_t, void *);
-XBT_PUBLIC(int) xbt_fifo_remove_all(xbt_fifo_t, void *);
-XBT_PUBLIC(void) xbt_fifo_remove_item(xbt_fifo_t, xbt_fifo_item_t);
+XBT_PUBLIC(int) xbt_fifo_remove(xbt_fifo_t l, void *t);
+XBT_PUBLIC(int) xbt_fifo_remove_all(xbt_fifo_t l, void *t);
+XBT_PUBLIC(void) xbt_fifo_remove_item(xbt_fifo_t l, xbt_fifo_item_t i);
 
 XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_get_first_item(xbt_fifo_t l);
 XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_get_last_item(xbt_fifo_t l);
@@ -97,19 +97,18 @@ XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_get_prev_item(xbt_fifo_item_t i);
  *
  *  @{
  */
-XBT_PUBLIC(void **) xbt_fifo_to_array(xbt_fifo_t);
-XBT_PUBLIC(xbt_fifo_t) xbt_fifo_copy(xbt_fifo_t);
+XBT_PUBLIC(void **) xbt_fifo_to_array(xbt_fifo_t l);
+XBT_PUBLIC(xbt_fifo_t) xbt_fifo_copy(xbt_fifo_t l);
 /** @} */
 
 /* Deprecated functions: don't use! */
 XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_newitem(void);
-XBT_PUBLIC(void) xbt_fifo_freeitem(xbt_fifo_item_t);
+XBT_PUBLIC(void) xbt_fifo_freeitem(xbt_fifo_item_t l);
 
 XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_getFirstItem(xbt_fifo_t l);
 XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_getNextItem(xbt_fifo_item_t i);
 XBT_PUBLIC(xbt_fifo_item_t) xbt_fifo_getPrevItem(xbt_fifo_item_t i);
 
-
 SG_END_DECL()
 
 #ifdef __cplusplus
index 1c7e1e8..b08c32f 100644 (file)
@@ -335,7 +335,7 @@ XBT_PUBLIC(lmm_variable_t) lmm_get_var_from_cnst(lmm_system_t sys, lmm_constrain
  *
  * @return A variable associated to a constraint
  */
-XBT_PUBLIC(lmm_variable_t) lmm_get_var_from_cnst_safe(lmm_system_t /*sys*/, lmm_constraint_t cnst,
+XBT_PUBLIC(lmm_variable_t) lmm_get_var_from_cnst_safe(lmm_system_t sys, lmm_constraint_t cnst,
                                      lmm_element_t * elem, lmm_element_t * nextelem, int * numelem);
 
 /**
index f376662..534c977 100644 (file)
@@ -180,7 +180,7 @@ XBT_PRIVATE int smpi_process_get_sampling(void);
 XBT_PRIVATE void smpi_process_set_replaying(bool s);
 XBT_PRIVATE bool smpi_process_get_replaying(void);
 
-XBT_PRIVATE void smpi_deployment_register_process(const char* instance_id, int rank, int index, MPI_Comm**, xbt_bar_t*);
+XBT_PRIVATE void smpi_deployment_register_process(const char* instance_id, int rank, int index, MPI_Comm** comm, xbt_bar_t*bar);
 XBT_PRIVATE void smpi_deployment_cleanup_instances(void);
 
 XBT_PRIVATE void smpi_comm_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size);
@@ -424,8 +424,8 @@ XBT_PRIVATE XBT_PRIVATE int smpi_comm_attr_delete(MPI_Comm comm, int keyval);
 XBT_PRIVATE int smpi_comm_attr_put(MPI_Comm comm, int keyval, void* attr_value);
 
 // f77 wrappers
-void mpi_init_(int*);
-void mpi_finalize_(int*);
+void mpi_init_(int* ierr);
+void mpi_finalize_(int* ierr);
 void mpi_abort_(int* comm, int* errorcode, int* ierr);
 void mpi_comm_rank_(int* comm, int* rank, int* ierr);
 void mpi_comm_size_(int* comm, int* size, int* ierr);
index de148a0..f28a54f 100644 (file)
@@ -78,11 +78,10 @@ static void fun_big_comp(void *arg)
 
 static void array_new(unsigned **a, xbt_dynar_t *data)
 {
-  int i;
   *a = xbt_malloc(ARRAY_SIZE * sizeof **a);
   *data = xbt_dynar_new(sizeof *a, NULL);
   xbt_dynar_shrink(*data, ARRAY_SIZE);
-  for (i = 0 ; i < ARRAY_SIZE ; i++) {
+  for (int i = 0 ; i < ARRAY_SIZE ; i++) {
     (*a)[i] = i;
     xbt_dynar_push_as(*data, void*, &(*a)[i]);
   }
@@ -93,8 +92,7 @@ static void bench_parmap_full(int nthreads, e_xbt_parmap_mode_t mode)
   unsigned *a;
   xbt_dynar_t data;
   xbt_parmap_t parmap;
-  int i;
-  double start_time, elapsed_time;
+  double elapsed_time;
 
   printf("** mode = %-15s ", parmap_mode_name(mode));
   fflush(stdout);
@@ -104,8 +102,8 @@ static void bench_parmap_full(int nthreads, e_xbt_parmap_mode_t mode)
 
   array_new(&a, &data);
 
-  i = 0;
-  start_time = xbt_os_time();
+  int i = 0;
+  double start_time = xbt_os_time();
   do {
     parmap = xbt_parmap_new(nthreads, mode);
     xbt_parmap_apply(parmap, fun_to_apply, data);
@@ -124,7 +122,7 @@ static void bench_parmap_apply(int nthreads, e_xbt_parmap_mode_t mode)
 {
   unsigned *a;
   xbt_dynar_t data;
-  double start_time, elapsed_time;
+  double elapsed_time;
 
   printf("** mode = %-15s ", parmap_mode_name(mode));
   fflush(stdout);
@@ -136,7 +134,7 @@ static void bench_parmap_apply(int nthreads, e_xbt_parmap_mode_t mode)
 
   xbt_parmap_t parmap = xbt_parmap_new(nthreads, mode);
   int i = 0;
-  start_time = xbt_os_time();
+  double start_time = xbt_os_time();
   do {
     xbt_parmap_apply(parmap, fun_to_apply, data);
     elapsed_time = xbt_os_time() - start_time;
@@ -144,8 +142,7 @@ static void bench_parmap_apply(int nthreads, e_xbt_parmap_mode_t mode)
   } while (elapsed_time < TIMEOUT);
   xbt_parmap_destroy(parmap);
 
-  printf("ran %d times in %g seconds (%g/s)\n",
-         i, elapsed_time, i / elapsed_time);
+  printf("ran %d times in %g seconds (%g/s)\n", i, elapsed_time, i / elapsed_time);
 
   xbt_dynar_free(&data);
   xbt_free(a);