瀏覽代碼

examples: fixes for cppcheck warnings

Nathalie Furmento 8 年之前
父節點
當前提交
3ad2cf42c1

+ 0 - 1
tests/datawizard/acquire_release_opencl.c

@@ -29,7 +29,6 @@ void increment_opencl(void *buffers[], void *args)
         cl_int err;
 	cl_kernel kernel;
 	cl_command_queue queue;
-	cl_event event;
 
 	cl_mem val = (cl_mem)STARPU_VARIABLE_GET_PTR(buffers[0]);
 

+ 1 - 1
tests/datawizard/gpu_register.c

@@ -76,7 +76,7 @@ check_result(unsigned *t, size_t size)
 	{
 		if (t[i] != i*2)
 		{
-			FPRINTF(stderr,"t[%d] is %u instead of %u\n", i, t[i], 2*i);
+			FPRINTF(stderr,"t[%u] is %u instead of %u\n", i, t[i], 2*i);
 			return 1;
 		}
 	}

+ 12 - 12
tests/datawizard/handle_to_pointer.c

@@ -104,7 +104,6 @@ static struct starpu_codelet cl =
 int main(int argc, char *argv[])
 {
 	int err, ret;
-	int i;
 	int *pointer;
 	starpu_data_handle_t handle;
 	static const int count = 123;
@@ -154,20 +153,21 @@ int main(int argc, char *argv[])
 	pointer = (int *) starpu_data_handle_to_pointer(handle, STARPU_MAIN_RAM);
 	if (pointer == NULL)
 	{
-	     FPRINTF(stderr, "pointer should be non NULL\n");
-	     ret = EXIT_FAILURE;
+		FPRINTF(stderr, "pointer should be non NULL\n");
+		ret = EXIT_FAILURE;
 	}
 	else
 	{
-	     for(i = 0; i < count; i++)
-	     {
-		  int *numbers = (int *)pointer;
-		  if (numbers[i] != i)
-		  {
-		       FPRINTF(stderr, "Incorrect value numbers[%d] == %d should be %d\n", (int)i, numbers[i], (int)i);
-		       ret = EXIT_FAILURE;
-		  }
-	     }
+		int i;
+		for(i = 0; i < count; i++)
+		{
+			int *numbers = (int *)pointer;
+			if (numbers[i] != i)
+			{
+				FPRINTF(stderr, "Incorrect value numbers[%d] == %d should be %d\n", (int)i, numbers[i], (int)i);
+				ret = EXIT_FAILURE;
+			}
+		}
 	}
 	starpu_data_release(handle);
 

+ 3 - 3
tests/datawizard/interfaces/multiformat/advanced/generic.c

@@ -197,9 +197,9 @@ print_stats(struct stats *s)
 			s->opencl_to_cpu);
 #endif /* !STARPU_USE_OPENCL */
 #ifdef STARPU_USE_MIC
-	FPRINTF(stderr, "mic	: %d\n"
-			"cpu->mic : %d\n"
-			"mic->cpu : %d\n",
+	FPRINTF(stderr, "mic	: %u\n"
+			"cpu->mic : %u\n"
+			"mic->cpu : %u\n",
 			s->mic,
 			s->cpu_to_mic,
 			s->mic_to_cpu);

+ 2 - 2
tests/datawizard/mpi_like_async.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2014, 2016  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2016  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
@@ -143,7 +143,7 @@ static int test_recv_handle_async(void *arg)
 	if (ret)
 	{
 #ifdef DEBUG_MESSAGES
-		FPRINTF(stderr, "Thread %d received value %d from thread %d\n",
+		FPRINTF(stderr, "Thread %u received value %u from thread %d\n",
 			thread_data->index, thread_data->val, (thread_data->index - 1)%nthreads);
 #endif
 		starpu_data_release(thread_data->handle);

+ 1 - 4
tests/perfmodels/user_base.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2014-2016  Université Bordeaux
- * Copyright (C) 2012, 2013, 2014  CNRS
+ * Copyright (C) 2012, 2013, 2014, 2016  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
@@ -82,11 +82,8 @@ static int submit(struct starpu_codelet *codelet, struct starpu_perfmodel *model
 	int nloops = 123;
 	int loop;
 	starpu_data_handle_t handle;
-	struct starpu_perfmodel lmodel;
 	int ret;
-	int old_nsamples, new_nsamples;
 	struct starpu_conf conf;
-	unsigned archid, archtype, devid, ncore;
 
 	starpu_conf_init(&conf);
 	conf.sched_policy_name = "eager";

+ 1 - 2
tests/perfmodels/valid_model.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012, 2013, 2014, 2015  CNRS
+ * Copyright (C) 2012, 2013, 2014, 2015, 2016  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
@@ -66,7 +66,6 @@ static int submit(struct starpu_codelet *codelet, struct starpu_perfmodel *model
 	int ret;
 	int old_nsamples, new_nsamples;
 	struct starpu_conf conf;
-	unsigned archid, archtype, devid, ncore;
 
 	starpu_conf_init(&conf);
 	conf.sched_policy_name = "eager";

+ 2 - 2
tests/perfmodels/value_nan.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2013, 2015  CNRS
+ * Copyright (C) 2013, 2015, 2016  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
@@ -76,7 +76,7 @@ int _check_number(double val, int checknan)
 	char str[10];
 	// ... but is read with the format %le
 	int x = _starpu_read_double(f, "%le", &lat);
-	int y = fscanf(f, " %s", str);
+	int y = fscanf(f, " %10s", str);
 	fclose(f);
 	unlink(filename);
 

+ 0 - 2
tests/sched_policies/simple_cpu_gpu_sched.c

@@ -120,8 +120,6 @@ init_perfmodels_gpu(int gpu_type)
 static void
 init_perfmodels(void)
 {
-	unsigned devid, ncore;
-
 	starpu_perfmodel_init(&model_cpu_task);
 	starpu_perfmodel_init(&model_gpu_task);