From: Frederic Suter Date: Mon, 17 Jul 2017 10:10:01 +0000 (+0200) Subject: codacy treats X-Git-Tag: v3_17~382 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/15915622eda737bb6121ba662d53ae1d1ea7e027?ds=sidebyside codacy treats --- diff --git a/src/mc/compare.cpp b/src/mc/compare.cpp index fdc6c5c08b..1fe48f4e3a 100644 --- a/src/mc/compare.cpp +++ b/src/mc/compare.cpp @@ -1479,11 +1479,9 @@ static int compare_global_variables( (char *) current_var.address); return 1; } - } return 0; - } static int compare_local_variables(simgrid::mc::StateComparator& state, @@ -1500,7 +1498,6 @@ static int compare_local_variables(simgrid::mc::StateComparator& state, unsigned int cursor = 0; local_variable_t current_var1, current_var2; - int res; while (cursor < stack1->local_variables.size()) { current_var1 = &stack1->local_variables[cursor]; current_var2 = &stack1->local_variables[cursor]; @@ -1521,22 +1518,18 @@ static int compare_local_variables(simgrid::mc::StateComparator& state, // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram simgrid::mc::Type* subtype = current_var1->type; - res = - compare_areas_with_type(state, process_index, - current_var1->address, snapshot1, mc_get_snapshot_region(current_var1->address, snapshot1, process_index), - current_var2->address, snapshot2, mc_get_snapshot_region(current_var2->address, snapshot2, process_index), - subtype, 0); - - if (res == 1) { - // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram - XBT_VERB - ("Local variable %s (%p - %p) in frame %s " - "is different between snapshots", - current_var1->name.c_str(), - current_var1->address, - current_var2->address, - current_var1->subprogram->name.c_str()); - return res; + int res = compare_areas_with_type( + state, process_index, current_var1->address, snapshot1, + mc_get_snapshot_region(current_var1->address, snapshot1, process_index), current_var2->address, snapshot2, + mc_get_snapshot_region(current_var2->address, snapshot2, process_index), subtype, 0); + + if (res == 1) { + // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram + XBT_VERB("Local variable %s (%p - %p) in frame %s " + "is different between snapshots", + current_var1->name.c_str(), current_var1->address, current_var2->address, + current_var1->subprogram->name.c_str()); + return res; } cursor++; } diff --git a/src/smpi/smpi_comm.cpp b/src/smpi/smpi_comm.cpp index 857fc9a881..23de66f493 100644 --- a/src/smpi/smpi_comm.cpp +++ b/src/smpi/smpi_comm.cpp @@ -423,11 +423,10 @@ void Comm::init_smp(){ smpi_process()->set_comm_intra(comm_intra); } - int is_uniform = 1; - // Are the nodes uniform ? = same number of process/node int my_local_size=comm_intra->size(); if(comm_intra->rank()==0) { + int is_uniform = 1; int* non_uniform_map = xbt_new0(int,leader_group_size); Coll_allgather_mpich::allgather(&my_local_size, 1, MPI_INT, non_uniform_map, 1, MPI_INT, leader_comm); diff --git a/src/surf/maxmin.cpp b/src/surf/maxmin.cpp index f6dfe9a836..a444396076 100644 --- a/src/surf/maxmin.cpp +++ b/src/surf/maxmin.cpp @@ -460,7 +460,6 @@ void lmm_expand(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, dou void lmm_expand_add(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, double value) { int i; - double weight; sys->modified = 1; lmm_check_concurrency(sys); @@ -482,7 +481,7 @@ void lmm_expand_add(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, //We need to check that increasing value of the element does not cross the concurrency limit if (var->sharing_weight) { if(lmm_concurrency_slack(cnst)cnsts[i])){ - weight = var->sharing_weight; + double weight = var->sharing_weight; lmm_disable_var(sys,var); for (int j = 0; j < var->cnsts_number; j++) lmm_on_disabled_var(sys,var->cnsts[j].constraint); diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 97e7964271..46f00dedd5 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -41,7 +41,6 @@ void surf_presolve() double surf_solve(double max_date) { double time_delta = -1.0; /* duration */ - double next_event_date = -1.0; double model_next_action_end = -1.0; double value = -1.0; simgrid::surf::Resource *resource = nullptr; @@ -71,7 +70,7 @@ double surf_solve(double max_date) XBT_DEBUG("Looking for next trace event"); while (1) { // Handle next occurring events until none remains - next_event_date = future_evt_set->next_date(); + double next_event_date = future_evt_set->next_date(); XBT_DEBUG("Next TRACE event: %f", next_event_date); if (not surf_network_model->nextOccuringEventIsIdempotent()) { // NS3, I see you diff --git a/src/xbt/cunit.cpp b/src/xbt/cunit.cpp index 8008c3eace..eac5f1abcb 100644 --- a/src/xbt/cunit.cpp +++ b/src/xbt/cunit.cpp @@ -250,8 +250,6 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity) xbt_test_test_t test; xbt_test_log_t log; - unsigned int it_test; - if (suite == nullptr) return 0; @@ -297,6 +295,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity) unit->func(); /* iterate through all performed tests to determine status */ + unsigned int it_test; xbt_dynar_foreach(unit->tests, it_test, test) { if (test->ignored) { unit->test_ignore++; diff --git a/src/xbt/dynar.cpp b/src/xbt/dynar.cpp index b1a20fd41f..cef1231c79 100644 --- a/src/xbt/dynar.cpp +++ b/src/xbt/dynar.cpp @@ -393,9 +393,6 @@ extern "C" void xbt_dynar_remove_at(xbt_dynar_t const dynar, const int idx, void */ extern "C" void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned int n, const int idx) { - unsigned long nb_shift; - unsigned long offset; - if (not n) return; @@ -409,10 +406,10 @@ extern "C" void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned in } } - nb_shift = dynar->used - n - idx; + unsigned long nb_shift = dynar->used - n - idx; if (nb_shift) { - offset = nb_shift * dynar->elmsize; + unsigned long offset = nb_shift * dynar->elmsize; memmove(_xbt_dynar_elm(dynar, idx), _xbt_dynar_elm(dynar, idx + n), offset); } diff --git a/teshsuite/surf/surf_usage2/surf_usage2.cpp b/teshsuite/surf/surf_usage2/surf_usage2.cpp index 1ce42766a2..0b0f8af6b9 100644 --- a/teshsuite/surf/surf_usage2/surf_usage2.cpp +++ b/teshsuite/surf/surf_usage2/surf_usage2.cpp @@ -13,7 +13,6 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example"); int main(int argc, char **argv) { - double now = -1.0; int running; surf_init(&argc, argv); /* Initialize some common structures */ @@ -40,7 +39,7 @@ int main(int argc, char **argv) surf_action_t action = nullptr; running = 0; - now = surf_get_clock(); + double now = surf_get_clock(); XBT_INFO("Next Event : %g", now); for (auto model: *all_existing_models) {