Browse Source

minor fixes for cppcheck warnings

Nathalie Furmento 6 years ago
parent
commit
5983f9f199

+ 3 - 3
gcc-plugin/examples/matrix-mult.c

@@ -159,10 +159,10 @@ main (int argc, char **argv)
       return EXIT_FAILURE;
     }
 
-  fprintf (stderr, "running %d loops with %lux%lux%lu matrices and %lux%lux%lu blocks...\n",
+  fprintf (stderr, "running %d loops with %ldx%ldx%ld matrices and %ldx%ldx%ld blocks...\n",
 	   nloop,
-	   xdim, ydim, zdim,
-	   bxdim, bydim, bzdim);
+	   (long)xdim, (long)ydim, (long)zdim,
+	   (long)bxdim, (long)bydim, (long)bzdim);
 
   double computetime[nloop];
   double starttaskstime[nloop];

+ 3 - 3
mpi/src/starpu_mpi_cache_stats.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014-2017                                CNRS
+ * Copyright (C) 2014-2017, 2019                          CNRS
  * Copyright (C) 2015                                     Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -53,11 +53,11 @@ void _starpu_mpi_cache_stats_update(unsigned dst, starpu_data_handle_t data_hand
 
 	if (count == 1)
 	{
-		_STARPU_MPI_MSG("[communication cache] + %10ld to   %d\n", (long)size, dst);
+		_STARPU_MPI_MSG("[communication cache] + %10ld to   %u\n", (long)size, dst);
 	}
 	else // count == -1
 	{
-		_STARPU_MPI_MSG("[communication cache] - %10ld from %d\n", (long)size, dst);
+		_STARPU_MPI_MSG("[communication cache] - %10ld from %u\n", (long)size, dst);
 	}
 }
 

+ 3 - 3
mpi/src/starpu_mpi_private.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2013,2016,2017                           Inria
- * Copyright (C) 2010-2017                                CNRS
+ * Copyright (C) 2010-2017, 2019                          CNRS
  * Copyright (C) 2010-2018                                Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -101,9 +101,9 @@ int _starpu_debug_rank;
 #  endif
 #endif
 
-#define _STARPU_MPI_MALLOC(ptr, size) do { ptr = malloc(size); STARPU_MPI_ASSERT_MSG(ptr != NULL, "Cannot allocate %ld bytes\n", (long) size); } while (0)
+#define _STARPU_MPI_MALLOC(ptr, size) do { ptr = malloc(size); STARPU_MPI_ASSERT_MSG(ptr != NULL, "Cannot allocate %ld bytes\n", (long) (size)); } while (0)
 #define _STARPU_MPI_CALLOC(ptr, nmemb, size) do { ptr = calloc(nmemb, size); STARPU_MPI_ASSERT_MSG(ptr != NULL, "Cannot allocate %ld bytes\n", (long) (nmemb*size)); } while (0)
-#define _STARPU_MPI_REALLOC(ptr, size) do { void *_new_ptr = realloc(ptr, size); STARPU_MPI_ASSERT_MSG(_new_ptr != NULL, "Cannot reallocate %ld bytes\n", (long) size); ptr = _new_ptr; } while (0)
+#define _STARPU_MPI_REALLOC(ptr, size) do { void *_new_ptr = realloc(ptr, size); STARPU_MPI_ASSERT_MSG(_new_ptr != NULL, "Cannot reallocate %ld bytes\n", (long) (size)); ptr = _new_ptr; } while (0)
 
 #ifdef STARPU_MPI_VERBOSE
 #  define _STARPU_MPI_COMM_DEBUG(ptr, count, datatype, node, tag, utag, comm, way) \

+ 5 - 5
socl/src/cl_createkernel.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012,2014,2016,2017                      CNRS
+ * Copyright (C) 2012,2014,2016,2017,2019                 CNRS
  * Copyright (C) 2010-2013,2018                           Université de Bordeaux
  * Copyright (C) 2011,2012                                Inria
  *
@@ -24,7 +24,7 @@ static void soclCreateKernel_task(void *data)
 
 	int range = starpu_worker_get_range();
 	cl_int err;
-	
+
 	if (k->program->cl_programs[range] == NULL)
 	{
 		k->errcodes[range] = CL_SUCCESS;
@@ -54,7 +54,7 @@ static void soclCreateKernel_task(void *data)
 			ERROR_STOP("Unable to get kernel argument count. Aborting.\n");
 		}
 		k->num_args = num_args;
-		DEBUG_MSG("Kernel has %d arguments\n", num_args);
+		DEBUG_MSG("Kernel has %u arguments\n", num_args);
 
 		k->arg_size = (size_t*)malloc(sizeof(size_t) * num_args);
 		k->arg_value = (void**)malloc(sizeof(void*) * num_args);
@@ -142,7 +142,7 @@ soclCreateKernel(cl_program    program,
 			*errcode_ret = CL_OUT_OF_HOST_MEMORY;
 		return NULL;
 	}
-   
+
 	gc_entity_store(&k->program, program);
 	k->kernel_name = strdup(kernel_name);
 
@@ -165,7 +165,7 @@ soclCreateKernel(cl_program    program,
 	static int id = 0;
 	k->id = id++;
 #endif
-   
+
 	k->cl_kernels = (cl_kernel*)malloc(socl_device_count * sizeof(cl_kernel));
 	k->errcodes = (cl_int*)malloc(socl_device_count * sizeof(cl_int));
 

+ 1 - 1
starpurm/src/starpurm_dlb.c

@@ -121,7 +121,7 @@ static const char * _dlb_error_str(int error_code)
 	return s;
 }
 
-#define _dlb_check(s,r) do { if ((r) != DLB_SUCCESS) {fprintf(stderr, "%s:%u, %s - DLB call '%s' %s %d (%s)\n",__FILE__, __LINE__, __func__, (s), (r)>0?"returned warning code":"failed with error code", (r), _dlb_error_str((r))); assert(dlb_ret >= DLB_SUCCESS); }} while (0)
+#define _dlb_check(s,r) do { if ((r) != DLB_SUCCESS) {fprintf(stderr, "%s:%d, %s - DLB call '%s' %s %d (%s)\n",__FILE__, __LINE__, __func__, (s), (r)>0?"returned warning code":"failed with error code", (r), _dlb_error_str((r))); assert(dlb_ret >= DLB_SUCCESS); }} while (0)
 
 #if 0
 /* unused for now */

+ 2 - 2
tools/starpu_perfmodel_recdump.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2017,2018                                Inria
- * Copyright (C) 2011-2014,2016-2018                      CNRS
+ * Copyright (C) 2011-2014,2016-2019                      CNRS
  * Copyright (C) 2011,2013,2014,2017,2019                 Université de Bordeaux
  * Copyright (C) 2011                                     Télécom-SudParis
  *
@@ -225,7 +225,7 @@ int main(int argc, char **argv)
 	{
 		FILE* input = fopen(pinput, "r");
 		char s[1024], *c;
-		struct model *model, *tmp;
+		struct model *model, *tmp=NULL;
 		uint32_t footprint = 0;
 		char *model_name = NULL;
 		int ret;

+ 4 - 4
tools/starpu_replay.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2017                                     Erwan Leria
  * Copyright (C) 2018                                     Inria
- * Copyright (C) 2017,2018                                CNRS
+ * Copyright (C) 2017,2018,2019                           CNRS
  * Copyright (C) 2016-2018                                Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -884,7 +884,7 @@ eof:
 
 	/* End of FREE */
 
-	struct handle * handle,* handletmp;
+	struct handle *handle=NULL, *handletmp=NULL;
 	HASH_ITER(hh, handles_hash, handle, handletmp)
 	{
 		starpu_data_unregister(handle->mem_ptr);
@@ -892,7 +892,7 @@ eof:
 		free(handle);
         }
 
-	struct perfmodel * model_s, * modeltmp;
+	struct perfmodel *model_s=NULL, *modeltmp=NULL;
 	HASH_ITER(hh, model_hash, model_s, modeltmp)
 	{
 		starpu_perfmodel_unload_model(&model_s->perfmodel);
@@ -901,7 +901,7 @@ eof:
 		free(model_s);
         }
 
-	struct task * task, *tasktmp;
+	struct task *task=NULL, *tasktmp=NULL;
 	HASH_ITER(hh, tasks, task, tasktmp)
 	{
 		free(task->task.cl_arg);

+ 2 - 2
tools/starpu_tasks_rec_complete.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) 2011-2014,2016                           Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
 	uint32_t footprint = 0;
 	int already_there = 0;
 	char *model_name = NULL;
-	struct model *model, *tmp;
+	struct model *model, *tmp=NULL;
 	int ret;
 
 	if (argc >= 2)