From: Martin Quinson Date: Sat, 7 Jan 2017 19:19:10 +0000 (+0100) Subject: please sonar by removing useless asignments and return statements X-Git-Tag: v3_15~576 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9f21f35eadfc5d1f43d3e7a4b591711fd7fb9616 please sonar by removing useless asignments and return statements --- diff --git a/examples/msg/actions-comm/actions-comm.c b/examples/msg/actions-comm/actions-comm.c index b5dcc48b24..e9888db542 100644 --- a/examples/msg/actions-comm/actions-comm.c +++ b/examples/msg/actions-comm/actions-comm.c @@ -280,8 +280,6 @@ static void action_finalize(const char *const *action) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - /* Check the given arguments */ MSG_init(&argc, argv); /* Explicit initialization of the action module is required now*/ @@ -312,7 +310,7 @@ int main(int argc, char *argv[]) xbt_replay_action_register("compute", action_compute); /* Actually do the simulation using MSG_action_trace_run */ - res = MSG_action_trace_run(argv[3]); // it's ok to pass a NULL argument here + msg_error_t res = MSG_action_trace_run(argv[3]); // it's ok to pass a NULL argument here XBT_INFO("Simulation time %g", MSG_get_clock()); diff --git a/examples/msg/actions-storage/actions-storage.c b/examples/msg/actions-storage/actions-storage.c index d975652270..f9b6f64e33 100644 --- a/examples/msg/actions-storage/actions-storage.c +++ b/examples/msg/actions-storage/actions-storage.c @@ -92,10 +92,8 @@ static void action_close(const char *const *action) { } int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - MSG_init(&argc, argv); - /* Explicit initialization of the action module is required now*/ + /* Explicit initialization of the action module is required */ MSG_action_init(); xbt_assert(argc > 3,"Usage: %s platform_file deployment_file [action_files]\n" @@ -114,7 +112,7 @@ int main(int argc, char *argv[]) { if (opened_files == NULL) opened_files = xbt_dict_new_homogeneous(NULL); /* Actually do the simulation using MSG_action_trace_run */ - res = MSG_action_trace_run(argv[3]); // it's ok to pass a NULL argument here + msg_error_t res = MSG_action_trace_run(argv[3]); // it's ok to pass a NULL argument here XBT_INFO("Simulation time %g", MSG_get_clock()); diff --git a/examples/msg/app-bittorrent/peer.c b/examples/msg/app-bittorrent/peer.c index ca5f650d1c..d73560c357 100644 --- a/examples/msg/app-bittorrent/peer.c +++ b/examples/msg/app-bittorrent/peer.c @@ -464,9 +464,7 @@ void update_pieces_count_from_bitfield(peer_t peer, char *bitfield) */ int select_piece_to_download(peer_t peer, connection_t remote_peer) { - int piece = -1; - - piece = partially_downloaded_piece(peer, remote_peer); + int piece = partially_downloaded_piece(peer, remote_peer); // strict priority policy if (piece != -1) return piece; diff --git a/examples/msg/app-chainsend/chainsend.c b/examples/msg/app-chainsend/chainsend.c index e7316ac581..771e52177c 100644 --- a/examples/msg/app-chainsend/chainsend.c +++ b/examples/msg/app-chainsend/chainsend.c @@ -19,8 +19,6 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_chainsend, "Messages specific for chainsend"); int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - MSG_init(&argc, argv); MSG_create_environment(argv[1]); @@ -42,7 +40,7 @@ int main(int argc, char *argv[]) MSG_launch_application(argv[2]); - res = MSG_main(); + msg_error_t res = MSG_main(); XBT_INFO("Total simulation time: %e", MSG_get_clock()); diff --git a/examples/msg/dht-pastry/dht-pastry.c b/examples/msg/dht-pastry/dht-pastry.c index 26e3579a2b..f60180c02b 100644 --- a/examples/msg/dht-pastry/dht-pastry.c +++ b/examples/msg/dht-pastry/dht-pastry.c @@ -137,13 +137,12 @@ static int closest_in_namespace_set(node_t node, int dest) { /* Find the next node to forward a message to */ static int routing_next(node_t node, int dest) { int closest = closest_in_namespace_set(node, dest); - int res = -1; if (closest!=-1) return closest; int l = shl(node->id, dest); - res = node->routing_table[l][domain(dest, l)]; - if (res!=-1) + int res = node->routing_table[l][domain(dest, l)]; + if (res != -1) return res; //rare case diff --git a/examples/msg/energy-consumption/energy-consumption.c b/examples/msg/energy-consumption/energy-consumption.c index c8fa346078..f8985ef64c 100644 --- a/examples/msg/energy-consumption/energy-consumption.c +++ b/examples/msg/energy-consumption/energy-consumption.c @@ -68,7 +68,6 @@ static int dvfs(int argc, char *argv[]) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; sg_energy_plugin_init(); MSG_init(&argc, argv); @@ -77,7 +76,7 @@ int main(int argc, char *argv[]) MSG_create_environment(argv[1]); MSG_process_create("dvfs_test", dvfs, NULL, MSG_get_host_by_name("MyHost1")); - res = MSG_main(); + msg_error_t res = MSG_main(); XBT_INFO("Total simulation time: %.2f", MSG_get_clock()); diff --git a/examples/msg/energy-onoff/energy-onoff.c b/examples/msg/energy-onoff/energy-onoff.c index 5462489bcc..98562d5a66 100644 --- a/examples/msg/energy-onoff/energy-onoff.c +++ b/examples/msg/energy-onoff/energy-onoff.c @@ -84,7 +84,6 @@ static int onoff(int argc, char *argv[]) { int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; sg_energy_plugin_init(); MSG_init(&argc, argv); @@ -94,7 +93,7 @@ int main(int argc, char *argv[]) MSG_process_create("onoff_test", onoff, NULL, MSG_get_host_by_name("MyHost2")); - res = MSG_main(); + msg_error_t res = MSG_main(); XBT_INFO("Total simulation time: %.2f", MSG_get_clock()); diff --git a/examples/msg/energy-pstate/energy-pstate.c b/examples/msg/energy-pstate/energy-pstate.c index fc055b7e22..09019696a7 100644 --- a/examples/msg/energy-pstate/energy-pstate.c +++ b/examples/msg/energy-pstate/energy-pstate.c @@ -69,8 +69,6 @@ static int dvfs(int argc, char *argv[]) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - MSG_init(&argc, argv); xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]); @@ -80,7 +78,7 @@ int main(int argc, char *argv[]) MSG_process_create("dvfs_test", dvfs, NULL, MSG_get_host_by_name("MyHost1")); MSG_process_create("dvfs_test", dvfs, NULL, MSG_get_host_by_name("MyHost2")); - res = MSG_main(); + msg_error_t res = MSG_main(); XBT_INFO("Total simulation time: %e", MSG_get_clock()); diff --git a/examples/msg/energy-vm/energy-vm.c b/examples/msg/energy-vm/energy-vm.c index 752822ac2b..c885f51f5c 100644 --- a/examples/msg/energy-vm/energy-vm.c +++ b/examples/msg/energy-vm/energy-vm.c @@ -58,7 +58,6 @@ static int dvfs(int argc, char *argv[]) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; sg_energy_plugin_init(); MSG_init(&argc, argv); @@ -68,7 +67,7 @@ int main(int argc, char *argv[]) MSG_process_create("dvfs",dvfs,NULL,MSG_host_by_name("MyHost1")); - res = MSG_main(); + msg_error_t res = MSG_main(); XBT_INFO("Total simulation time: %.2f; All hosts must have the exact same energy consumption.", MSG_get_clock()); diff --git a/examples/msg/platform-failures/platform-failures.c b/examples/msg/platform-failures/platform-failures.c index 5e4428548a..1259ff442d 100644 --- a/examples/msg/platform-failures/platform-failures.c +++ b/examples/msg/platform-failures/platform-failures.c @@ -141,8 +141,6 @@ static int worker(int argc, char *argv[]) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - MSG_init(&argc, argv); xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n" "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]); @@ -153,7 +151,7 @@ int main(int argc, char *argv[]) MSG_function_register("worker", worker); MSG_launch_application(argv[2]); - res = MSG_main(); + msg_error_t res = MSG_main(); XBT_INFO("Simulation time %g", MSG_get_clock()); diff --git a/examples/msg/process-kill/process-kill.c b/examples/msg/process-kill/process-kill.c index f83b68a100..534e6d8d68 100644 --- a/examples/msg/process-kill/process-kill.c +++ b/examples/msg/process-kill/process-kill.c @@ -36,8 +36,6 @@ static int killer(int argc, char *argv[]) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - MSG_init(&argc, argv); xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]); @@ -45,7 +43,7 @@ int main(int argc, char *argv[]) /* - Create and deploy killer process, that will create the victim process */ MSG_process_create("killer", killer, NULL, MSG_host_by_name("Tremblay")); - res = MSG_main(); /* - Run the simulation */ + msg_error_t res = MSG_main(); /* - Run the simulation */ XBT_INFO("Simulation time %g", MSG_get_clock()); return res != MSG_OK; diff --git a/examples/msg/process-migration/process-migration.c b/examples/msg/process-migration/process-migration.c index b0f5157ae4..31f6a360a7 100644 --- a/examples/msg/process-migration/process-migration.c +++ b/examples/msg/process-migration/process-migration.c @@ -54,8 +54,6 @@ static int policeman(int argc, char *argv[]) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - MSG_init(&argc, argv); xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]); @@ -64,9 +62,9 @@ int main(int argc, char *argv[]) MSG_process_create("emigrant", emigrant, NULL, MSG_get_host_by_name("Jacquelin")); MSG_process_create("policeman", policeman, NULL, MSG_get_host_by_name("Boivin")); - checkpoint = xbt_mutex_init(); /* - Initiate the mutex and conditions */ + checkpoint = xbt_mutex_init(); /* - Initiate the mutex and conditions */ identification = xbt_cond_init(); - res = MSG_main(); /* - Run the simulation */ + msg_error_t res = MSG_main(); /* - Run the simulation */ XBT_INFO("Simulation time %g", MSG_get_clock()); xbt_cond_destroy(identification); xbt_mutex_destroy(checkpoint); diff --git a/examples/msg/process-startkilltime/process-startkilltime.c b/examples/msg/process-startkilltime/process-startkilltime.c index 287fd11a8d..6e12c39670 100644 --- a/examples/msg/process-startkilltime/process-startkilltime.c +++ b/examples/msg/process-startkilltime/process-startkilltime.c @@ -26,8 +26,6 @@ static int sleeper(int argc, char *argv[]) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - MSG_init(&argc, argv); xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n" "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]); @@ -36,7 +34,7 @@ int main(int argc, char *argv[]) MSG_function_register("sleeper", sleeper); MSG_launch_application(argv[2]); /* - Deploy the sleeper processes with explicit start/kill times */ - res = MSG_main(); /* - Run the simulation */ + msg_error_t res = MSG_main(); /* - Run the simulation */ XBT_INFO("Simulation time %g", MSG_get_clock()); return res != MSG_OK; } diff --git a/examples/msg/process-suspend/process-suspend.c b/examples/msg/process-suspend/process-suspend.c index b4fb807e6a..e38551738b 100644 --- a/examples/msg/process-suspend/process-suspend.c +++ b/examples/msg/process-suspend/process-suspend.c @@ -73,8 +73,6 @@ static int dream_master(int argc, char *argv[]) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - MSG_init(&argc, argv); xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]); @@ -83,7 +81,7 @@ int main(int argc, char *argv[]) xbt_dynar_t hosts = MSG_hosts_as_dynar(); MSG_process_create("dream_master", dream_master, NULL, xbt_dynar_getfirst_as(hosts, msg_host_t)); xbt_dynar_free(&hosts); - res = MSG_main(); /* - Run the simulation */ + msg_error_t res = MSG_main(); /* - Run the simulation */ return res != MSG_OK; } diff --git a/examples/msg/task-priority/task-priority.c b/examples/msg/task-priority/task-priority.c index d852f521ea..a162ffe032 100644 --- a/examples/msg/task-priority/task-priority.c +++ b/examples/msg/task-priority/task-priority.c @@ -24,8 +24,6 @@ static int test(int argc, char *argv[]) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - MSG_init(&argc, argv); xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n" "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]); @@ -34,7 +32,7 @@ int main(int argc, char *argv[]) MSG_function_register("test", test); MSG_launch_application(argv[2]); - res = MSG_main(); + msg_error_t res = MSG_main(); XBT_INFO("Simulation time %g", MSG_get_clock()); diff --git a/src/bindings/java/jmsg.cpp b/src/bindings/java/jmsg.cpp index 66a6ebb3cc..f19a1da799 100644 --- a/src/bindings/java/jmsg.cpp +++ b/src/bindings/java/jmsg.cpp @@ -336,9 +336,7 @@ void java_main_jprocess(jobject jprocess) jprocess_bind(context->jprocess, process, env); // Adrien, ugly path, just to bypass creation of context at low levels (i.e such as for the VM migration for instance) - if (context->jprocess == nullptr) - return; - else + if (context->jprocess != nullptr) run_jprocess(env, context->jprocess); } }}} diff --git a/src/bindings/java/jmsg_comm.cpp b/src/bindings/java/jmsg_comm.cpp index 96ddecf03d..37de834368 100644 --- a/src/bindings/java/jmsg_comm.cpp +++ b/src/bindings/java/jmsg_comm.cpp @@ -115,7 +115,6 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Comm_waitCompletion(JNIEnv *env, job env->SetBooleanField(jcomm, jcomm_field_Comm_finished, JNI_TRUE); if (status == MSG_OK) { jcomm_bind_task(env,jcomm); - return; } else { jmsg_throw_status(env,status); } diff --git a/src/instr/instr_interface.cpp b/src/instr/instr_interface.cpp index 78a41cfe66..6801500b8f 100644 --- a/src/instr/instr_interface.cpp +++ b/src/instr/instr_interface.cpp @@ -277,16 +277,12 @@ static void instr_user_variable(double time, const char *resource, const char *v //check if variable is already declared char *created = (char*)xbt_dict_get_or_null(filter, variable); if (what == INSTR_US_DECLARE){ - if (created){//already declared - return; - }else{ + if (!created) { // not declared yet xbt_dict_set (filter, variable, xbt_strdup("1"), nullptr); instr_new_user_variable_type (father_type, variable, color); } }else{ - if (!created){//not declared, ignore - return; - } else { + if (created) { // declared, let's work char valuestr[100]; snprintf(valuestr, 100, "%g", value); container_t container = PJ_container_get(resource); diff --git a/src/instr/instr_resource_utilization.cpp b/src/instr/instr_resource_utilization.cpp index 70137b6438..c7b0bcdfc2 100644 --- a/src/instr/instr_resource_utilization.cpp +++ b/src/instr/instr_resource_utilization.cpp @@ -71,7 +71,6 @@ void TRACE_surf_link_set_utilization(const char *resource, const char *category, type_t type = PJ_type_get (category_type, container->type); instr_event (now, delta, type, container, value); } - return; } /* TRACE_surf_host_set_utilization: entry point from SimGrid */ @@ -79,9 +78,7 @@ void TRACE_surf_host_set_utilization(const char *resource, const char *category, { //only trace host utilization if host is known by tracing mechanism container_t container = PJ_container_get_or_null(resource); - if (!container) - return; - if (!value) + if (!container || !value) return; //trace uncategorized host utilization @@ -102,7 +99,6 @@ void TRACE_surf_host_set_utilization(const char *resource, const char *category, type_t type = PJ_type_get (category_type, container->type); instr_event (now, delta, type, container, value); } - return; } void TRACE_surf_resource_utilization_alloc() diff --git a/src/kernel/routing/TorusZone.cpp b/src/kernel/routing/TorusZone.cpp index 4c38ff8910..226d0f109f 100644 --- a/src/kernel/routing/TorusZone.cpp +++ b/src/kernel/routing/TorusZone.cpp @@ -223,8 +223,6 @@ void TorusZone::getLocalRoute(NetCard* src, NetCard* dst, sg_platf_route_cbarg_t } free(myCoords); free(targetCoords); - - return; } } } diff --git a/src/mc/simgrid_mc.cpp b/src/mc/simgrid_mc.cpp index a115825b2e..ec20889cc4 100644 --- a/src/mc/simgrid_mc.cpp +++ b/src/mc/simgrid_mc.cpp @@ -64,7 +64,7 @@ int main(int argc, char** argv) // Currently, we need this before sg_config_init: _sg_do_model_check = 1; - // The initialisation function can touch argv. + // The initialization function can touch argv. // We make a copy of argv before modifying it in order to pass the original // value to the model-checked: char** argv_copy = argvdup(argc, argv); diff --git a/src/msg/instr_msg_task.cpp b/src/msg/instr_msg_task.cpp index ae50dfb8ba..65f32a6d66 100644 --- a/src/msg/instr_msg_task.cpp +++ b/src/msg/instr_msg_task.cpp @@ -79,7 +79,6 @@ void TRACE_msg_task_destroy(msg_task_t task) //free category xbt_free(task->category); task->category = nullptr; - return; } /* MSG_task_get related functions */ diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index 30eec19b22..598882c9a2 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -321,7 +321,6 @@ void SIMIX_clean() surf_exit(); simix_global = nullptr; - return; } diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index 989eade224..dab3c2221d 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -319,6 +319,5 @@ void SIMIX_set_category(smx_activity_t synchro, const char *category) simgrid::kernel::activity::Comm *comm = dynamic_cast(synchro); if (comm != nullptr) { comm->surf_comm->setCategory(category); - return; } } diff --git a/src/smpi/smpi_base.cpp b/src/smpi/smpi_base.cpp index b7af99977a..24f5645c72 100644 --- a/src/smpi/smpi_base.cpp +++ b/src/smpi/smpi_base.cpp @@ -816,8 +816,6 @@ void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* nsleeps++; } smpi_mpi_request_free(&request); - - return; } void smpi_mpi_wait(MPI_Request * request, MPI_Status * status) diff --git a/src/smpi/smpi_deployment.cpp b/src/smpi/smpi_deployment.cpp index 2747f0cb47..d9ad5ac1ff 100644 --- a/src/smpi/smpi_deployment.cpp +++ b/src/smpi/smpi_deployment.cpp @@ -51,7 +51,6 @@ void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_ } xbt_dict_set(smpi_instances, name, (void*)instance, nullptr); - return; } //get the index of the process in the process_data array @@ -78,7 +77,6 @@ void smpi_deployment_register_process(const char* instance_id, int rank, int ind smpi_group_set_mapping(smpi_comm_group(instance->comm_world), index, rank); *bar = instance->finalization_barrier; *comm = &instance->comm_world; - return; } void smpi_deployment_cleanup_instances(){ diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index a804bcb990..526ad14920 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -426,7 +426,7 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b void smpi_comm_null_copy_buffer_callback(smx_activity_t comm, void *buff, size_t buff_size) { - return; + /* nothing done in this version */ } static void smpi_check_options(){ @@ -662,7 +662,6 @@ void smpi_global_destroy() void __attribute__ ((weak)) user_main_() { xbt_die("Should not be in this smpi_simulated_main"); - return; } int __attribute__ ((weak)) smpi_simulated_main_(int argc, char **argv) diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 6e9afb51a2..530a2e2928 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -708,7 +708,6 @@ void CpuTiAction::cancel() this->setState(Action::State::failed); xbt_heap_remove(getModel()->getActionHeap(), this->indexHeap_); cpu_->modified(true); - return; } void CpuTiAction::suspend() diff --git a/src/surf/host_clm03.cpp b/src/surf/host_clm03.cpp index 7a4686e6bf..1712ea9121 100644 --- a/src/surf/host_clm03.cpp +++ b/src/surf/host_clm03.cpp @@ -68,7 +68,7 @@ double HostCLM03Model::nextOccuringEvent(double now){ } void HostCLM03Model::updateActionsState(double /*now*/, double /*delta*/){ - return; + /* I won't do what you tell me */ } } diff --git a/src/surf/maxmin.cpp b/src/surf/maxmin.cpp index 623a3b28f5..0c7d57a4dc 100644 --- a/src/surf/maxmin.cpp +++ b/src/surf/maxmin.cpp @@ -1133,7 +1133,6 @@ void lmm_update_variable_weight(lmm_system_t sys, lmm_variable_t var, double wei lmm_check_concurrency(sys); XBT_OUT(); - return; } double lmm_get_variable_weight(lmm_variable_t var) diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 75d41bc77f..b84aa90184 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -216,7 +216,6 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/) action->gapRemove(); } } - return; } diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index f2ae71e1f6..60b919c6d0 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -141,7 +141,6 @@ void HostL07Model::updateActionsState(double /*now*/, double delta) { } } } - return; } Action *HostL07Model::executeParallelTask(int host_nb, sg_host_t *host_list, diff --git a/src/xbt/config.cpp b/src/xbt/config.cpp index 814ec46182..d26c4ec4bb 100644 --- a/src/xbt/config.cpp +++ b/src/xbt/config.cpp @@ -612,7 +612,6 @@ on_missing_key: on_exception: free(optionlist_cpy); THROWF(unknown_error, 0, "Could not set variables %s", options); - return; } // Horrible mess to translate C++ exceptions to C exceptions: diff --git a/src/xbt/cunit.cpp b/src/xbt/cunit.cpp index e699c8502f..d98ac9dc65 100644 --- a/src/xbt/cunit.cpp +++ b/src/xbt/cunit.cpp @@ -233,7 +233,6 @@ void xbt_test_suite_push(xbt_test_suite_t suite, const char *name, ts_test_cb_t unit->tests = xbt_dynar_new(sizeof(xbt_test_test_t), xbt_test_test_free); xbt_dynar_push(suite->units, &unit); - return; } /* run test one suite */ @@ -643,7 +642,6 @@ void _xbt_test_add(const char *file, int line, const char *fmt, ...) test->line = line; test->logs = xbt_dynar_new(sizeof(xbt_test_log_t), xbt_test_log_free); xbt_dynar_push(unit->tests, &test); - return; } /* annotate test case with log message and failure */ diff --git a/src/xbt/dict.cpp b/src/xbt/dict.cpp index c6827205e4..555ecc4035 100644 --- a/src/xbt/dict.cpp +++ b/src/xbt/dict.cpp @@ -135,7 +135,6 @@ static void xbt_dict_rehash(xbt_dict_t dict) if (!*twincell) dict->fill++; *twincell = bucklet; - continue; } else { pprev = &bucklet->next; } diff --git a/src/xbt/fifo.c b/src/xbt/fifo.c index 3f6714bc82..fc747c3e70 100644 --- a/src/xbt/fifo.c +++ b/src/xbt/fifo.c @@ -204,7 +204,6 @@ void xbt_fifo_unshift_item(xbt_fifo_t l, xbt_fifo_item_t new) new->next = l->head; new->next->prev = new; l->head = new; - return; } /** Shift bucket @@ -461,7 +460,6 @@ inline void *xbt_fifo_get_item_content(xbt_fifo_item_t i) inline void xbt_fifo_free_item(xbt_fifo_item_t b) { xbt_mallocator_release(item_mallocator, b); - return; } /** Destructor @@ -471,7 +469,6 @@ inline void xbt_fifo_freeitem(xbt_fifo_item_t b) { XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_free_item."); xbt_fifo_free_item(b); - return; } /** diff --git a/src/xbt/heap.c b/src/xbt/heap.c index 5bfca96009..e32dfc4807 100644 --- a/src/xbt/heap.c +++ b/src/xbt/heap.c @@ -98,7 +98,6 @@ void xbt_heap_push(xbt_heap_t H, void *content, double key) item->content = content; xbt_heap_increase_key(H, count - 1); XBT_DEBUG("Heap has now %d elements and max elem is %g",xbt_heap_size(H),xbt_heap_maxkey(H)); - return; } /** @@ -277,5 +276,4 @@ static void xbt_heap_increase_key(xbt_heap_t H, int i) } if (H->update_callback) H->update_callback(items[i].content, i); - return; } diff --git a/src/xbt/xbt_replay.cpp b/src/xbt/xbt_replay.cpp index 50f208a6ef..2fd02d3d45 100644 --- a/src/xbt/xbt_replay.cpp +++ b/src/xbt/xbt_replay.cpp @@ -233,7 +233,7 @@ static char **action_get_action(char *name) xbt_dynar_push(otherqueue, &evt); } } - goto todo_done; // end of file reached while searching in vain for more work + // end of file reached while searching in vain for more work } else { // Get something from my queue and return it xbt_dynar_shift(myqueue, &evt); diff --git a/teshsuite/msg/get_sender/get_sender.c b/teshsuite/msg/get_sender/get_sender.c index 8cdab2f534..2048b5f2d4 100644 --- a/teshsuite/msg/get_sender/get_sender.c +++ b/teshsuite/msg/get_sender/get_sender.c @@ -30,8 +30,6 @@ static int receiver_fun(int argc, char *argv[]) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - MSG_init(&argc, argv); MSG_create_environment(argv[1]); @@ -39,6 +37,5 @@ int main(int argc, char *argv[]) MSG_process_create("send", sender_fun, NULL, MSG_get_host_by_name("Tremblay")); MSG_process_create("receive", receiver_fun, NULL, MSG_get_host_by_name("Tremblay")); - res = MSG_main(); - return res != MSG_OK; + return MSG_main() != MSG_OK; } diff --git a/teshsuite/msg/pid/pid.c b/teshsuite/msg/pid/pid.c index 3a30fc54a5..540aa6b1b8 100644 --- a/teshsuite/msg/pid/pid.c +++ b/teshsuite/msg/pid/pid.c @@ -45,8 +45,6 @@ static int killall(int argc, char *argv[]){ int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - MSG_init(&argc, argv); MSG_process_killall(atoi(argv[2])); @@ -57,7 +55,5 @@ int main(int argc, char *argv[]) MSG_process_create("sendpid", sendpid, NULL, MSG_get_host_by_name("Tremblay")); MSG_process_create("killall", killall, NULL, MSG_get_host_by_name("Tremblay")); - res = MSG_main(); - - return res != MSG_OK; + return MSG_main() != MSG_OK; } diff --git a/teshsuite/msg/trace_integration/trace_integration.c b/teshsuite/msg/trace_integration/trace_integration.c index c39732a5e8..5fdb1984da 100644 --- a/teshsuite/msg/trace_integration/trace_integration.c +++ b/teshsuite/msg/trace_integration/trace_integration.c @@ -11,13 +11,10 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(test_trace_integration, "Messages specific for this /** test the trace integration cpu model */ static int test_trace(int argc, char *argv[]) { - double task_comp_size = 2800; - double task_prio = 1.0; - xbt_assert (argc == 3,"Wrong number of arguments!\nUsage: %s ", argv[0]); - task_comp_size = xbt_str_parse_double(argv[1],"Invalid computational size: %s"); - task_prio = xbt_str_parse_double(argv[2], "Invalid task priority: %s"); + double task_comp_size = xbt_str_parse_double(argv[1], "Invalid computational size: %s"); + double task_prio = xbt_str_parse_double(argv[2], "Invalid task priority: %s"); XBT_INFO("Testing the trace integration cpu model: CpuTI"); XBT_INFO("Task size: %f", task_comp_size); @@ -36,8 +33,6 @@ static int test_trace(int argc, char *argv[]) int main(int argc, char *argv[]) { - msg_error_t res = MSG_OK; - MSG_init(&argc, argv); xbt_assert(argc > 2, "Usage: %s test_trace_integration_model.xml deployment.xml\n", argv[0]); @@ -45,7 +40,5 @@ int main(int argc, char *argv[]) MSG_create_environment(argv[1]); MSG_launch_application(argv[2]); - res = MSG_main(); - - return res != MSG_OK; + return MSG_main() != MSG_OK; }