Selaa lähdekoodia

small fixes for cppcheck warnings

Nathalie Furmento 6 vuotta sitten
vanhempi
commit
9ea956b790

+ 2 - 2
examples/lu/xlu_implicit_pivot.c

@@ -3,7 +3,7 @@
  * Copyright (C) 2010-2015,2017,2018                      Université de Bordeaux
  * Copyright (C) 2013                                     Inria
  * Copyright (C) 2010                                     Mehdi Juhoor
- * Copyright (C) 2010-2013,2015-2018                      CNRS
+ * Copyright (C) 2010-2013,2015-2019                      CNRS
  *
  * 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
@@ -300,7 +300,7 @@ int STARPU_LU(lu_decomposition_pivot)(TYPE *matA, unsigned *ipiv, unsigned size,
 	starpu_data_unregister(dataA);
 
 	free(piv_description);
-	return ret;
+	return 0;
 }
 
 

+ 2 - 3
examples/reductions/dot_product_opencl_kernels.cl

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2012                                     Inria
- * Copyright (C) 2012,2015,2017                           CNRS
+ * Copyright (C) 2012,2015,2017,2019                      CNRS
  * Copyright (C) 2015                                     Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -25,7 +25,6 @@
 __kernel void _redux_opencl(__global DOT_TYPE *dota,
 			    __global DOT_TYPE *dotb)
 {
-        const int i = get_global_id(0);
 	*dota += *dotb;
 }
 
@@ -39,6 +38,6 @@ __kernel void _dot_opencl(__global float *x,
 	tmp = 0.0;
 	for (i = 0; i < n ; i++)
 		tmp += x[i]*y[i];
-		
+
 	*dot += tmp;
 }

+ 3 - 3
examples/sched_ctx/nested_sched_ctxs.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2014,2017                                Inria
- * Copyright (C) 2010-2017                                CNRS
+ * Copyright (C) 2010-2017, 2019                          CNRS
  * Copyright (C) 2010-2015                                Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -127,9 +127,9 @@ int main(void)
 //	starpu_sched_ctx_set_inheritor(sched_ctx2, sched_ctx1);
 
 	int nprocs3 = nprocs1/2;
-	int nprocs4 = nprocs1/2;
+	int nprocs4 = nprocs3;
 	int nprocs5 = nprocs2/2;
-	int nprocs6 = nprocs2/2;
+	int nprocs6 = nprocs5;
 	int *procs3 = NULL;
 	int *procs4 = NULL;
 	int *procs5 = NULL;

+ 1 - 2
examples/sched_ctx_utils/sched_ctx_utils.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2011-2013                                Inria
- * Copyright (C) 2012,2013,2016,2017                      CNRS
+ * Copyright (C) 2012,2013,2016,2017,2019                 CNRS
  * Copyright (C) 2010-2012,2014                           Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -70,7 +70,6 @@ void init()
 	rv[0].flops = 0.0;
 	rv[1].flops = 0.0;
 	rv[1].avg_timing = 0.0;
-	rv[1].avg_timing = 0.0;
 
 	p1.ctx = 0;
 	p2.ctx = 0;

+ 10 - 10
examples/stencil/implicit-stencil-blocks.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2016,2017                                Inria
- * Copyright (C) 2016,2017                                CNRS
+ * Copyright (C) 2016,2017,2019                           CNRS
  * Copyright (C) 2010,2013-2017                           Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -178,15 +178,15 @@ void assign_blocks_to_workers(int rank)
 	/*unsigned nworkers = starpu_worker_get_count();*/
 
 	/* how many blocks are on that MPI node ? */
-	unsigned nblocks = 0;
-	for (bz = 0; bz < nbz; bz++)
-	{
-		struct block_description *block =
-				get_block_description(bz);
-
-		if (block->mpi_node == rank)
-			nblocks++;
-	}
+//	unsigned nblocks = 0;
+//	for (bz = 0; bz < nbz; bz++)
+//	{
+//		struct block_description *block =
+//				get_block_description(bz);
+//
+//		if (block->mpi_node == rank)
+//			nblocks++;
+//	}
 
 	/* how many blocks per worker ? */
 	/*unsigned nblocks_per_worker = (nblocks + nworkers - 1)/nworkers;*/

+ 10 - 10
examples/stencil/stencil-blocks.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010,2011,2013-2017                      Université de Bordeaux
  * Copyright (C) 2013                                     Inria
- * Copyright (C) 2011,2013,2015-2017                      CNRS
+ * Copyright (C) 2011,2013,2015-2017,2019                 CNRS
  *
  * 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
@@ -179,15 +179,15 @@ void assign_blocks_to_workers(int rank)
 	/*unsigned nworkers = starpu_worker_get_count();*/
 
 	/* how many blocks are on that MPI node ? */
-	unsigned nblocks = 0;
-	for (bz = 0; bz < nbz; bz++)
-	{
-		struct block_description *block =
-				get_block_description(bz);
-
-		if (block->mpi_node == rank)
-			nblocks++;
-	}
+//	unsigned nblocks = 0;
+//	for (bz = 0; bz < nbz; bz++)
+//	{
+//		struct block_description *block =
+//				get_block_description(bz);
+//
+//		if (block->mpi_node == rank)
+//			nblocks++;
+//	}
 
 	/* how many blocks per worker ? */
 	/*unsigned nblocks_per_worker = (nblocks + nworkers - 1)/nworkers;*/

+ 1 - 3
mpi/src/load_balancer/policy/load_heat_propagation.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2016                                     Inria
- * Copyright (C) 2017                                     CNRS
+ * Copyright (C) 2017,2019                                CNRS
  * Copyright (C) 2017                                     Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -569,13 +569,11 @@ static int deinit_heat()
 		int *tags = data_movements_get_tags_table(data_movements_handles[my_rank]);
 		int *ranks = data_movements_get_ranks_table(data_movements_handles[my_rank]);
 
-		int n = 0;
 		struct moved_data_entry *md, *tmp;
 		HASH_ITER(hh, mdh, md, tmp)
 		{
 			tags[n] = starpu_mpi_data_get_tag(md->handle);
 			ranks[n] = my_rank;
-			n++;
 		}
 	}
 	else

+ 2 - 2
socl/examples/basic/basic.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012,2013,2015,2017                      CNRS
+ * Copyright (C) 2012,2013,2015,2017,2019                 CNRS
  * Copyright (C) 2010-2013                                Université de Bordeaux
  * Copyright (C) 2012                                     Inria
  *
@@ -87,7 +87,7 @@ int main(int UNUSED(argc), char** UNUSED(argv)) {
    }
 
    printf("Querying platform...\n");
-   err = clGetPlatformIDs(0, NULL, &num_platforms);
+   clGetPlatformIDs(0, NULL, &num_platforms);
    if (num_platforms == 0) {
       printf("No OpenCL platform found.\n");
       exit(77);

+ 2 - 2
socl/examples/basicsplit/basicsplit.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2015,2017                                CNRS
+ * Copyright (C) 2015,2017,2019                           CNRS
  * Copyright (C) 2010,2011,2013                           Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -140,7 +140,7 @@ int main(int UNUSED(argc), char** UNUSED(argv)) {
    }
 
    printf("Querying platform...\n");
-   err = clGetPlatformIDs(0, NULL, &num_platforms);
+   clGetPlatformIDs(0, NULL, &num_platforms);
    if (num_platforms == 0) {
       printf("No OpenCL platform found.\n");
       exit(77);

+ 2 - 2
socl/examples/mandelbrot/mandelbrot.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012,2015,2017                           CNRS
+ * Copyright (C) 2012,2015,2017,2019                      CNRS
  * Copyright (C) 2012                                     Inria
  * Copyright (C) 2010,2011                                Université de Bordeaux
  *
@@ -320,7 +320,7 @@ int main(int argc, char **argv) {
   assert((height % nblocks) == 0);
   assert((width % group_size) == 0);
 
-  err = clGetPlatformIDs(0, NULL, &num_platforms);
+  clGetPlatformIDs(0, NULL, &num_platforms);
   if (num_platforms == 0) {
     printf("No OpenCL platform found\n");
     exit(0);

+ 2 - 2
socl/examples/mansched/mansched.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012,2013,2015,2017                      CNRS
+ * Copyright (C) 2012,2013,2015,2017,2019                 CNRS
  * Copyright (C) 2010-2012                                Université de Bordeaux
  * Copyright (C) 2012                                     Inria
  *
@@ -77,7 +77,7 @@ int main(int UNUSED(argc), char** UNUSED(argv)) {
    }
 
    printf("Querying platform...\n");
-   err = clGetPlatformIDs(0, NULL, &num_platforms);
+   clGetPlatformIDs(0, NULL, &num_platforms);
    if (num_platforms == 0) {
       printf("No OpenCL platform found.\n");
       exit(77);

+ 2 - 2
socl/examples/testmap/testmap.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2013,2015,2017                           CNRS
+ * Copyright (C) 2013,2015,2017,2019                      CNRS
  * Copyright (C) 2010,2011,2013                           Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -78,7 +78,7 @@ int main(int UNUSED(argc), char** UNUSED(argv)) {
    TYPE * s1, *s2, d[SIZE];
 
    printf("Querying platform...\n");
-   err = clGetPlatformIDs(0, NULL, &num_platforms);
+   clGetPlatformIDs(0, NULL, &num_platforms);
    if (num_platforms == 0) {
       printf("No OpenCL platform found.\n");
       exit(77);

+ 2 - 2
socl/src/cl_createcontext.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012,2013,2017                           CNRS
+ * Copyright (C) 2012,2013,2017,2019                      CNRS
  * Copyright (C) 2010-2013,2018                           Université de Bordeaux
  * Copyright (C) 2011                                     Inria
  *
@@ -62,7 +62,7 @@ soclCreateContext(const cl_context_properties * properties,
 			{
 			case CL_CONTEXT_PLATFORM:
 				i++;
-				if (p[i] != (cl_context_properties)&socl_platform)
+				if (p[i] != ((cl_context_properties)&socl_platform))
 				{
 					if (errcode_ret != NULL)
 						*errcode_ret = CL_INVALID_PLATFORM;

+ 3 - 3
src/core/disk_ops/disk_hdf5.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2017                                     CNRS
+ * Copyright (C) 2017, 2019                               CNRS
  * Copyright (C) 2017                                     Inria
  * Copyright (C) 2017                                     Université de Bordeaux
  *
@@ -186,7 +186,7 @@ static void starpu_hdf5_read_internal(struct _starpu_hdf5_work * work)
         /* Receiver has to be an hyperslabs */
         offsets[0] = 0;
         count[0] = work->size;
-        status = H5Sselect_hyperslab(dataspace_receive, H5S_SELECT_SET, offsets, NULL, count, NULL);
+        H5Sselect_hyperslab(dataspace_receive, H5S_SELECT_SET, offsets, NULL, count, NULL);
         STARPU_ASSERT_MSG(dataspace_receive >= 0, "Error when reading this HDF5 dataset (%s)\n", work->obj_src->path);
 
         status = H5Dread(work->obj_src->dataset, datatype, dataspace_receive, dataspace_select, H5P_DEFAULT, work->ptr);
@@ -240,7 +240,7 @@ static void starpu_hdf5_write_internal(struct _starpu_hdf5_work * work)
         /* Receiver has to be an hyperslabs */
         offsets[0] = 0;
         count[0] = work->size;
-        status = H5Sselect_hyperslab(dataspace_send, H5S_SELECT_SET, offsets, NULL, count, NULL);
+        H5Sselect_hyperslab(dataspace_send, H5S_SELECT_SET, offsets, NULL, count, NULL);
         STARPU_ASSERT_MSG(dataspace_send >= 0, "Error when writing this HDF5 dataset (%s)\n", work->obj_dst->path);
 
         status = H5Dwrite(work->obj_dst->dataset, datatype, dataspace_send, dataspace_select, H5P_DEFAULT, work->ptr);

+ 13 - 17
src/debug/traces/starpu_fxt.c

@@ -4,7 +4,7 @@
  * Copyright (C) 2009-2018                                Université de Bordeaux
  * Copyright (C) 2013                                     Joris Pablo
  * Copyright (C) 2017,2018                                Federal University of Rio Grande do Sul (UFRGS)
- * Copyright (C) 2011-2018                                CNRS
+ * Copyright (C) 2011-2019                                CNRS
  * Copyright (C) 2013                                     Thibaut Lambert
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -2563,9 +2563,8 @@ static void handle_job_push(struct fxt_ev_64 *ev, struct starpu_fxt_options *opt
 {
 	double current_timestamp = get_event_time_stamp(ev, options);
 
-       unsigned task = ev->param[0];
-       char *prefix = options->file_prefix;
-       
+	unsigned task = ev->param[0];
+
 	curq_size++;
 
 	_starpu_fxt_component_update_ntasks(nsubmitted, curq_size);
@@ -2583,23 +2582,20 @@ static void handle_job_push(struct fxt_ev_64 *ev, struct starpu_fxt_options *opt
                snprintf(container, sizeof(container), "%sp", options->file_prefix);
                poti_NewEvent(get_event_time_stamp(ev, options), container, "pu", paje_value);
 #else
-		fprintf(out_paje_file, "13	%.9f	%ssched	nready	%f\n", current_timestamp, options->file_prefix, (float)curq_size);
-               fprintf(out_paje_file, "9       %.9f    %s      %sp     %u\n", get_event_time_stamp(ev, options), "pu", prefix, task);
+	       fprintf(out_paje_file, "13	%.9f	%ssched	nready	%f\n", current_timestamp, options->file_prefix, (float)curq_size);
+               fprintf(out_paje_file, "9       %.9f    %s      %sp     %u\n", get_event_time_stamp(ev, options), "pu", options->file_prefix, task);
 #endif
 	}
 
 	if (activity_file)
-	fprintf(activity_file, "cnt_ready\t%.9f\t%d\n", current_timestamp, curq_size);
+		fprintf(activity_file, "cnt_ready\t%.9f\t%d\n", current_timestamp, curq_size);
 }
 
 
 static void handle_job_pop(struct fxt_ev_64 *ev, struct starpu_fxt_options *options)
 {
 	double current_timestamp = get_event_time_stamp(ev, options);
-
-       unsigned task = ev->param[0];
-       char *prefix = options->file_prefix;
-       
+	unsigned task = ev->param[0];
 
 	curq_size--;
 	nsubmitted--;
@@ -2611,16 +2607,16 @@ static void handle_job_pop(struct fxt_ev_64 *ev, struct starpu_fxt_options *opti
 		char container[STARPU_POTI_STR_LEN];
 		scheduler_container_alias(container, STARPU_POTI_STR_LEN, options->file_prefix);
 		poti_SetVariable(current_timestamp, container, "nready", (double)curq_size);
-	poti_SetVariable(current_timestamp, container, "nsubmitted", (double)nsubmitted);
+		poti_SetVariable(current_timestamp, container, "nsubmitted", (double)nsubmitted);
 
-               char paje_value[STARPU_POTI_STR_LEN];
-               snprintf(paje_value, sizeof(paje_value), "%u", task);
-               snprintf(container, sizeof(container), "%sp", options->file_prefix);
-               poti_NewEvent(get_event_time_stamp(ev, options), container, "po", paje_value);
+		char paje_value[STARPU_POTI_STR_LEN];
+		snprintf(paje_value, sizeof(paje_value), "%u", task);
+		snprintf(container, sizeof(container), "%sp", options->file_prefix);
+		poti_NewEvent(get_event_time_stamp(ev, options), container, "po", paje_value);
 #else
 		fprintf(out_paje_file, "13	%.9f	%ssched	nready	%f\n", current_timestamp, options->file_prefix, (float)curq_size);
 		fprintf(out_paje_file, "13	%.9f	%ssched	nsubmitted	%f\n", current_timestamp, options->file_prefix, (float)nsubmitted);
-               fprintf(out_paje_file, "9       %.9f    %s      %sp     %u\n", get_event_time_stamp(ev, options), "po", prefix, task);
+		fprintf(out_paje_file, "9       %.9f    %s      %sp     %u\n", get_event_time_stamp(ev, options), "po", options->file_prefix, task);
 #endif
 	}
 

+ 2 - 2
tests/main/starpu_init.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2012                                     Inria
- * Copyright (C) 2012-2015,2017                           CNRS
+ * Copyright (C) 2012-2015,2017,2019                      CNRS
  * Copyright (C) 2012-2017                                Université de Bordeaux
  * Copyright (C) 2013                                     Thibaut Lambert
  *
@@ -124,7 +124,7 @@ int main(void)
 	ret = check_cpu(cpu_test3, cpu_test1, cpu_test3, &cpu);
 	if (ret) return ret;
 
-	STARPU_RETURN(ret);
+	return 0;
 }
 
  #endif

+ 15 - 9
tools/dev/cppcheck/suppressions.txt

@@ -1,6 +1,6 @@
 // StarPU --- Runtime system for heterogeneous multicore architectures.
 //
-// Copyright (C) 2017,2018                                CNRS
+// Copyright (C) 2017,2018,2019                           CNRS
 // Copyright (C) 2017,2018                                Université de Bordeaux
 // Copyright (C) 2017                                     Inria
 //
@@ -18,6 +18,10 @@
 knownConditionTrueFalse
 variableScope
 ConfigurationNotChecked
+shadowVar
+unusedFunction
+unmatchedSuppression
+unusedStructMember
 
 *:starpufft/*
 *:min-dgels/*
@@ -30,6 +34,7 @@ ConfigurationNotChecked
 varFuncNullUB:examples/sched_ctx/two_cpu_contexts.c:76
 negativeIndex:examples/stencil/stencil-tasks.c
 constStatement:examples/stencil/*
+shiftTooManyBitsSigned:examples/pi/SobolQRNG/sobol_gold.c:88
 
 unreadVariable:tests/openmp/*
 unusedLabel:tests/datawizard/gpu_register.c
@@ -45,18 +50,12 @@ unreadVariable:tests/datawizard/variable_size.c
 uselessAssignmentPtrArg:mpi/src/starpu_mpi.c:171
 unreadVariable:mpi/src/starpu_mpi.c:971
 unusedVariable:mpi/src/starpu_mpi.c:972
-redundantAssignment:src/core/workers.c
 
+redundantAssignment:src/core/workers.c
 invalidPointerCast:src/core/perfmodel/perfmodel_nan.c:74
 unreadVariable:src/core/dependencies/tags.c:111
 uselessAssignmentPtrArg:src/core/sched_ctx_list.c:144
-unusedStructMember:src/core/perfmodel/perfmodel_bus.c:62
-unusedStructMember:src/core/perfmodel/perfmodel_bus.c:63
-unusedStructMember:src/core/perfmodel/perfmodel_bus.c:64
-unusedStructMember:src/core/perfmodel/perfmodel_bus.c:65
-unusedStructMember:src/core/perfmodel/perfmodel_bus.c:66
-unusedStructMember:src/core/simgrid.c:225
-unusedStructMember:src/core/simgrid.c:226
+
 wrongPrintfScanfArgNum:src/core/simgrid.c:1024
 duplicateExpression:src/util/starpu_task_insert.c:52
 
@@ -79,6 +78,13 @@ negativeIndex:gcc-plugin/src/*
 
 pointerSize:socl/src/cl_getcontextinfo.c:33
 
+// the following warnings are weird and not understandable, let's ignore them
+ignoredReturnValue:socl/src/cl_createkernel.c:170
+leakReturnValNotUsed:socl/src/cl_createkernel.c:170
+ignoredReturnValue:socl/src/cl_createprogramwithsource.c:136
+leakReturnValNotUsed:socl/src/cl_createprogramwithsource.c:136
+
 redundantAssignment:src/sched_policies/component_eager.c:109
 
 nullPointerRedundantCheck:src/datawizard/copy_driver.c:682
+