From: Arnaud Giersch Date: Thu, 26 May 2011 12:37:07 +0000 (+0200) Subject: Remove unused variables. X-Git-Tag: v3_6_rc3~2^2~11 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3eef4e948ebd9b1d8c9d26a6dedd535109856554 Remove unused variables. Remove variables that are obviously not used. Caught with gcc 4.6 and -Wunused-but-set-variable. --- diff --git a/examples/msg/tracing/categories.c b/examples/msg/tracing/categories.c index 400de0af7c..08d4b3b42e 100644 --- a/examples/msg/tracing/categories.c +++ b/examples/msg/tracing/categories.c @@ -56,10 +56,9 @@ int master(int argc, char *argv[]) int slave(int argc, char *argv[]) { m_task_t task = NULL; - int res; while (1) { - res = MSG_task_receive(&(task), "master_mailbox"); + MSG_task_receive(&(task), "master_mailbox"); if (!strcmp(MSG_task_get_name(task), "finalize")) { MSG_task_destroy(task); diff --git a/examples/msg/tracing/ms.c b/examples/msg/tracing/ms.c index 54661e0669..77e586b755 100644 --- a/examples/msg/tracing/ms.c +++ b/examples/msg/tracing/ms.c @@ -59,11 +59,10 @@ int master(int argc, char *argv[]) int slave(int argc, char *argv[]) { m_task_t task = NULL; - int res; TRACE_host_variable_set(MSG_host_self()->name, "is_slave", 1); while (1) { - res = MSG_task_receive(&(task), "master_mailbox"); + MSG_task_receive(&(task), "master_mailbox"); if (!strcmp(MSG_task_get_name(task), "finalize")) { MSG_task_destroy(task); diff --git a/examples/simdag/scheduling/minmin_test.c b/examples/simdag/scheduling/minmin_test.c index 08d324ed88..089066555b 100644 --- a/examples/simdag/scheduling/minmin_test.c +++ b/examples/simdag/scheduling/minmin_test.c @@ -80,7 +80,6 @@ static double finish_on_at(SD_task_t task, SD_workstation_t workstation) SD_task_t parent, grand_parent; xbt_dynar_t parents, grand_parents; - int grand_parent_nworkstations; SD_workstation_t *grand_parent_workstation_list; parents = SD_task_get_parents(task); @@ -100,8 +99,6 @@ static double finish_on_at(SD_task_t task, SD_workstation_t workstation) } xbt_dynar_get_cpy(grand_parents, 0, &grand_parent); - grand_parent_nworkstations = - SD_task_get_workstation_count(grand_parent); grand_parent_workstation_list = SD_task_get_workstation_list(grand_parent); /* Estimate the redistribution time from this parent */ @@ -236,7 +233,7 @@ static void output_xml(FILE * out, xbt_dynar_t dax) int main(int argc, char **argv) { - unsigned int cursor, selected_idx = 0; + unsigned int cursor; double finish_time, min_finish_time = -1.0; SD_task_t task, selected_task = NULL; xbt_dynar_t ready_tasks; @@ -314,7 +311,6 @@ int main(int argc, char **argv) min_finish_time = finish_time; selected_task = task; selected_workstation = workstation; - selected_idx = cursor; } } diff --git a/src/gras/gras.c b/src/gras/gras.c index 33adad5d44..503651b098 100644 --- a/src/gras/gras.c +++ b/src/gras/gras.c @@ -145,11 +145,9 @@ void gras_init(int *argc, char **argv) void gras_exit(void) { - gras_procdata_t *pd; XBT_INFO("Exiting GRAS"); amok_exit(); gras_moddata_leave(); - pd = gras_procdata_get(); gras_msg_listener_shutdown(); gras_process_exit(); if (--gras_running_process == 0) { diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index 3d6b456d19..d1945536a1 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -476,13 +476,12 @@ void smpi_mpi_allgatherv(void *sendbuf, int sendcount, MPI_Datatype recvtype, MPI_Comm comm) { int system_tag = 666; - int rank, size, other, index, sendsize, recvsize; + int rank, size, other, index, sendsize; MPI_Request *requests; rank = smpi_comm_rank(comm); size = smpi_comm_size(comm); sendsize = smpi_datatype_size(sendtype); - recvsize = smpi_datatype_size(recvtype); // Local copy from self memcpy(&((char *) recvbuf)[displs[rank]], sendbuf, sendcount * sendsize * sizeof(char)); @@ -552,7 +551,7 @@ void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm) { int system_tag = 666; - int rank, size, dst, index, sendsize, recvsize; + int rank, size, dst, index, recvsize; MPI_Request *requests; rank = smpi_comm_rank(comm); @@ -562,7 +561,6 @@ void smpi_mpi_scatterv(void *sendbuf, int *sendcounts, int *displs, smpi_mpi_recv(recvbuf, recvcount, recvtype, root, system_tag, comm, MPI_STATUS_IGNORE); } else { - sendsize = smpi_datatype_size(sendtype); recvsize = smpi_datatype_size(recvtype); // Local copy from root memcpy(recvbuf, &((char *) sendbuf)[displs[root]], diff --git a/src/surf/fair_bottleneck.c b/src/surf/fair_bottleneck.c index 9ddb5a690e..ce44b58fb0 100644 --- a/src/surf/fair_bottleneck.c +++ b/src/surf/fair_bottleneck.c @@ -27,7 +27,6 @@ void bottleneck_solve(lmm_system_t sys) xbt_swag_t cnst_list = NULL; xbt_swag_t var_list = NULL; xbt_swag_t elem_list = NULL; - double min_usage = -1; int i; static s_xbt_swag_t cnst_to_update; @@ -87,7 +86,6 @@ void bottleneck_solve(lmm_system_t sys) } XBT_DEBUG("******* Constraints to process: %d *******", xbt_swag_size(cnst_list)); - min_usage = -1; xbt_swag_foreach_safe(cnst, cnst_next, cnst_list) { int nb = 0; XBT_DEBUG("Processing cnst %p ", cnst); diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 702ef14088..9adc4541ab 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -1179,9 +1179,8 @@ route_extended_t generic_get_bypassroute(routing_component_t rc, current_src = xbt_dynar_get_ptr(path_src, index_src); current_dst = xbt_dynar_get_ptr(path_dst, index_dst); while (index_src >= 0 && index_dst >= 0 && *current_src == *current_dst) { - routing_component_t *tmp_src, *tmp_dst; - tmp_src = xbt_dynar_pop_ptr(path_src); - tmp_dst = xbt_dynar_pop_ptr(path_dst); + xbt_dynar_pop_ptr(path_src); + xbt_dynar_pop_ptr(path_dst); index_src--; index_dst--; current_src = xbt_dynar_get_ptr(path_src, index_src); diff --git a/src/surf/surf_routing_dijkstra.c b/src/surf/surf_routing_dijkstra.c index 60e055bed0..4a049a4390 100644 --- a/src/surf/surf_routing_dijkstra.c +++ b/src/surf/surf_routing_dijkstra.c @@ -330,8 +330,7 @@ static route_extended_t dijkstra_get_route(routing_component_t rc, } /* compose route path with links */ - char *gw_src = NULL, *gw_dst = - NULL, *prev_gw_src, *prev_gw_dst, *first_gw = NULL; + char *gw_src = NULL, *gw_dst = NULL, *prev_gw_src, *first_gw = NULL; for (v = dst_node_id; v != src_node_id; v = pred_arr[v]) { xbt_node_t node_pred_v = @@ -344,7 +343,6 @@ static route_extended_t dijkstra_get_route(routing_component_t rc, *dst_id); prev_gw_src = gw_src; - prev_gw_dst = gw_dst; e_route = (route_extended_t) xbt_graph_edge_get_data(edge); gw_src = e_route->src_gateway; diff --git a/src/surf/surf_routing_floyd.c b/src/surf/surf_routing_floyd.c index bda5d5f2f6..e744b8670e 100644 --- a/src/surf/surf_routing_floyd.c +++ b/src/surf/surf_routing_floyd.c @@ -95,8 +95,7 @@ static route_extended_t floyd_get_route(routing_component_t rc, int first = 1; int pred = *dst_id; int prev_pred = 0; - char *gw_src = NULL, *gw_dst = - NULL, *prev_gw_src, *prev_gw_dst, *first_gw = NULL; + char *gw_src = NULL, *gw_dst = NULL, *prev_gw_src, *first_gw = NULL; unsigned int cpt; void *link; xbt_dynar_t links; @@ -111,7 +110,6 @@ static route_extended_t floyd_get_route(routing_component_t rc, dst); prev_gw_src = gw_src; - prev_gw_dst = gw_dst; route_extended_t e_route = TO_FLOYD_LINK(pred, prev_pred); gw_src = e_route->src_gateway; diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 82c8a9c15a..5bf48fabb0 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -1248,7 +1248,7 @@ static int countelems(xbt_dict_t head) XBT_TEST_UNIT("crash", test_dict_crash, "Crash test") { xbt_dict_t head = NULL; - int i, j, k, nb; + int i, j, k; char *key; void *data; @@ -1263,7 +1263,6 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test") SIZEOFKEY); head = xbt_dict_new(); /* if (i%10) printf("."); else printf("%d",i/10); fflush(stdout); */ - nb = 0; for (j = 0; j < 1000; j++) { char *data = NULL; key = xbt_malloc(SIZEOFKEY); diff --git a/src/xbt/graph.c b/src/xbt/graph.c index b81e0d409a..14ed08dc52 100644 --- a/src/xbt/graph.c +++ b/src/xbt/graph.c @@ -785,8 +785,7 @@ xbt_graph_t xbt_graph_load (const char *filename) xbt_node_t source = xbt_dict_get (nodes_dict, node_source); xbt_node_t target = xbt_dict_get (nodes_dict, node_target); - xbt_edge_t e; - e = xbt_graph_new_edge (ret, source, target, xbt_strdup(edge_id)); + xbt_graph_new_edge (ret, source, target, xbt_strdup(edge_id)); } xbt_dict_free (&nodes_dict); return ret; diff --git a/src/xbt/parmap.c b/src/xbt/parmap.c index a472c2fe83..c88a26ba49 100644 --- a/src/xbt/parmap.c +++ b/src/xbt/parmap.c @@ -163,10 +163,8 @@ void xbt_event_wait(xbt_event_t event) void xbt_event_end(xbt_event_t event) { - int myflag; unsigned int mycount; - myflag = event->work; mycount = __sync_add_and_fetch(&event->thread_counter, 1); if(mycount == event->threads_to_wait){ event->done++; diff --git a/teshsuite/gras/msg_handle/msg_handle.c b/teshsuite/gras/msg_handle/msg_handle.c index dcc37ce412..2ded662f7d 100644 --- a/teshsuite/gras/msg_handle/msg_handle.c +++ b/teshsuite/gras/msg_handle/msg_handle.c @@ -116,10 +116,7 @@ int client(int argc, char *argv[]) gras_socket_t me = NULL, pal = NULL; int myport; char *palstr; - xbt_ex_t e; - int got_expected; - gras_init(&argc, argv); xbt_assert(argc == 3, "Usage: client "); @@ -144,7 +141,6 @@ int client(int argc, char *argv[]) XBT_INFO("Initialization done."); /* Launch handle(-1). Lock until message from server expected */ - got_expected = 0; TRY { gras_msg_handle(-1); } CATCH(e) { diff --git a/testsuite/surf/surf_usage.c b/testsuite/surf/surf_usage.c index 2d88528ac8..a3dc2cabf5 100644 --- a/testsuite/surf/surf_usage.c +++ b/testsuite/surf/surf_usage.c @@ -47,7 +47,6 @@ void test(char *platform) surf_action_t actionA = NULL; surf_action_t actionB = NULL; surf_action_t actionC = NULL; - surf_action_t commAB = NULL; e_surf_action_state_t stateActionA; e_surf_action_state_t stateActionB; e_surf_action_state_t stateActionC; @@ -91,9 +90,8 @@ void test(char *platform) XBT_DEBUG("%s : %p", surf_resource_name(cardB), cardB); /* Let's do something on it */ - commAB = - surf_network_model->extension.network.communicate("Cpu A", "Cpu B", - 150.0, -1.0); + surf_network_model->extension.network.communicate("Cpu A", "Cpu B", + 150.0, -1.0); surf_solve(-1.0); /* Takes traces into account. Returns 0.0 */ do { diff --git a/testsuite/surf/surf_usage2.c b/testsuite/surf/surf_usage2.c index 5c10de061c..3dcab9697a 100644 --- a/testsuite/surf/surf_usage2.c +++ b/testsuite/surf/surf_usage2.c @@ -42,10 +42,6 @@ void test(char *platform) { void *workstationA = NULL; void *workstationB = NULL; - surf_action_t actionA = NULL; - surf_action_t actionB = NULL; - surf_action_t actionC = NULL; - surf_action_t commAB = NULL; double now = -1.0; int running; @@ -71,18 +67,11 @@ void test(char *platform) XBT_DEBUG("%s : %p", surf_resource_name(workstationB), workstationB); /* Let's do something on it */ - actionA = - surf_workstation_model->extension.workstation.execute(workstationA, - 1000.0); - actionB = - surf_workstation_model->extension.workstation.execute(workstationB, - 1000.0); - actionC = - surf_workstation_model->extension.workstation.sleep(workstationB, - 7.32); - - commAB = - surf_workstation_model->extension.workstation. + surf_workstation_model->extension.workstation.execute(workstationA, 1000.0); + surf_workstation_model->extension.workstation.execute(workstationB, 1000.0); + surf_workstation_model->extension.workstation.sleep(workstationB, 7.32); + + surf_workstation_model->extension.workstation. communicate(workstationA, workstationB, 150.0, -1.0); surf_solve(-1.0); /* Takes traces into account. Returns 0.0 */