浏览代码

examples: fixes for cppcheck warnings

Nathalie Furmento 8 年之前
父节点
当前提交
4b0182bdb0
共有 51 个文件被更改,包括 235 次插入221 次删除
  1. 16 16
      examples/audio/starpu_audio_processing.c
  2. 0 1
      examples/axpy/axpy_opencl.c
  3. 3 2
      examples/basic_examples/multiformat.c
  4. 0 1
      examples/basic_examples/multiformat_conversion_codelets_opencl.c
  5. 0 1
      examples/basic_examples/vector_scal_opencl.c
  6. 2 2
      examples/callback/prologue.c
  7. 13 11
      examples/cg/cg.c
  8. 2 2
      examples/cg/cg_kernels.c
  9. 1 1
      examples/cholesky/cholesky_implicit.c
  10. 2 2
      examples/cholesky/cholesky_tile_tag.c
  11. 0 1
      examples/filters/custom_mf/conversion_opencl.c
  12. 1 1
      examples/filters/custom_mf/custom_interface.c
  13. 0 1
      examples/filters/custom_mf/custom_opencl.c
  14. 0 1
      examples/filters/fblock_opencl.c
  15. 3 2
      examples/filters/fmatrix.c
  16. 54 49
      examples/heat/dw_factolu.c
  17. 2 2
      examples/heat/dw_factolu.h
  18. 1 4
      examples/heat/heat.c
  19. 0 1
      examples/interface/complex_kernels_opencl.c
  20. 1 2
      examples/lu/lu_example.c
  21. 3 2
      examples/lu/xlu_implicit.c
  22. 5 4
      examples/lu/xlu_implicit_pivot.c
  23. 10 10
      examples/mandelbrot/mandelbrot.c
  24. 2 1
      examples/matvecmult/matvecmult.c
  25. 3 1
      examples/mult/xgemm.c
  26. 2 2
      examples/pi/pi.c
  27. 1 1
      examples/pi/pi_redux.c
  28. 9 6
      examples/ppm_downscaler/ppm_downscaler.c
  29. 0 2
      examples/reductions/dot_product.c
  30. 1 1
      examples/sched_ctx/dummy_sched_with_ctx.c
  31. 3 3
      examples/sched_ctx/nested_sched_ctxs.c
  32. 2 2
      examples/sched_ctx/parallel_code.c
  33. 1 2
      examples/sched_ctx/parallel_tasks_reuse_handle.c
  34. 3 3
      examples/sched_ctx/sched_ctx_without_sched_policy.c
  35. 2 2
      examples/sched_ctx/sched_ctx_without_sched_policy_awake.c
  36. 8 8
      examples/sched_ctx_utils/sched_ctx_utils.c
  37. 1 1
      examples/scheduler/dummy_sched.c
  38. 8 10
      examples/spmd/vector_scal_spmd.c
  39. 3 3
      examples/spmv/dw_block_spmv.c
  40. 6 6
      examples/spmv/matrix_market/mm_to_bcsr.c
  41. 35 19
      examples/spmv/matrix_market/mmio.c
  42. 0 1
      examples/spmv/spmv_kernels.c
  43. 0 1
      examples/stencil/life_opencl.c
  44. 0 1
      examples/stencil/shadow_opencl.c
  45. 1 1
      examples/stencil/stencil-blocks.c
  46. 6 8
      examples/stencil/stencil-kernels.c
  47. 6 6
      examples/stencil/stencil.c
  48. 3 2
      examples/tag_example/tag_example2.c
  49. 3 2
      examples/tag_example/tag_example3.c
  50. 2 2
      examples/tag_example/tag_restartable.c
  51. 5 5
      examples/worker_collections/worker_list_example.c

+ 16 - 16
examples/audio/starpu_audio_processing.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2012, 2014-2015  Université de Bordeaux
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * 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
@@ -68,8 +68,8 @@ static double start;
 static double end;
 static unsigned task_per_worker[STARPU_NMAXWORKERS] = {0};
 
-/* 
- *	Functions to Manipulate WAV files 
+/*
+ *	Functions to Manipulate WAV files
  */
 
 unsigned get_wav_data_bytes_length(FILE *file)
@@ -91,8 +91,8 @@ void copy_wav_header(FILE *srcfile, FILE *dstfile)
 	fseek(srcfile, 0, SEEK_SET);
 	fseek(dstfile, 0, SEEK_SET);
 
-	fread(buffer, 1, headersize, infile);	
-	fwrite(buffer, 1, headersize, outfile);	
+	fread(buffer, 1, headersize, infile);
+	fwrite(buffer, 1, headersize, outfile);
 }
 
 void read_16bit_wav(FILE *infile, unsigned size, float *arrayout, FILE *save_file)
@@ -104,7 +104,7 @@ void read_16bit_wav(FILE *infile, unsigned size, float *arrayout, FILE *save_fil
 
 	/* we skip the header to only keep the data */
 	fseek(infile, headersize, SEEK_SET);
-	
+
 	for (v=0;v<size;v++)
 	{
 		signed char val = (signed char)fgetc(infile);
@@ -113,7 +113,7 @@ void read_16bit_wav(FILE *infile, unsigned size, float *arrayout, FILE *save_fil
 		arrayout[v] = 256*val2 + val;
 
 #if SAVE_RAW
-		fprintf(save_file, "%d %f\n", currentpos++, arrayout[v]);
+		fprintf(save_file, "%u %f\n", currentpos++, arrayout[v]);
 #endif
 	}
 }
@@ -128,10 +128,10 @@ void write_16bit_wav(FILE *outfile, unsigned size, float *arrayin, FILE *save_fi
 
 	/* we assume that the header is copied using copy_wav_header */
 	fseek(outfile, headersize, SEEK_SET);
-	
+
 	for (v=0;v<size;v++)
 	{
-		signed char val = ((int)arrayin[v]) % 256; 
+		signed char val = ((int)arrayin[v]) % 256;
 		signed char val2  = ((int)arrayin[v]) / 256;
 
 		fputc(val, outfile);
@@ -139,7 +139,7 @@ void write_16bit_wav(FILE *outfile, unsigned size, float *arrayin, FILE *save_fi
 
 #if SAVE_RAW
 		if (save_file)
-	                fprintf(save_file, "%d %f\n", currentpos++, arrayin[v]);
+	                fprintf(save_file, "%u %f\n", currentpos++, arrayin[v]);
 #endif
 	}
 }
@@ -177,7 +177,7 @@ static void band_filter_kernel_gpu(void *descr[], STARPU_ATTRIBUTE_UNUSED void *
 	cufftComplex *localout;
 
 	int workerid = starpu_worker_get_id();
-	
+
 	/* initialize the plane only during the first iteration */
 	if (!plans[workerid].is_initialized)
 	{
@@ -201,7 +201,7 @@ static void band_filter_kernel_gpu(void *descr[], STARPU_ATTRIBUTE_UNUSED void *
 	/* FFT */
 	cures = cufftExecR2C(plans[workerid].plan, localA, localout);
 	STARPU_ASSERT(cures == CUFFT_SUCCESS);
-	
+
 	/* filter low freqs */
 	unsigned lowfreq_index = (LOWFREQ*nsamples)/SAMPLERATE;
 	cudaMemsetAsync(&localout[0], 0, lowfreq_index*sizeof(fftwf_complex), starpu_cuda_get_local_stream());
@@ -226,11 +226,11 @@ static void band_filter_kernel_cpu(void *descr[], STARPU_ATTRIBUTE_UNUSED void *
 	float *localA = (float *)STARPU_VECTOR_GET_PTR(descr[0]);
 
 	int workerid = starpu_worker_get_id();
-	
+
 	/* initialize the plane only during the first iteration */
 	if (!plans[workerid].is_initialized)
 	{
-		plans[workerid].localout_cpu = malloc(nsamples*sizeof(fftwf_complex)); 
+		plans[workerid].localout_cpu = malloc(nsamples*sizeof(fftwf_complex));
 		plans[workerid].Acopy = malloc(nsamples*sizeof(float));
 
 		/* create plans, only "fftwf_execute" is thread safe in FFTW ... */
@@ -255,7 +255,7 @@ static void band_filter_kernel_cpu(void *descr[], STARPU_ATTRIBUTE_UNUSED void *
 
 	/* FFT */
 	fftwf_execute(plans[workerid].plan_cpu);
-	
+
 	/* filter low freqs */
 	unsigned lowfreq_index = (LOWFREQ*nsamples)/SAMPLERATE;
 	memset(&localout[0], 0, lowfreq_index*sizeof(fftwf_complex));
@@ -408,7 +408,7 @@ int main(int argc, char **argv)
 
 	unsigned niter = length_data/nsamples;
 
-	fprintf(stderr, "input: %s\noutput: %s\n#chunks %d\n", inputfilename, outputfilename, niter);
+	fprintf(stderr, "input: %s\noutput: %s\n#chunks %u\n", inputfilename, outputfilename, niter);
 
 	/* launch StarPU */
 	ret = starpu_init(NULL);

+ 0 - 1
examples/axpy/axpy_opencl.c

@@ -29,7 +29,6 @@ void axpy_opencl(void *buffers[], void *_args)
         cl_int err;
 	cl_kernel kernel;
 	cl_command_queue queue;
-	cl_event event;
 
 	unsigned n = STARPU_VECTOR_GET_NX(buffers[0]);
 	cl_mem x = (cl_mem) STARPU_VECTOR_GET_DEV_HANDLE(buffers[0]);

+ 3 - 2
examples/basic_examples/multiformat.c

@@ -167,11 +167,10 @@ create_and_submit_task(unsigned int dev)
 static void
 create_and_submit_tasks(void)
 {
-	int err;
-
 #ifdef STARPU_USE_CUDA
 	if (ncuda > 0)
 	{
+		int err;
 		err = create_and_submit_task(STARPU_CUDA);
 		if (err != 0)
 		{
@@ -184,6 +183,7 @@ create_and_submit_tasks(void)
 #ifdef STARPU_USE_CPU
 	if (ncpu > 0)
 	{
+		int err;
 		err = create_and_submit_task(STARPU_CPU);
 		if (err != 0)
 		{
@@ -196,6 +196,7 @@ create_and_submit_tasks(void)
 #ifdef STARPU_USE_OPENCL
 	if (nopencl > 0)
 	{
+		int err;
 		err = create_and_submit_task(STARPU_OPENCL);
 		if (err != 0)
 		{

+ 0 - 1
examples/basic_examples/multiformat_conversion_codelets_opencl.c

@@ -25,7 +25,6 @@ void cpu_to_opencl_opencl_func(void *buffers[], void *args)
         cl_int err;
 	cl_kernel kernel;
 	cl_command_queue queue;
-	cl_event event;
 
 	unsigned n = STARPU_MULTIFORMAT_GET_NX(buffers[0]);
 	cl_mem src = (cl_mem) STARPU_MULTIFORMAT_GET_CPU_PTR(buffers[0]);

+ 0 - 1
examples/basic_examples/vector_scal_opencl.c

@@ -31,7 +31,6 @@ void scal_opencl_func(void *buffers[], void *_args)
         cl_int err;
 	cl_kernel kernel;
 	cl_command_queue queue;
-	cl_event event;
 
 	/* length of the vector */
 	unsigned int n = STARPU_VECTOR_GET_NX(buffers[0]);

+ 2 - 2
examples/callback/prologue.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2013-2015  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2015  CNRS
+ * Copyright (C) 2010, 2011, 2012, 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
@@ -55,7 +55,7 @@ void prologue_callback_func(void *callback_arg)
 void pop_prologue_callback_func(void *args)
 {
 	unsigned val = (uintptr_t) args;
-	printf("pop_prologue_callback val %d \n", val);
+	printf("pop_prologue_callback val %u \n", val);
 	STARPU_ASSERT(val == 5);
 }
 

+ 13 - 11
examples/cg/cg.c

@@ -44,18 +44,18 @@
  *		d <- r
  *		delta_new <- dot(r,r)
  *		delta_0 <- delta_new
- *	
+ *
  *		while (i < i_max && delta_new > eps^2 delta_0)
  *		{
  *			q <- Ad
  *			alpha <- delta_new/dot(d, q)
  *			x <- x + alpha d
- *	
+ *
  *			If (i is divisible by 50)
  *				r <- b - Ax
  *			else
  *				r <- r - alpha q
- *			
+ *
  *			delta_old <- delta_new
  *			delta_new <- dot(r,r)
  *			beta <- delta_new/delta_old
@@ -159,7 +159,7 @@ static void register_data(void)
 	{
 		starpu_data_set_reduction_methods(q_handle, &accumulate_vector_cl, &bzero_vector_cl);
 		starpu_data_set_reduction_methods(r_handle, &accumulate_vector_cl, &bzero_vector_cl);
-	
+
 		starpu_data_set_reduction_methods(dtq_handle, &accumulate_variable_cl, &bzero_variable_cl);
 		starpu_data_set_reduction_methods(rtr_handle, &accumulate_variable_cl, &bzero_variable_cl);
 	}
@@ -271,8 +271,7 @@ static void display_matrix(void)
 
 static int cg(void)
 {
-	double delta_new, delta_old, delta_0;
-	double alpha, beta;
+	double delta_new, delta_0;
 
 	int i = 0;
 	int ret;
@@ -282,7 +281,7 @@ static int cg(void)
 	if (ret == -ENODEV) return ret;
 
 	/* r <- r - A x */
-	ret = gemv_kernel(r_handle, A_handle, x_handle, 1.0, -1.0, nblocks, use_reduction); 
+	ret = gemv_kernel(r_handle, A_handle, x_handle, 1.0, -1.0, nblocks, use_reduction);
 	if (ret == -ENODEV) return ret;
 
 	/* d <- r */
@@ -307,6 +306,9 @@ static int cg(void)
 
 	while ((i < i_max) && ((double)delta_new > (double)(eps*eps*delta_0)))
 	{
+		double delta_old;
+		double alpha, beta;
+
 		/* q <- A d */
 		gemv_kernel(q_handle, A_handle, d_handle, 0.0, 1.0, nblocks, use_reduction);
 
@@ -317,7 +319,7 @@ static int cg(void)
 		starpu_data_acquire(dtq_handle, STARPU_R);
 		alpha = delta_new/dtq;
 		starpu_data_release(dtq_handle);
-		
+
 		/* x <- x + alpha d */
 		axpy_kernel(x_handle, d_handle, alpha, nblocks);
 
@@ -325,9 +327,9 @@ static int cg(void)
 		{
 			/* r <- b */
 			copy_handle(r_handle, b_handle, nblocks);
-		
+
 			/* r <- r - A x */
-			gemv_kernel(r_handle, A_handle, x_handle, 1.0, -1.0, nblocks, use_reduction); 
+			gemv_kernel(r_handle, A_handle, x_handle, 1.0, -1.0, nblocks, use_reduction);
 		}
 		else
 		{
@@ -434,7 +436,7 @@ int main(int argc, char **argv)
 	partition_data();
 
 	ret = cg();
-	if (ret == -ENODEV) 
+	if (ret == -ENODEV)
 	{
 		ret = 77;
 		goto enodev;

+ 2 - 2
examples/cg/cg_kernels.c

@@ -550,10 +550,10 @@ int scal_axpy_kernel(starpu_data_handle_t v1, TYPE p1,
 		     starpu_data_handle_t v2, TYPE p2,
 		     unsigned nblocks)
 {
-	int ret;
 	unsigned b;
 	for (b = 0; b < nblocks; b++)
 	{
+		int ret;
 		ret = starpu_task_insert(&scal_axpy_kernel_cl,
 					 STARPU_RW, starpu_data_get_sub_data(v1, 1, b),
 					 STARPU_R,  starpu_data_get_sub_data(v2, 1, b),
@@ -626,10 +626,10 @@ int axpy_kernel(starpu_data_handle_t v1,
 		starpu_data_handle_t v2, TYPE p1,
 		unsigned nblocks)
 {
-	int ret;
 	unsigned b;
 	for (b = 0; b < nblocks; b++)
 	{
+		int ret;
 		ret = starpu_task_insert(&axpy_kernel_cl,
 					 STARPU_RW, starpu_data_get_sub_data(v1, 1, b),
 					 STARPU_R,  starpu_data_get_sub_data(v2, 1, b),

+ 1 - 1
examples/cholesky/cholesky_implicit.c

@@ -40,7 +40,6 @@ static void callback_turn_spmd_on(void *arg STARPU_ATTRIBUTE_UNUSED)
 
 static int _cholesky(starpu_data_handle_t dataA, unsigned nblocks)
 {
-	int ret;
 	double start;
 	double end;
 
@@ -59,6 +58,7 @@ static int _cholesky(starpu_data_handle_t dataA, unsigned nblocks)
 	/* create all the DAG nodes */
 	for (k = 0; k < nblocks; k++)
 	{
+		int ret;
                 starpu_data_handle_t sdatakk = starpu_data_get_sub_data(dataA, 2, k, k);
 
                 ret = starpu_task_insert(&cl11,

+ 2 - 2
examples/cholesky/cholesky_tile_tag.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009-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
@@ -234,7 +234,7 @@ int main(int argc, char **argv)
 	parse_args(argc, argv);
 	assert(nblocks <= NMAXBLOCKS);
 
-	FPRINTF(stderr, "BLOCK SIZE = %d\n", size / nblocks);
+	FPRINTF(stderr, "BLOCK SIZE = %u\n", size / nblocks);
 
 #ifdef STARPU_USE_CUDA
 	initialize_chol_model(&chol_model_11,"chol_model_11",cpu_chol_task_11_cost,cuda_chol_task_11_cost);

+ 0 - 1
examples/filters/custom_mf/conversion_opencl.c

@@ -28,7 +28,6 @@ void cpu_to_opencl_opencl_func(void *buffers[], void *args)
         cl_int err;
 	cl_kernel kernel;
 	cl_command_queue queue;
-	cl_event event;
 
 	unsigned n = CUSTOM_GET_NX(buffers[0]);
 	n*=2;

+ 1 - 1
examples/filters/custom_mf/custom_interface.c

@@ -245,7 +245,7 @@ static void display_custom_interface(starpu_data_handle_t handle, FILE *f)
 {
 	struct custom_data_interface *ci = (struct custom_data_interface *)
 		starpu_data_get_interface_on_node(handle, STARPU_MAIN_RAM);
-	fprintf(f, "Custom interface of size %d", ci->nx);
+	fprintf(f, "Custom interface of size %u", ci->nx);
 }
 
 static uint32_t

+ 0 - 1
examples/filters/custom_mf/custom_opencl.c

@@ -28,7 +28,6 @@ void custom_scal_opencl_func(void *buffers[], void *args)
         cl_int err;
 	cl_kernel kernel;
 	cl_command_queue queue;
-	cl_event event;
 
 	unsigned n = CUSTOM_GET_NX(buffers[0]);
 	struct point *aop;

+ 0 - 1
examples/filters/fblock_opencl.c

@@ -35,7 +35,6 @@ void opencl_func(void *buffers[], void *cl_arg)
 	int id, devid, err;
 	cl_kernel kernel;
 	cl_command_queue queue;
-	cl_event event;
 
         int *factor = cl_arg;
 	cl_mem block = (cl_mem)STARPU_BLOCK_GET_DEV_HANDLE(buffers[0]);

+ 3 - 2
examples/filters/fmatrix.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011, 2012, 2013, 2015  CNRS
+ * Copyright (C) 2010, 2011, 2012, 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
@@ -48,7 +48,8 @@ void cpu_func(void *buffers[], void *cl_arg)
 
 int main(int argc, char **argv)
 {
-	unsigned j, n=1;
+	unsigned j;
+	int n=1;
         int matrix[NX*NY];
 	int ret, i;
 	int factor = 12;

+ 54 - 49
examples/heat/dw_factolu.c

@@ -90,7 +90,7 @@ static struct starpu_codelet cl21 =
 	.nbuffers = 2,
 	.modes = {STARPU_R, STARPU_RW},
 	.model = &model_21
-}; 
+};
 
 static struct starpu_codelet cl22 =
 {
@@ -103,7 +103,7 @@ static struct starpu_codelet cl22 =
 	.nbuffers = 3,
 	.modes = {STARPU_R, STARPU_R, STARPU_RW},
 	.model = &model_22
-}; 
+};
 
 
 
@@ -117,7 +117,7 @@ static struct starpu_codelet cl22 =
 void dw_callback_v2_codelet_update_u22(void *argcb)
 {
 	int ret;
-	cl_args *args = argcb;	
+	cl_args *args = argcb;
 
 	unsigned k = args->k;
 	unsigned i = args->i;
@@ -128,7 +128,7 @@ void dw_callback_v2_codelet_update_u22(void *argcb)
 
 	/* we did task 22k,i,j */
 	advance_22[k*nblocks*nblocks + i + j*nblocks] = DONE;
-	
+
 	if ( (i == j) && (i == k+1))
 	{
 		/* we now reduce the LU22 part (recursion appears there) */
@@ -142,7 +142,7 @@ void dw_callback_v2_codelet_update_u22(void *argcb)
 		task->cl_arg_size = sizeof(*u11arg);
 
 		task->handles[0] = starpu_data_get_sub_data(args->dataA, 2, k+1, k+1);
-	
+
 		u11arg->dataA = args->dataA;
 		u11arg->i = k + 1;
 		u11arg->nblocks = args->nblocks;
@@ -236,7 +236,7 @@ void dw_callback_v2_codelet_update_u22(void *argcb)
 void dw_callback_v2_codelet_update_u12(void *argcb)
 {
 	int ret;
-	cl_args *args = argcb;	
+	cl_args *args = argcb;
 
 	/* now launch the update of LU22 */
 	unsigned i = args->i;
@@ -297,7 +297,7 @@ void dw_callback_v2_codelet_update_u12(void *argcb)
 void dw_callback_v2_codelet_update_u21(void *argcb)
 {
 	int ret;
-	cl_args *args = argcb;	
+	cl_args *args = argcb;
 
 	/* now launch the update of LU22 */
 	unsigned i = args->i;
@@ -357,7 +357,6 @@ void dw_callback_v2_codelet_update_u21(void *argcb)
 
 void dw_callback_v2_codelet_update_u11(void *argcb)
 {
-	int ret;
 	/* in case there remains work, go on */
 	cl_args *args = argcb;
 
@@ -369,13 +368,13 @@ void dw_callback_v2_codelet_update_u11(void *argcb)
 	/* we did task 11k */
 	advance_11[i] = DONE;
 
-	if (i == nblocks - 1) 
+	if (i == nblocks - 1)
 	{
 		/* we are done */
 		free(argcb);
 		return;
 	}
-	else 
+	else
 	{
 		/* put new tasks */
 		unsigned slice;
@@ -390,23 +389,25 @@ void dw_callback_v2_codelet_update_u11(void *argcb)
 			}
 			else
 			{
-				deps12 = advance_22[(i-1)*nblocks*nblocks + slice + i*nblocks];		
+				deps12 = advance_22[(i-1)*nblocks*nblocks + slice + i*nblocks];
 			}
 			if (deps12 & DONE)
 			{
 				/* we may perhaps launch the task 12i,slice */
-				 uint8_t u = STARPU_ATOMIC_OR(&advance_12_21[i*nblocks + slice], STARTED);
-				 if ((u & STARTED) == 0)
-				 {
+				uint8_t u = STARPU_ATOMIC_OR(&advance_12_21[i*nblocks + slice], STARTED);
+				if ((u & STARTED) == 0)
+				{
+					int ret;
+
 					/* we are the only one that should launch that task */
 					cl_args *u12a = malloc(sizeof(cl_args));
 
 					struct starpu_task *task12 = starpu_task_create();
-						task12->callback_func = dw_callback_v2_codelet_update_u12;
-						task12->callback_arg = u12a;
-						task12->cl = &cl12;
-						task12->cl_arg = u12a;
-						task12->cl_arg_size = sizeof(*u12a);
+					task12->callback_func = dw_callback_v2_codelet_update_u12;
+					task12->callback_arg = u12a;
+					task12->cl = &cl12;
+					task12->cl_arg = u12a;
+					task12->cl_arg_size = sizeof(*u12a);
 
 					u12a->i = i;
 					u12a->k = slice;
@@ -432,14 +433,16 @@ void dw_callback_v2_codelet_update_u11(void *argcb)
 			}
 			else
 			{
-				deps12 = advance_22[(i-1)*nblocks*nblocks + slice*nblocks + i];		
+				deps12 = advance_22[(i-1)*nblocks*nblocks + slice*nblocks + i];
 			}
 			if (deps12 & DONE)
 			{
 				/* we may perhaps launch the task 12i,slice */
-				 uint8_t u = STARPU_ATOMIC_OR(&advance_12_21[i + slice*nblocks], STARTED);
-				 if ((u & STARTED) == 0)
-				 {
+				uint8_t u = STARPU_ATOMIC_OR(&advance_12_21[i + slice*nblocks], STARTED);
+				if ((u & STARTED) == 0)
+				{
+					int ret;
+
 					/* we are the only one that should launch that task */
 					cl_args *u21a = malloc(sizeof(cl_args));
 
@@ -474,34 +477,34 @@ void dw_callback_v2_codelet_update_u11(void *argcb)
 
 
 /*
- *	Callbacks 
+ *	Callbacks
  */
 
 
 void dw_callback_codelet_update_u11(void *argcb)
 {
-	int ret;
 	/* in case there remains work, go on */
 	cl_args *args = argcb;
 
-	if (args->i == args->nblocks - 1) 
+	if (args->i == args->nblocks - 1)
 	{
 		/* we are done */
 		free(argcb);
 		return;
 	}
-	else 
+	else
 	{
 		/* put new tasks */
 		unsigned nslices;
 		nslices = args->nblocks - 1 - args->i;
 
 		unsigned *remaining = malloc(sizeof(unsigned));
-		*remaining = 2*nslices; 
+		*remaining = 2*nslices;
 
 		unsigned slice;
 		for (slice = args->i + 1; slice < args->nblocks; slice++)
 		{
+			int ret;
 
 			/* update slice from u12 */
 			cl_args *u12a = malloc(sizeof(cl_args));
@@ -554,29 +557,30 @@ void dw_callback_codelet_update_u11(void *argcb)
 
 void dw_callback_codelet_update_u22(void *argcb)
 {
-	int ret;
-	cl_args *args = argcb;	
+	cl_args *args = argcb;
 	unsigned remaining = STARPU_ATOMIC_ADD(args->remaining, (-1));
 	ANNOTATE_HAPPENS_BEFORE(args->remaining);
 
 	if (remaining == 0)
 	{
+		int ret;
+
 		ANNOTATE_HAPPENS_AFTER(args->remaining);
 		/* all worker already used the counter */
 		free(args->remaining);
 
 		/* we now reduce the LU22 part (recursion appears there) */
 		cl_args *u11arg = malloc(sizeof(cl_args));
-	
+
 		struct starpu_task *task = starpu_task_create();
-			task->callback_func = dw_callback_codelet_update_u11;
-			task->callback_arg = u11arg;
-			task->cl = &cl11;
-			task->cl_arg = u11arg;
-			task->cl_arg_size = sizeof(*u11arg);
-
-			task->handles[0] = starpu_data_get_sub_data(args->dataA, 2, args->k + 1, args->k + 1);
-	
+		task->callback_func = dw_callback_codelet_update_u11;
+		task->callback_arg = u11arg;
+		task->cl = &cl11;
+		task->cl_arg = u11arg;
+		task->cl_arg_size = sizeof(*u11arg);
+
+		task->handles[0] = starpu_data_get_sub_data(args->dataA, 2, args->k + 1, args->k + 1);
+
 		u11arg->dataA = args->dataA;
 		u11arg->i = args->k + 1;
 		u11arg->nblocks = args->nblocks;
@@ -591,8 +595,7 @@ void dw_callback_codelet_update_u22(void *argcb)
 
 void dw_callback_codelet_update_u12_21(void *argcb)
 {
-	int ret;
-	cl_args *args = argcb;	
+	cl_args *args = argcb;
 	unsigned remaining = STARPU_ATOMIC_ADD(args->remaining, -1);
 	ANNOTATE_HAPPENS_BEFORE(args->remaining);
 
@@ -612,6 +615,8 @@ void dw_callback_codelet_update_u12_21(void *argcb)
 		{
 			for (slicex = i+1; slicex < nblocks; slicex++)
 			{
+				int ret;
+
 				/* update that square matrix */
 				cl_args *u22a = malloc(sizeof(cl_args));
 
@@ -646,7 +651,7 @@ void dw_callback_codelet_update_u12_21(void *argcb)
 
 
 /*
- *	code to bootstrap the factorization 
+ *	code to bootstrap the factorization
  */
 
 void dw_codelet_facto(starpu_data_handle_t dataA, unsigned nblocks)
@@ -660,7 +665,7 @@ void dw_codelet_facto(starpu_data_handle_t dataA, unsigned nblocks)
 
 	start = starpu_timing_now();
 
-	/* inject a new task with this codelet into the system */ 
+	/* inject a new task with this codelet into the system */
 	struct starpu_task *task = starpu_task_create();
 	task->callback_func = dw_callback_codelet_update_u11;
 	task->callback_arg = args;
@@ -706,7 +711,7 @@ void dw_codelet_facto_v2(starpu_data_handle_t dataA, unsigned nblocks)
 
 	start = starpu_timing_now();
 
-	/* inject a new task with this codelet into the system */ 
+	/* inject a new task with this codelet into the system */
 	struct starpu_task *task = starpu_task_create();
 	task->callback_func = dw_callback_v2_codelet_update_u11;
 	task->callback_arg = args;
@@ -714,7 +719,7 @@ void dw_codelet_facto_v2(starpu_data_handle_t dataA, unsigned nblocks)
 	task->cl_arg = args;
 	task->cl_arg_size = sizeof(*args);
 
-	task->handles[0] = starpu_data_get_sub_data(dataA, 2, 0, 0); 
+	task->handles[0] = starpu_data_get_sub_data(dataA, 2, 0, 0);
 
 	/* schedule the codelet */
 	int ret = starpu_task_submit(task);
@@ -777,7 +782,7 @@ void initialize_system(float **A, float **B, unsigned dim, unsigned pinned)
 	{
 		starpu_malloc((void **)A, (size_t)dim*dim*sizeof(float));
 		starpu_malloc((void **)B, (size_t)dim*sizeof(float));
-	} 
+	}
 	else
 	{
 		*A = malloc((size_t)dim*dim*sizeof(float));
@@ -801,8 +806,8 @@ void free_system(float *A, float *B, unsigned dim, unsigned pinned)
 	}
 }
 
-void dw_factoLU(float *matA, unsigned size, 
-		unsigned ld, unsigned nblocks, 
+void dw_factoLU(float *matA, unsigned size,
+		unsigned ld, unsigned nblocks,
 		unsigned version, unsigned _no_prio)
 {
 
@@ -820,7 +825,7 @@ void dw_factoLU(float *matA, unsigned size,
 
 	/* monitor and partition the A matrix into blocks :
 	 * one block is now determined by 2 unsigned (i,j) */
-	starpu_matrix_data_register(&dataA, STARPU_MAIN_RAM, (uintptr_t)matA, ld, 
+	starpu_matrix_data_register(&dataA, STARPU_MAIN_RAM, (uintptr_t)matA, ld,
 			size, size, sizeof(float));
 
 	struct starpu_data_filter f =

+ 2 - 2
examples/heat/dw_factolu.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010-2012, 2014  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
@@ -33,7 +33,7 @@
 #include "lu_kernels_model.h"
 
 #define FPRINTF(ofile, fmt, ...) do { if (!getenv("STARPU_SSILENT")) {fprintf(ofile, fmt, ## __VA_ARGS__); }} while(0)
-#define PRINTF(fmt, ...) do { if (!getenv("STARPU_SSILENT")) {(fmt, ## __VA_ARGS__); }} while(0)
+#define PRINTF(fmt, ...) do { if (!getenv("STARPU_SSILENT")) {printf(fmt, ## __VA_ARGS__); }} while(0)
 
 #define BLAS3_FLOP(n1,n2,n3)    \
         (2*((uint64_t)n1)*((uint64_t)n2)*((uint64_t)n3))

+ 1 - 4
examples/heat/heat.c

@@ -634,12 +634,11 @@ static unsigned build_sparse_stiffness_matrix_A(point *pmesh, float **nzval, uin
 
 		for (neighbour = 0; neighbour < nneighbours; neighbour++)
 		{
-			float val;
 			unsigned nodeneighbour =  neighbours[neighbour];
 
 			if (nodeneighbour < newsize)
 			{
-
+				float val;
 				val = compute_A_value(TRANSLATE(j), TRANSLATE(nodeneighbour), pmesh);
 
 				if (val != 0.0f)
@@ -658,8 +657,6 @@ static unsigned build_sparse_stiffness_matrix_A(point *pmesh, float **nzval, uin
 
 	rowptr[newsize] = pos;
 
-
-
 	return pos;
 }
 

+ 0 - 1
examples/interface/complex_kernels_opencl.c

@@ -28,7 +28,6 @@ void copy_complex_codelet_opencl(void *buffers[], void *_args)
         cl_int err;
 	cl_kernel kernel;
 	cl_command_queue queue;
-	cl_event event;
 
 	/* length of the vector */
 	unsigned n = STARPU_COMPLEX_GET_NX(buffers[0]);

+ 1 - 2
examples/lu/lu_example.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009-2016  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2015  CNRS
+ * Copyright (C) 2010, 2011, 2012, 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
@@ -395,7 +395,6 @@ int main(int argc, char **argv)
 
 	if (bound)
 	{
-		double min;
 		if (bounddeps)
 		{
 			FILE *f = fopen("lu.pl", "w");

+ 3 - 2
examples/lu/xlu_implicit.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2011, 2014-2015  Université de Bordeaux
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011, 2012, 2015  CNRS
+ * Copyright (C) 2010, 2011, 2012, 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
@@ -114,7 +114,6 @@ static int dw_codelet_facto_v3(starpu_data_handle_t dataA, unsigned nblocks)
 {
 	double start;
 	double end;
-	int ret;
 
 	/* create all the DAG nodes */
 	unsigned i,j,k;
@@ -126,6 +125,8 @@ static int dw_codelet_facto_v3(starpu_data_handle_t dataA, unsigned nblocks)
 
 	for (k = 0; k < nblocks; k++)
 	{
+		int ret;
+
 		ret = create_task_11(dataA, k);
 		if (ret == -ENODEV) return ret;
 

+ 5 - 4
examples/lu/xlu_implicit_pivot.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2012, 2014-2015  Université de Bordeaux
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011, 2012  CNRS
+ * Copyright (C) 2010, 2011, 2012, 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
@@ -160,7 +160,6 @@ static int dw_codelet_facto_pivot(starpu_data_handle_t *dataAp,
 {
 	double start;
 	double end;
-	int ret;
 
 	/* create all the DAG nodes */
 	unsigned i,j,k;
@@ -172,8 +171,10 @@ static int dw_codelet_facto_pivot(starpu_data_handle_t *dataAp,
 
 	for (k = 0; k < nblocks; k++)
 	{
-	     ret = create_task_11_pivot(dataAp, nblocks, k, piv_description, get_block);
-	     if (ret == -ENODEV) return ret;
+		int ret;
+
+		ret = create_task_11_pivot(dataAp, nblocks, k, piv_description, get_block);
+		if (ret == -ENODEV) return ret;
 
 		for (i = 0; i < nblocks; i++)
 		{

+ 10 - 10
examples/mandelbrot/mandelbrot.c

@@ -135,13 +135,13 @@ static void init_x11(int width, int height, unsigned *buffer)
 static int handle_events(void)
 {
 	XEvent event;
-	XNextEvent(dpy, &event);
-
-	KeySym key;
-	char text[255];
 
+	XNextEvent(dpy, &event);
 	if (event.type == KeyPress)
 	{
+		KeySym key;
+		char text[255];
+
 		XLookupString(&event.xkey,text,255,&key,0);
 		if (key == Left)
 		{
@@ -256,7 +256,6 @@ static void compute_block_opencl(void *descr[], void *cl_arg)
 
 	cl_kernel kernel;
 	cl_command_queue queue;
-	cl_event event;
 	cl_int err;
 
 	int id = starpu_worker_get_id_check();
@@ -290,11 +289,10 @@ static void compute_block_opencl(void *descr[], void *cl_arg)
 
 static void compute_block(void *descr[], void *cl_arg)
 {
-	int ix, iy;
-
 	int iby, block_size;
 	double stepX, stepY;
 	int *pcnt; /* unused for sequential tasks */
+
 	starpu_codelet_unpack_args(cl_arg, &iby, &block_size, &stepX, &stepY, &pcnt);
 
 	unsigned *data = (unsigned *)STARPU_VECTOR_GET_PTR(descr[0]);
@@ -302,6 +300,8 @@ static void compute_block(void *descr[], void *cl_arg)
 	int local_iy;
 	for (local_iy = 0; local_iy < block_size; local_iy++)
 	{
+		int ix, iy;
+
 		iy = iby*block_size + local_iy;
 		for (ix = 0; ix < width; ix++)
 		{
@@ -343,11 +343,11 @@ static void compute_block_spmd(void *descr[], void *cl_arg)
 
 	unsigned *data = (unsigned *)STARPU_VECTOR_GET_PTR(descr[0]);
 
-	int ix, iy; /* global coordinates */
-	int local_iy; /* current line */
-
 	while (1)
 	{
+		int ix, iy; /* global coordinates */
+		int local_iy; /* current line */
+
 		local_iy = STARPU_ATOMIC_ADD((unsigned int *)pcnt, 1) - 1;
 		ANNOTATE_HAPPENS_BEFORE(pcnt);
 		if (local_iy >= block_size)

+ 2 - 1
examples/matvecmult/matvecmult.c

@@ -32,7 +32,6 @@ void opencl_codelet(void *descr[], STARPU_ATTRIBUTE_UNUSED void *_args)
 	cl_mem mult = (cl_mem)STARPU_VECTOR_GET_DEV_HANDLE(descr[2]);
 	int nx = STARPU_MATRIX_GET_NX(descr[0]);
 	int ny = STARPU_MATRIX_GET_NY(descr[0]);
-	cl_event event;
 
         id = starpu_worker_get_id_check();
         devid = starpu_worker_get_devid(id);
@@ -67,6 +66,7 @@ void fillArray(float* pfData, int iSize)
     }
 }
 
+#if 0
 void printArray(float* pfData, int iSize)
 {
     int i;
@@ -76,6 +76,7 @@ void printArray(float* pfData, int iSize)
     }
     FPRINTF(stderr, "\n");
 }
+#endif
 
 void matVecMult(const float *matrix, const float *vector, int width, int height, float *mult)
 {

+ 3 - 1
examples/mult/xgemm.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009-2016  Université de Bordeaux
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * 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
@@ -85,7 +85,9 @@ static void check_output(void)
 
 static void init_problem_data(void)
 {
+#ifndef STARPU_SIMGRID
 	unsigned i,j;
+#endif
 
 	starpu_malloc_flags((void **)&A, zdim*ydim*sizeof(TYPE), STARPU_MALLOC_PINNED|STARPU_MALLOC_SIMULATION_FOLDED);
 	starpu_malloc_flags((void **)&B, xdim*zdim*sizeof(TYPE), STARPU_MALLOC_PINNED|STARPU_MALLOC_SIMULATION_FOLDED);

+ 2 - 2
examples/pi/pi.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2010-2011, 2013-2015  Université de Bordeaux
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * 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
@@ -203,7 +203,7 @@ int main(int argc, char **argv)
 	unsigned long total_shot_cnt = ntasks * nshot_per_task;
 
 	/* Total surface : Pi * r^ 2 = Pi*1^2, total square surface : 2^2 = 4, probability to impact the disk: pi/4 */
-	FPRINTF(stderr, "Pi approximation : %f (%ld / %ld)\n", ((TYPE)total_cnt*4)/(total_shot_cnt), total_cnt, total_shot_cnt);
+	FPRINTF(stderr, "Pi approximation : %f (%lu / %lu)\n", ((TYPE)total_cnt*4)/(total_shot_cnt), total_cnt, total_shot_cnt);
 	FPRINTF(stderr, "Total time : %f ms\n", timing/1000.0);
 	FPRINTF(stderr, "Speed : %f GShot/s\n", total_shot_cnt/(1e3*timing));
 

+ 1 - 1
examples/pi/pi_redux.c

@@ -400,7 +400,7 @@ int main(int argc, char **argv)
 	double pi_approx = ((double)shot_cnt*4.0)/total;
 
 	FPRINTF(stderr, "Reductions? %s\n", use_redux?"yes":"no");
-	FPRINTF(stderr, "Pi approximation : %f (%ld / %ld)\n", pi_approx, shot_cnt, total);
+	FPRINTF(stderr, "Pi approximation : %f (%lu / %lu)\n", pi_approx, shot_cnt, total);
 	FPRINTF(stderr, "Error %e \n", pi_approx - PI);
 	FPRINTF(stderr, "Total time : %f ms\n", timing/1000.0);
 	FPRINTF(stderr, "Speed : %f GShot/s\n", total/(1e3*timing));

+ 9 - 6
examples/ppm_downscaler/ppm_downscaler.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010, 2015  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2013  CNRS
+ * Copyright (C) 2010, 2011, 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
@@ -54,7 +54,7 @@ struct ppm_image *file_to_ppm(char *filename)
 
 	struct ppm_image *ppm = (struct ppm_image *) malloc(sizeof(struct ppm_image));
 	assert(ppm);
-	
+
 	FILE *file = fopen(filename, "r");
 	assert(file);
 
@@ -66,7 +66,7 @@ struct ppm_image *file_to_ppm(char *filename)
 		fprintf(stderr, "file %s is not valid\n", filename);
 		exit(-1);
 	}
-	
+
 	/* allocate a buffer for the image */
 #ifdef STARPU_HAVE_MEMALIGN
 	ppm->data = (struct ppm_color *) memalign(16384, ppm->ncols*ppm->nlines*sizeof(struct ppm_color));
@@ -98,7 +98,7 @@ void ppm_to_file(struct ppm_image *ppm, char *filename)
 	fprintf(file, "P6\n%d %d\n%d\n", ppm->ncols, ppm->nlines, ppm->coldepth);
 
 	fwrite(&ppm->data[0], sizeof(struct ppm_color), ppm->ncols*ppm->nlines, file);
-	
+
 	fclose(file);
 }
 
@@ -133,7 +133,7 @@ void dummy_downscale(struct ppm_image *input_ppm, struct ppm_image *output_ppm)
 
 			unsigned big_col = col*FACTOR;
 			unsigned big_line = line*FACTOR;
-			
+
 			/* compute the average value of all components */
 			unsigned i, j;
 			for (i = 0; i < FACTOR; i++)
@@ -155,7 +155,7 @@ void dummy_downscale(struct ppm_image *input_ppm, struct ppm_image *output_ppm)
 			out[col + line*output_ppm->ncols].b = (unsigned char)(sum_b/(FACTOR*FACTOR));
 
 /*			fprintf(stderr, "col %d line %d -> sum_r = %d out -> %d\n", col, line, sum_r, out[col + line*FACTOR].r); */
-	
+
 		}
 	}
 }
@@ -180,5 +180,8 @@ int main(int argc, char **argv)
 
 	ppm_to_file(output_ppm, filename_out);
 
+	free(input_ppm);
+	free(output_ppm);
+
 	return 0;
 }

+ 0 - 2
examples/reductions/dot_product.c

@@ -162,7 +162,6 @@ void redux_opencl_func(void *buffers[], void *args)
         cl_int err;
 	cl_kernel kernel;
 	cl_command_queue queue;
-	cl_event event;
 
 	cl_mem dota = (cl_mem) STARPU_VARIABLE_GET_PTR(buffers[0]);
 	cl_mem dotb = (cl_mem) STARPU_VARIABLE_GET_PTR(buffers[1]);
@@ -274,7 +273,6 @@ void dot_opencl_func(void *buffers[], void *args)
         cl_int err;
 	cl_kernel kernel;
 	cl_command_queue queue;
-	cl_event event;
 
 	cl_mem x = (cl_mem) STARPU_VECTOR_GET_DEV_HANDLE(buffers[0]);
 	cl_mem y = (cl_mem) STARPU_VECTOR_GET_DEV_HANDLE(buffers[1]);

+ 1 - 1
examples/sched_ctx/dummy_sched_with_ctx.c

@@ -82,7 +82,6 @@ static int push_task_dummy(struct starpu_task *task)
 
         /*if there are no tasks block */
         /* wake people waiting for a task */
-        unsigned worker = 0;
 	struct starpu_worker_collection *workers = starpu_sched_ctx_get_worker_collection(sched_ctx_id);
 
         struct starpu_sched_ctx_iterator it;
@@ -90,6 +89,7 @@ static int push_task_dummy(struct starpu_task *task)
 	workers->init_iterator(workers, &it);
 	while(workers->has_next(workers, &it))
         {
+		unsigned worker;
                 worker = workers->get_next(workers, &it);
 		starpu_pthread_mutex_t *sched_mutex;
                 starpu_pthread_cond_t *sched_cond;

+ 3 - 3
examples/sched_ctx/nested_sched_ctxs.c

@@ -53,7 +53,7 @@ static void sched_ctx_func(void *descr[] STARPU_ATTRIBUTE_UNUSED, void *arg)
 	int w = starpu_worker_get_id();
 	unsigned sched_ctx = (uintptr_t)arg;
 	int n = parallel_code(sched_ctx);
-//	printf("w %d executed %d it \n", w, n);
+	//printf("w %d executed %d it \n", w, n);
 }
 
 
@@ -230,8 +230,8 @@ int main(int argc, char **argv)
 	starpu_sched_ctx_delete(sched_ctx1);
 	starpu_sched_ctx_delete(sched_ctx2);
 
-	printf("ctx%d: tasks starpu executed %d out of %d\n", sched_ctx1, tasks_executed[0], NTASKS);
-	printf("ctx%d: tasks starpu executed %d out of %d\n", sched_ctx2, tasks_executed[1], NTASKS);
+	printf("ctx%u: tasks starpu executed %d out of %d\n", sched_ctx1, tasks_executed[0], NTASKS);
+	printf("ctx%u: tasks starpu executed %d out of %d\n", sched_ctx2, tasks_executed[1], NTASKS);
 
 #ifdef STARPU_USE_CPU
 	free(procs1);

+ 2 - 2
examples/sched_ctx/parallel_code.c

@@ -216,8 +216,8 @@ enodev:
 
 	starpu_sched_ctx_delete(sched_ctx1);
 	starpu_sched_ctx_delete(sched_ctx2);
-	printf("ctx%d: tasks starpu executed %d out of %d\n", sched_ctx1, tasks_executed[0], NTASKS);
-	printf("ctx%d: tasks starpu executed %d out of %d\n", sched_ctx2, tasks_executed[1], NTASKS);
+	printf("ctx%u: tasks starpu executed %d out of %d\n", sched_ctx1, tasks_executed[0], NTASKS);
+	printf("ctx%u: tasks starpu executed %d out of %d\n", sched_ctx2, tasks_executed[1], NTASKS);
 	starpu_shutdown();
 
 	free(procs1);

+ 1 - 2
examples/sched_ctx/parallel_tasks_reuse_handle.c

@@ -39,7 +39,6 @@ struct context
 void parallel_task_prologue_init_once_and_for_all(void * sched_ctx_)
 {
 	int sched_ctx = *(int *)sched_ctx_;
-	int i;
 	int *cpuids = NULL;
 	int ncpuids = 0;
 	starpu_sched_ctx_get_available_cpuids(sched_ctx, &cpuids, &ncpuids);
@@ -79,7 +78,7 @@ void parallel_task_init_one_context(unsigned * context_id)
 	t->prologue_callback_pop_arg=context_id;
 	t->prologue_callback_pop_arg_free=0;
 
-	int ret=starpu_task_submit(t);
+	starpu_task_submit(t);
 }
 
 struct context main_context;

+ 3 - 3
examples/sched_ctx/sched_ctx_without_sched_policy.c

@@ -129,7 +129,7 @@ int main(int argc, char **argv)
 
 		task->cl = &sched_ctx_codelet;
 		task->cl_arg = (void*)(uintptr_t) sched_ctx1;
-		
+
 		/*submit tasks to context*/
 		ret = starpu_task_submit_to_ctx(task,sched_ctx1);
 
@@ -161,8 +161,8 @@ int main(int argc, char **argv)
 
 	starpu_sched_ctx_delete(sched_ctx1);
 	starpu_sched_ctx_delete(sched_ctx2);
-	printf("ctx%d: tasks starpu executed %d out of %d\n", sched_ctx1, tasks_executed[0], NTASKS*NTASKS);
-	printf("ctx%d: tasks starpu executed %d out of %d\n", sched_ctx2, tasks_executed[1], NTASKS*NTASKS);
+	printf("ctx%u: tasks starpu executed %d out of %d\n", sched_ctx1, tasks_executed[0], NTASKS*NTASKS);
+	printf("ctx%u: tasks starpu executed %d out of %d\n", sched_ctx2, tasks_executed[1], NTASKS*NTASKS);
 
 enodev:
 #ifdef STARPU_USE_CPU

+ 2 - 2
examples/sched_ctx/sched_ctx_without_sched_policy_awake.c

@@ -153,8 +153,8 @@ int main(int argc, char **argv)
 		tasks_per_ctx[1] += tasks_executed[1][i];
 	}
 
-	printf("ctx%d: tasks starpu executed %d out of %d\n", sched_ctx1, tasks_per_ctx[0]/nprocs1, NTASKS);
-	printf("ctx%d: tasks starpu executed %d out of %d\n", sched_ctx2, tasks_per_ctx[1]/nprocs2, NTASKS);
+	printf("ctx%u: tasks starpu executed %d out of %d\n", sched_ctx1, tasks_per_ctx[0]/nprocs1, NTASKS);
+	printf("ctx%u: tasks starpu executed %d out of %d\n", sched_ctx2, tasks_per_ctx[1]/nprocs2, NTASKS);
 
 enodev:
 #ifdef STARPU_USE_CPU

+ 8 - 8
examples/sched_ctx_utils/sched_ctx_utils.c

@@ -120,12 +120,12 @@ void start_2benchs(void (*bench)(unsigned, unsigned))
 {
 	p1.bench = bench;
 	p1.size = size1;
-	printf("size %d\n", size1);
+	printf("size %u\n", size1);
 	p1.nblocks = nblocks1;
 
 	p2.bench = bench;
 	p2.size = size2;
-	printf("size %d\n", size2);
+	printf("size %u\n", size2);
 	p2.nblocks = nblocks2;
 
 	starpu_pthread_t tid[2];
@@ -216,20 +216,20 @@ void construct_contexts(void (*bench)(unsigned, unsigned))
 	for(i = 0; i < gpu; i++)
 	{
 		procs[k++] = i;
-		printf("%d ", i);
+		printf("%u ", i);
 	}
 
 	for(i = gpu; i < gpu + gpu1; i++)
 	{
 		procs[k++] = i;
-		printf("%d ", i);
+		printf("%u ", i);
 	}
 
 
 	for(i = n_all_gpus; i < n_all_gpus + cpu1; i++)
 	{
 		procs[k++] = i;
-		printf("%d ", i);
+		printf("%u ", i);
 	}
 	printf("\n ");
 
@@ -244,19 +244,19 @@ void construct_contexts(void (*bench)(unsigned, unsigned))
 	for(i = 0; i < gpu; i++)
 	{
 		procs2[k++] = i;
-		printf("%d ", i);
+		printf("%u ", i);
 	}
 
 	for(i = gpu + gpu1; i < gpu + gpu1 + gpu2; i++)
 	{
 		procs2[k++] = i;
-		printf("%d ", i);
+		printf("%u ", i);
 	}
 
 	for(i = n_all_gpus  + cpu1; i < n_all_gpus + cpu1 + cpu2; i++)
 	{
 		procs2[k++] = i;
-		printf("%d ", i);
+		printf("%u ", i);
 	}
 	printf("\n");
 

+ 1 - 1
examples/scheduler/dummy_sched.c

@@ -88,7 +88,6 @@ static int push_task_dummy(struct starpu_task *task)
 
         /*if there are no tasks block */
         /* wake people waiting for a task */
-        unsigned worker = 0;
 	struct starpu_worker_collection *workers = starpu_sched_ctx_get_worker_collection(sched_ctx_id);
 
         struct starpu_sched_ctx_iterator it;
@@ -96,6 +95,7 @@ static int push_task_dummy(struct starpu_task *task)
 	workers->init_iterator(workers, &it);
 	while(workers->has_next(workers, &it))
         {
+		unsigned worker;
                 worker = workers->get_next(workers, &it);
 		starpu_pthread_mutex_t *sched_mutex;
                 starpu_pthread_cond_t *sched_cond;

+ 8 - 10
examples/spmd/vector_scal_spmd.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011, 2012, 2013, 2015  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2015, 2016  CNRS
  * Copyright (C) 2010-2013, 2015  Université de Bordeaux
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -109,16 +109,7 @@ int main(int argc, char **argv)
 	unsigned i;
 	int ret;
 
-	vector = malloc(NX*sizeof(*vector));
-
-	for (i = 0; i < NX; i++)
-		vector[i] = (i+1.0f);
-
-	FPRINTF(stderr, "BEFORE: First element was %f\n", vector[0]);
-	FPRINTF(stderr, "BEFORE: Last element was %f\n", vector[NX-1]);
-
 	starpu_conf_init(&conf);
-
 	conf.single_combined_worker = 1;
 	conf.sched_policy_name = "pheft";
 
@@ -126,6 +117,13 @@ int main(int argc, char **argv)
 	if (ret == -ENODEV) return 77;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
+	vector = malloc(NX*sizeof(*vector));
+	for (i = 0; i < NX; i++)
+		vector[i] = (i+1.0f);
+
+	FPRINTF(stderr, "BEFORE: First element was %f\n", vector[0]);
+	FPRINTF(stderr, "BEFORE: Last element was %f\n", vector[NX-1]);
+
 	starpu_data_handle_t vector_handle;
 	starpu_vector_data_register(&vector_handle, STARPU_MAIN_RAM, (uintptr_t)vector, NX, sizeof(vector[0]));
 

+ 3 - 3
examples/spmv/dw_block_spmv.c

@@ -2,7 +2,7 @@
  *
  * Copyright (C) 2009-2012, 2014-2015  Université de Bordeaux
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
- * Copyright (C) 2010, 2011, 2012, 2013, 2014  CNRS
+ * Copyright (C) 2010, 2011, 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
@@ -44,7 +44,7 @@ static sem_t sem;
 static unsigned c = 256;
 static unsigned r = 256;
 
-static unsigned remainingtasks = -1;
+static int remainingtasks = -1;
 
 static starpu_data_handle_t sparse_matrix;
 static starpu_data_handle_t vector_in, vector_out;
@@ -271,7 +271,7 @@ void launch_spmv_codelets(void)
 		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 	}
 
-	printf("end of task submission (there was %d chains for %d tasks : ratio %d tasks per chain) !\n", nchains, totaltasks, totaltasks/nchains);
+	printf("end of task submission (there was %u chains for %u tasks : ratio %u tasks per chain) !\n", nchains, totaltasks, totaltasks/nchains);
 }
 
 void init_problem(void)

+ 6 - 6
examples/spmv/matrix_market/mm_to_bcsr.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2011, 2014  CNRS
+ * Copyright (C) 2010, 2011, 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
@@ -19,7 +19,7 @@
 
 static void print_block(tmp_block_t *block, unsigned r, unsigned c)
 {
-	printf(" **** block %d %d **** \n", block->i, block->j);
+	printf(" **** block %u %u **** \n", block->i, block->j);
 
 	unsigned i, j;
 	for (j = 0; j < r; j++)
@@ -47,9 +47,9 @@ static void print_all_blocks(tmp_block_t *block_list, unsigned r, unsigned c)
 static void print_bcsr(bcsr_t *bcsr)
 {
 	fprintf(stderr, "** BSCR **\n");
-	fprintf(stderr, "non zero - blocks = %d\n", bcsr->nnz_blocks);
-	fprintf(stderr, "nrows - blocks = %d\n", bcsr->nrows_blocks);
-	fprintf(stderr, "block size : c %d r %d\n", bcsr->c, bcsr->r);
+	fprintf(stderr, "non zero - blocks = %u\n", bcsr->nnz_blocks);
+	fprintf(stderr, "nrows - blocks = %u\n", bcsr->nrows_blocks);
+	fprintf(stderr, "block size : c %u r %u\n", bcsr->c, bcsr->r);
 }
 
 static unsigned count_blocks(tmp_block_t *block_list)
@@ -358,7 +358,7 @@ bcsr_t *mm_file_to_bcsr(char *filename, unsigned c, unsigned r)
 
 	for (i=0; i<nz; i++)
 	{
-		fscanf(f, "%d %d %f\n", &I[i], &J[i], &val[i]);
+		fscanf(f, "%u %u %f\n", &I[i], &J[i], &val[i]);
 		I[i]--;  /* adjust from 1-based to 0-based */
 		J[i]--;
 	}

+ 35 - 19
examples/spmv/matrix_market/mmio.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2013, 2014  CNRS
+ * Copyright (C) 2010, 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
@@ -126,8 +126,7 @@ int mm_read_banner(FILE *f, MM_typecode *matcode)
     if (fgets(line, MM_MAX_LINE_LENGTH, f) == NULL)
         return MM_PREMATURE_EOF;
 
-    if (sscanf(line, "%s %s %s %s %s", banner, mtx, crd, data_type,
-        storage_scheme) != 5)
+    if (sscanf(line, "%MM_MAX_TOKEN_LENGTHs %MM_MAX_TOKEN_LENGTHs %MM_MAX_TOKEN_LENGTHs %MM_MAX_TOKEN_LENGTHs %MM_MAX_TOKEN_LENGTHs", banner, mtx, crd, data_type, storage_scheme) != 5)
         return MM_PREMATURE_EOF;
 
     for (p=mtx; *p!='\0'; *p=tolower(*p),p++);  /* convert to lower case */
@@ -206,7 +205,6 @@ int mm_write_mtx_crd_size(FILE *f, int M, int N, int nz)
 int mm_read_mtx_crd_size(FILE *f, int *M, int *N, int *nz )
 {
     char line[MM_MAX_LINE_LENGTH];
-    int num_items_read;
 
     /* set return null parameter values, in case we exit with errors */
     *M = *N = *nz = 0;
@@ -225,8 +223,9 @@ int mm_read_mtx_crd_size(FILE *f, int *M, int *N, int *nz )
     else
     do
     {
-        num_items_read = fscanf(f, "%d %d %d", M, N, nz);
-        if (num_items_read == EOF) return MM_PREMATURE_EOF;
+	    int num_items_read;
+	    num_items_read = fscanf(f, "%d %d %d", M, N, nz);
+	    if (num_items_read == EOF) return MM_PREMATURE_EOF;
     }
     while (num_items_read != 3);
 
@@ -237,7 +236,6 @@ int mm_read_mtx_crd_size(FILE *f, int *M, int *N, int *nz )
 int mm_read_mtx_array_size(FILE *f, int *M, int *N)
 {
     char line[MM_MAX_LINE_LENGTH];
-    int num_items_read;
     /* set return null parameter values, in case we exit with errors */
     *M = *N = 0;
 
@@ -255,8 +253,9 @@ int mm_read_mtx_array_size(FILE *f, int *M, int *N)
     else /* we have a blank line */
     do
     {
-        num_items_read = fscanf(f, "%d %d", M, N);
-        if (num_items_read == EOF) return MM_PREMATURE_EOF;
+	    int num_items_read;
+	    num_items_read = fscanf(f, "%d %d", M, N);
+	    if (num_items_read == EOF) return MM_PREMATURE_EOF;
     }
     while (num_items_read != 2);
 
@@ -361,15 +360,23 @@ int mm_read_mtx_crd(char *fname, int *M, int *N, int *nz, int **I, int **J,
 
 
     if ((ret_code = mm_read_banner(f, matcode)) != 0)
-        return ret_code;
+    {
+	    if (f != stdin) fclose(f);
+	    return ret_code;
+    }
 
     if (!(mm_is_valid(*matcode) && mm_is_sparse(*matcode) &&
             mm_is_matrix(*matcode)))
-        return MM_UNSUPPORTED_TYPE;
+    {
+	    if (f != stdin) fclose(f);
+	    return MM_UNSUPPORTED_TYPE;
+    }
 
     if ((ret_code = mm_read_mtx_crd_size(f, M, N, nz)) != 0)
-        return ret_code;
-
+    {
+	    if (f != stdin) fclose(f);
+	    return ret_code;
+    }
 
     *I = (int *)  malloc(*nz * sizeof(int));
     *J = (int *)  malloc(*nz * sizeof(int));
@@ -380,21 +387,33 @@ int mm_read_mtx_crd(char *fname, int *M, int *N, int *nz, int **I, int **J,
         *val = (double *) malloc(*nz * 2 * sizeof(double));
         ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *I, *J, *val,
                 *matcode);
-        if (ret_code != 0) return ret_code;
+        if (ret_code != 0)
+	{
+		if (f != stdin) fclose(f);
+		return ret_code;
+	}
     }
     else if (mm_is_real(*matcode))
     {
         *val = (double *) malloc(*nz * sizeof(double));
         ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *I, *J, *val,
                 *matcode);
-        if (ret_code != 0) return ret_code;
+        if (ret_code != 0)
+	{
+		if (f != stdin) fclose(f);
+		return ret_code;
+	}
     }
 
     else if (mm_is_pattern(*matcode))
     {
         ret_code = mm_read_mtx_crd_data(f, *M, *N, *nz, *I, *J, *val,
                 *matcode);
-        if (ret_code != 0) return ret_code;
+        if (ret_code != 0)
+	{
+		if (f != stdin) fclose(f);
+		return ret_code;
+	}
     }
 
     if (f != stdin) fclose(f);
@@ -475,13 +494,10 @@ char  *mm_typecode_to_str(MM_typecode matcode)
     char buffer[MM_MAX_LINE_LENGTH];
     char *types[4];
 /*	char *mm_strdup(const char *); */
-    int error =0;
 
     /* check for MTX type */
     if (mm_is_matrix(matcode))
         types[0] = MM_MTX_STR;
-    else
-        error=1;
 
     /* check for CRD or ARR matrix */
     if (mm_is_sparse(matcode))

+ 0 - 1
examples/spmv/spmv_kernels.c

@@ -27,7 +27,6 @@ void spmv_kernel_opencl(void *descr[], void *args)
 {
 	cl_kernel kernel;
 	cl_command_queue queue;
-	cl_event event;
 	int id, devid, err, n;
 
 	int nnz = (int) STARPU_CSR_GET_NNZ(descr[0]);

+ 0 - 1
examples/stencil/life_opencl.c

@@ -113,7 +113,6 @@ opencl_life_update_host(int bz, const TYPE *old, TYPE *newp, int nx, int ny, int
   clSetKernelArg(kernel, 7, sizeof(ldz), &ldz);
   clSetKernelArg(kernel, 8, sizeof(iter), &iter);
 
-  cl_event ev;
   err = clEnqueueNDRangeKernel(cq, kernel, 3, NULL, dim, NULL, 0, NULL, NULL);
   if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err);
 }

+ 0 - 1
examples/stencil/shadow_opencl.c

@@ -109,7 +109,6 @@ opencl_shadow_host(int bz, TYPE *ptr, int nx, int ny, int nz, int ldy, int ldz,
         clSetKernelArg(kernel, 6, sizeof(ldz), &ldz);
         clSetKernelArg(kernel, 7, sizeof(i), &i);
 
-        cl_event ev;
         err = clEnqueueNDRangeKernel(cq, kernel, 3, NULL, dim, NULL, 0, NULL, NULL);
         if (err != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(err);
 }

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

@@ -395,7 +395,7 @@ void check(int rank)
 				for (y = 0; y < sizey; y++)
 					for (z = 0; z < size_bz; z++)
 						sum += block->layers[0][(K+x)+(K+y)*(sizex + 2*K)+(K+z)*(sizex+2*K)*(sizey+2*K)];
-			printf("block %d got %d/%d alive\n", bz, sum, sizex*sizey*size_bz);
+			printf("block %u got %u/%u alive\n", bz, sum, sizex*sizey*size_bz);
 #endif
 		}
 	}

+ 6 - 8
examples/stencil/stencil-kernels.c

@@ -186,9 +186,9 @@ static void update_func_cuda(void *descr[], void *arg)
 	int workerid = starpu_worker_get_id_check();
 	DEBUG( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
 	if (block->bz == 0)
-		FPRINTF(stderr,"!!! DO update_func_cuda z %d CUDA%d !!!\n", block->bz, workerid);
+		FPRINTF(stderr,"!!! DO update_func_cuda z %u CUDA%d !!!\n", block->bz, workerid);
 	else
-		DEBUG( "!!! DO update_func_cuda z %d CUDA%d !!!\n", block->bz, workerid);
+		DEBUG( "!!! DO update_func_cuda z %u CUDA%d !!!\n", block->bz, workerid);
 #if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
 	int rank = 0;
 	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -257,7 +257,6 @@ static void load_subblock_from_buffer_opencl(struct starpu_block_interface *bloc
 	unsigned offset = firstz*block->ldz;
 	cl_mem block_data = (cl_mem)block->dev_handle;
 	cl_mem boundary_data = (cl_mem)boundary->dev_handle;
-	cl_event event;
 
         cl_command_queue cq;
         starpu_opencl_get_current_queue(&cq);
@@ -274,9 +273,9 @@ static void update_func_opencl(void *descr[], void *arg)
 	int workerid = starpu_worker_get_id_check();
 	DEBUG( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
 	if (block->bz == 0)
-		FPRINTF(stderr,"!!! DO update_func_opencl z %d OPENCL%d !!!\n", block->bz, workerid);
+		FPRINTF(stderr,"!!! DO update_func_opencl z %u OPENCL%d !!!\n", block->bz, workerid);
 	else
-		DEBUG( "!!! DO update_func_opencl z %d OPENCL%d !!!\n", block->bz, workerid);
+		DEBUG( "!!! DO update_func_opencl z %u OPENCL%d !!!\n", block->bz, workerid);
 #if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
 	int rank = 0;
 	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -344,9 +343,9 @@ void update_func_cpu(void *descr[], void *arg)
 	int workerid = starpu_worker_get_id_check();
 	DEBUG( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
 	if (block->bz == 0)
-		FPRINTF(stderr,"!!! DO update_func_cpu z %d CPU%d !!!\n", block->bz, workerid);
+		FPRINTF(stderr,"!!! DO update_func_cpu z %u CPU%d !!!\n", block->bz, workerid);
 	else
-		DEBUG( "!!! DO update_func_cpu z %d CPU%d !!!\n", block->bz, workerid);
+		DEBUG( "!!! DO update_func_cpu z %u CPU%d !!!\n", block->bz, workerid);
 #if defined(STARPU_USE_MPI) && !defined(STARPU_SIMGRID)
 	int rank = 0;
 	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
@@ -491,7 +490,6 @@ static void load_subblock_into_buffer_opencl(struct starpu_block_interface *bloc
 
         cl_command_queue cq;
         starpu_opencl_get_current_queue(&cq);
-	cl_event event;
 
         cl_int ret = clEnqueueCopyBuffer(cq, block_data, boundary_data, offset, 0, boundary_size, 0, NULL, NULL);
 	if (ret != CL_SUCCESS) STARPU_OPENCL_REPORT_ERROR(ret);

+ 6 - 6
examples/stencil/stencil.c

@@ -114,10 +114,10 @@ static void parse_args(int argc, char **argv)
 			 fprintf(stderr, "\n");
 			 fprintf(stderr, "Options:\n");
 			 fprintf(stderr, "-b			bind tasks on CPUs/GPUs\n");
-			 fprintf(stderr, "-nbz <n>		Number of blocks on Z axis (%d by default)\n", nbz);
-			 fprintf(stderr, "-size[xyz] <size>	Domain size on x/y/z axis (%dx%dx%d by default)\n", sizex, sizey, sizez);
-			 fprintf(stderr, "-niter <n>		Number of iterations (%d by default)\n", niter);
-			 fprintf(stderr, "-ticks <t>		How often to put ticks in the output (ms, %d by default)\n", ticks);
+			 fprintf(stderr, "-nbz <n>		Number of blocks on Z axis (%u by default)\n", nbz);
+			 fprintf(stderr, "-size[xyz] <size>	Domain size on x/y/z axis (%ux%ux%u by default)\n", sizex, sizey, sizez);
+			 fprintf(stderr, "-niter <n>		Number of iterations (%u by default)\n", niter);
+			 fprintf(stderr, "-ticks <t>		How often to put ticks in the output (ms, %u by default)\n", ticks);
 			 exit(0);
 		}
 	}
@@ -181,7 +181,7 @@ void f(unsigned task_per_worker[STARPU_NMAXWORKERS])
 		{
 			char name[32];
 			starpu_worker_get_name(worker, name, sizeof(name));
-			FPRINTF(stderr,"\t%s -> %d (%2.2f%%)\n", name, task_per_worker[worker], (100.0*task_per_worker[worker])/total);
+			FPRINTF(stderr,"\t%s -> %u (%2.2f%%)\n", name, task_per_worker[worker], (100.0*task_per_worker[worker])/total);
 		}
 	}
 }
@@ -328,9 +328,9 @@ int main(int argc, char **argv)
 		unsigned nzblocks_per_process = (nbz + world_size - 1) / world_size;
 
 		int iter;
-		unsigned last, bz;
 		for (iter = 0; iter < who_runs_what_len; iter++)
 		{
+			unsigned last, bz;
 			last = 1;
 			for (bz = 0; bz < nbz; bz++)
 			{

+ 3 - 2
examples/tag_example/tag_example2.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2012-2013, 2015  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
@@ -76,12 +76,13 @@ static void tag_cleanup_grid(unsigned iter)
 static int create_task_grid(unsigned iter)
 {
 	unsigned i;
-	int ret;
 
 /*	FPRINTF(stderr, "start iter %d ni %d...\n", iter, ni); */
 
 	for (i = 0; i < ni; i++)
 	{
+		int ret;
+
 		/* create a new task */
 		struct starpu_task *task = starpu_task_create();
 

+ 3 - 2
examples/tag_example/tag_example3.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2012-2013, 2015  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
@@ -78,12 +78,13 @@ static void tag_cleanup_grid(unsigned iter)
 static int create_task_grid(unsigned iter)
 {
 	int i;
-	int ret;
 
 /*	FPRINTF(stderr, "start iter %d ni %d...\n", iter, ni); */
 
 	for (i = ni - 1; i > 0; i--)
 	{
+		int ret;
+
 		/* create a new task */
 		struct starpu_task *task = starpu_task_create();
 

+ 2 - 2
examples/tag_example/tag_restartable.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2013, 2015  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2015  CNRS
+ * Copyright (C) 2010, 2011, 2012, 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
@@ -109,12 +109,12 @@ static void create_task_grid(unsigned iter)
 static int start_task_grid(unsigned iter)
 {
 	unsigned i;
-	int ret;
 
 	/* FPRINTF(stderr, "start grid %d ni %d...\n", iter, ni); */
 
 	for (i = 0; i < ni; i++)
 	{
+		int ret;
 		ret = starpu_task_submit(tasks[iter][i]);
 		if (ret == -ENODEV) return 77;
 		STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");

+ 5 - 5
examples/worker_collections/worker_list_example.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2015  Université de Bordeaux
- * Copyright (C) 2010-2014  CNRS
+ * Copyright (C) 2010-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
@@ -45,7 +45,7 @@ int main()
 	co->init_iterator = worker_list.init_iterator;
 	co->type = STARPU_WORKER_LIST;
 
-	FPRINTF(stderr, "ncpus %d \n", ncpus);
+	FPRINTF(stderr, "ncpus %u\n", ncpus);
 
 	double start_time;
 	double end_time;
@@ -72,19 +72,19 @@ int main()
 	while(co->has_next(co, &it))
 	{
 		pu = co->get_next(co, &it);
-		FPRINTF(stderr, "pu = %d out of %d workers \n", pu, co->nworkers);
+		FPRINTF(stderr, "pu = %d out of %u workers \n", pu, co->nworkers);
 	}
 
 	for(i = 0; i < 6; i++)
 	{
 		co->remove(co, i);
-		FPRINTF(stderr, "remove %d out of %d workers\n", i, co->nworkers);
+		FPRINTF(stderr, "remove %u out of %u workers\n", i, co->nworkers);
 	}
 
 	while(co->has_next(co, &it))
 	{
 		pu = co->get_next(co, &it);
-		FPRINTF(stderr, "pu = %d out of %d workers \n", pu, co->nworkers);
+		FPRINTF(stderr, "pu = %d out of %u workers\n", pu, co->nworkers);
 	}
 
 	FPRINTF(stderr, "timing init = %lf \n", timing);