Kaynağa Gözat

minor fixes following cppcheck warnings

Nathalie Furmento 4 yıl önce
ebeveyn
işleme
6ba0dc87b9

+ 1 - 1
examples/filters/fmultiple_manual.c

@@ -124,7 +124,7 @@ struct starpu_codelet cl_switch =
 
 int main(void)
 {
-	unsigned j, n=1;
+	unsigned n=1;
 	int matrix[NX][NY];
 	int ret, i;
 

+ 1 - 1
examples/filters/fmultiple_submit.c

@@ -98,7 +98,7 @@ struct starpu_codelet cl_check_scale =
 
 int main(void)
 {
-	unsigned j, n=1;
+	unsigned n=1;
 	int matrix[NX][NY];
 	int ret, i;
 

+ 1 - 1
examples/filters/fmultiple_submit_implicit.c

@@ -145,7 +145,7 @@ struct starpu_codelet cl_check =
 int main(void)
 {
 	int start, factor;
-	unsigned j, n=1;
+	unsigned n=1;
 	int matrix[NX][NY];
 	int ret, i;
 

+ 1 - 1
examples/filters/fplan_notautomatic.c

@@ -45,7 +45,7 @@ void task_cpu(void *descr[], void *args)
 
 void split_callback(void *arg)
 {
-	(arg);
+	(void)arg;
 	struct starpu_task *task = starpu_task_get_current();
 	starpu_data_handle_t value_handle, sub_handles[PARTS];
 

+ 2 - 4
examples/matvecmult/matvecmult.c

@@ -127,13 +127,11 @@ static struct starpu_perfmodel starpu_matvecmult_model =
 static struct starpu_codelet cl =
 {
 #ifdef STARPU_USE_OPENCL
-        .opencl_funcs[0] = opencl_codelet,
+        .opencl_funcs = {opencl_codelet},
 	.opencl_flags = {STARPU_OPENCL_ASYNC},
 #endif
         .nbuffers = 3,
-	.modes[0] = STARPU_R,
-	.modes[1] = STARPU_R,
-	.modes[2] = STARPU_RW,
+	.modes = {STARPU_R, STARPU_R, STARPU_RW},
 	.model = &starpu_matvecmult_model
 };
 

+ 0 - 2
examples/reductions/dot_product.c

@@ -186,7 +186,6 @@ void redux_opencl_func(void *buffers[], void *args)
 	{
 		size_t global=1;
                 size_t local=1;
-                size_t s;
                 cl_device_id device;
 
                 starpu_opencl_get_device(devid, &device);
@@ -301,7 +300,6 @@ void dot_opencl_func(void *buffers[], void *cl_arg)
 	{
 		size_t global=1;
                 size_t local=1;
-                size_t s;
                 cl_device_id device;
 
                 starpu_opencl_get_device(devid, &device);

+ 2 - 2
examples/sched_ctx/parallel_tasks_reuse_handle.c

@@ -172,7 +172,7 @@ static struct starpu_codelet sum_cl =
 int main(void)
 {
 	int ntasks = NTASKS;
-	int ret, j, k;
+	int ret;
 	unsigned ncpus = 0;
 
 	ret = starpu_init(NULL);
@@ -207,7 +207,7 @@ int main(void)
 
 	for (i = 0; i < ntasks; i++)
 	{
-		struct starpu_task * t;
+		struct starpu_task *t;
 		t=starpu_task_build(&sum_cl,
 				    STARPU_RW,handle1,
 				    STARPU_R,handle2,

+ 3 - 3
mpi/examples/benchs/bcast_bench.c

@@ -146,7 +146,7 @@ static void dummy_loop(int nb_dest_nodes, starpu_data_handle_t data_handle, int
 			starpu_mpi_wait(&reqs[i], MPI_STATUS_IGNORE);
 		}
 
-		for (int i = 1; i <= nb_dest_nodes; i++)
+		for (i = 1; i <= nb_dest_nodes; i++)
 		{
 			starpu_variable_data_register(&time_handle, STARPU_MAIN_RAM, (uintptr_t) &t_end, sizeof(double));
 			starpu_mpi_recv(time_handle, i, time_tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
@@ -217,8 +217,8 @@ static inline void man()
 int main(int argc, char **argv)
 {
 	int pause_workers = 0;
-	int nb_nodes_id = 0;
-	int size_id = 0;
+	int nb_nodes_id;
+	int size_id;
 	int ret, method, nb_dest_nodes, s, b, i, array_size;
 	starpu_data_handle_t data_handle;
 	float* msg;

+ 2 - 2
mpi/examples/benchs/burst.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2020       Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
+ * Copyright (C) 2020-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -49,7 +49,7 @@ void parse_args(int argc, char **argv)
 
 int main(int argc, char **argv)
 {
-	int ret, rank, other_rank;
+	int ret, rank;
 
 	parse_args(argc, argv);
 

+ 4 - 5
mpi/examples/benchs/burst_helper.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2020       Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
+ * Copyright (C) 2020-2021  Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -86,7 +86,7 @@ void burst_free_data(int rank)
 void burst_bidir(int rank)
 {
 	int other_rank = (rank == 0) ? 1 : 0;
-	int i = 0;
+	int i;
 
 	FPRINTF(stderr, "Simultaneous....start (rank %d)\n", rank);
 
@@ -123,7 +123,7 @@ void burst_bidir(int rank)
 void burst_unidir(int sender, int receiver, int rank)
 {
 	FPRINTF(stderr, "%d -> %d... start (rank %d)\n", sender, receiver, rank);
-	int i = 0;
+	int i;
 
 	if (rank == receiver)
 	{
@@ -163,8 +163,7 @@ void burst_unidir(int sender, int receiver, int rank)
 void burst_bidir_half_postponed(int rank)
 {
 	int other_rank = (rank == 0) ? 1 : 0;
-	int received = 0;
-	int i = 0;
+	int i;
 
 	FPRINTF(stderr, "Half/half burst...start (rank %d)\n", rank);
 

+ 4 - 4
mpi/examples/benchs/gemm_helper.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2020       Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
+ * Copyright (C) 2020-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -292,9 +292,9 @@ void gemm_add_polling_dependencies()
 {
 	starpu_tag_t nb_tasks = (starpu_tag_t) nslices * (starpu_tag_t) nslices;
 	unsigned nb_workers = starpu_worker_get_count();
-	starpu_tag_t synchro_tag = 0;
-	starpu_tag_t previous_tag = 0;
-	starpu_tag_t next_tag = 0;
+	starpu_tag_t synchro_tag;
+	starpu_tag_t previous_tag;
+	starpu_tag_t next_tag;
 
 	for (synchro_tag = nb_workers+1; synchro_tag <= nb_tasks; synchro_tag += (nb_workers+1))
 	{

+ 1 - 1
mpi/examples/cache/cache.c

@@ -73,7 +73,7 @@ void test(struct starpu_codelet *codelet, enum starpu_data_access_mode mode, sta
 
 int main(int argc, char **argv)
 {
-	int rank, n;
+	int rank;
 	int ret;
 	unsigned val = 42;
 	starpu_data_handle_t data;

+ 1 - 1
mpi/examples/cache/cache_disable.c

@@ -34,7 +34,7 @@ struct starpu_codelet mycodelet_r =
 
 int main(int argc, char **argv)
 {
-	int rank, n;
+	int rank;
 	int ret;
 	unsigned *val;
 	starpu_data_handle_t data;

+ 1 - 5
tests/main/insert_task.c

@@ -121,11 +121,7 @@ enodev:
 
 int main(void)
 {
-        int x; float f;
-        int i, ret;
-	int ifactor=12;
-	float ffactor=10.0;
-        starpu_data_handle_t data_handles[2];
+        int ret;
 
 	ret = starpu_init(NULL);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;