Browse Source

minor fixes following sonar-scanner warnings

Nathalie Furmento 7 years ago
parent
commit
130d46371a

+ 2 - 2
mpi/examples/complex/mpi_complex.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2012, 2013, 2015, 2016  CNRS
+ * Copyright (C) 2012, 2013, 2015, 2016, 2017  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
@@ -122,5 +122,5 @@ int main(int argc, char **argv)
 	starpu_mpi_shutdown();
 	starpu_shutdown();
 
-	if (rank == 0) return !compare; else return 0;
+	return (rank == 0) ? !compare : 0;
 }

+ 3 - 2
mpi/examples/matrix_decomposition/mpi_decomposition_params.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2009, 2010, 2015-2017  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2015, 2016  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2015, 2016, 2017  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
@@ -90,7 +90,8 @@ void parse_args(int argc, char **argv, int nodes)
                 }
         }
 
-        if (nblocks > size) nblocks = size;
+        if (nblocks > size)
+		nblocks = size;
 
 	if (dblockx == -1 || dblocky == -1)
 	{

+ 2 - 2
mpi/examples/user_datatype/user_datatype.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2015, 2016  CNRS
+ * Copyright (C) 2015, 2016, 2017  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,5 +109,5 @@ int main(int argc, char **argv)
 	starpu_mpi_shutdown();
 	starpu_shutdown();
 
-	if (rank == 0) return !compare; else return 0;
+	return (rank == 0) ? !compare : 0;
 }

+ 4 - 2
mpi/src/starpu_mpi.c

@@ -1889,7 +1889,8 @@ void starpu_mpi_get_data_on_node_detached(MPI_Comm comm, starpu_data_handle_t da
 	}
 
 	starpu_mpi_comm_rank(comm, &me);
-	if (node == rank) return;
+	if (node == rank)
+		return;
 
 	tag = starpu_mpi_data_get_tag(data_handle);
 	if (tag == -1)
@@ -1930,7 +1931,8 @@ void starpu_mpi_get_data_on_node(MPI_Comm comm, starpu_data_handle_t data_handle
 	}
 
 	starpu_mpi_comm_rank(comm, &me);
-	if (node == rank) return;
+	if (node == rank)
+		return;
 
 	tag = starpu_mpi_data_get_tag(data_handle);
 	if (tag == -1)

+ 28 - 14
mpi/src/starpu_mpi_cache.c

@@ -85,7 +85,8 @@ void _starpu_mpi_cache_init(MPI_Comm comm)
 
 void _starpu_mpi_cache_shutdown()
 {
-	if (_starpu_cache_enabled == 0) return;
+	if (_starpu_cache_enabled == 0)
+		return;
 
 	struct _starpu_data_entry *entry, *tmp;
 
@@ -127,7 +128,8 @@ void _starpu_mpi_cache_data_init(starpu_data_handle_t data_handle)
 	int i;
 	struct _starpu_mpi_data *mpi_data = data_handle->mpi_data;
 
-	if (_starpu_cache_enabled == 0) return;
+	if (_starpu_cache_enabled == 0)
+		return;
 
 	STARPU_PTHREAD_MUTEX_LOCK(&_cache_mutex);
 	mpi_data->cache_received = 0;
@@ -143,7 +145,8 @@ static void _starpu_mpi_cache_data_add_nolock(starpu_data_handle_t data_handle)
 {
 	struct _starpu_data_entry *entry;
 
-	if (_starpu_cache_enabled == 0) return;
+	if (_starpu_cache_enabled == 0)
+		return;
 
 	HASH_FIND_PTR(_cache_data, &data_handle, entry);
 	if (entry == NULL)
@@ -158,7 +161,8 @@ static void _starpu_mpi_cache_data_remove_nolock(starpu_data_handle_t data_handl
 {
 	struct _starpu_data_entry *entry;
 
-	if (_starpu_cache_enabled == 0) return;
+	if (_starpu_cache_enabled == 0)
+		return;
 
 	HASH_FIND_PTR(_cache_data, &data_handle, entry);
 	if (entry)
@@ -176,7 +180,8 @@ void _starpu_mpi_cache_received_data_clear(starpu_data_handle_t data_handle)
 	int mpi_rank = starpu_mpi_data_get_rank(data_handle);
 	struct _starpu_mpi_data *mpi_data = data_handle->mpi_data;
 
-	if (_starpu_cache_enabled == 0) return;
+	if (_starpu_cache_enabled == 0)
+		return;
 
 	STARPU_PTHREAD_MUTEX_LOCK(&_cache_mutex);
 	STARPU_ASSERT(mpi_data->magic == 42);
@@ -201,7 +206,8 @@ int _starpu_mpi_cache_received_data_set(starpu_data_handle_t data_handle)
 	int mpi_rank = starpu_mpi_data_get_rank(data_handle);
 	struct _starpu_mpi_data *mpi_data = data_handle->mpi_data;
 
-	if (_starpu_cache_enabled == 0) return 0;
+	if (_starpu_cache_enabled == 0)
+		return 0;
 
 	STARPU_PTHREAD_MUTEX_LOCK(&_cache_mutex);
 	STARPU_ASSERT(mpi_data->magic == 42);
@@ -228,7 +234,8 @@ int _starpu_mpi_cache_received_data_get(starpu_data_handle_t data_handle)
 	int already_received;
 	struct _starpu_mpi_data *mpi_data = data_handle->mpi_data;
 
-	if (_starpu_cache_enabled == 0) return 0;
+	if (_starpu_cache_enabled == 0)
+		return 0;
 
 	STARPU_PTHREAD_MUTEX_LOCK(&_cache_mutex);
 	STARPU_ASSERT(mpi_data->magic == 42);
@@ -250,7 +257,8 @@ void _starpu_mpi_cache_sent_data_clear(starpu_data_handle_t data_handle)
 	int n, size;
 	struct _starpu_mpi_data *mpi_data = data_handle->mpi_data;
 
-	if (_starpu_cache_enabled == 0) return;
+	if (_starpu_cache_enabled == 0)
+		return;
 
 	STARPU_PTHREAD_MUTEX_LOCK(&_cache_mutex);
 	starpu_mpi_comm_size(mpi_data->node_tag.comm, &size);
@@ -270,7 +278,8 @@ int _starpu_mpi_cache_sent_data_set(starpu_data_handle_t data_handle, int dest)
 {
 	struct _starpu_mpi_data *mpi_data = data_handle->mpi_data;
 
-	if (_starpu_cache_enabled == 0) return 0;
+	if (_starpu_cache_enabled == 0)
+		return 0;
 
 	STARPU_MPI_ASSERT_MSG(dest < _starpu_cache_comm_size, "Node %d invalid. Max node is %d\n", dest, _starpu_cache_comm_size);
 
@@ -295,7 +304,8 @@ int _starpu_mpi_cache_sent_data_get(starpu_data_handle_t data_handle, int dest)
 	struct _starpu_mpi_data *mpi_data = data_handle->mpi_data;
 	int already_sent;
 
-	if (_starpu_cache_enabled == 0) return 0;
+	if (_starpu_cache_enabled == 0)
+		return 0;
 
 	STARPU_PTHREAD_MUTEX_LOCK(&_cache_mutex);
 	STARPU_MPI_ASSERT_MSG(dest < _starpu_cache_comm_size, "Node %d invalid. Max node is %d\n", dest, _starpu_cache_comm_size);
@@ -314,7 +324,8 @@ static void _starpu_mpi_cache_flush_nolock(starpu_data_handle_t data_handle)
 	struct _starpu_mpi_data *mpi_data = data_handle->mpi_data;
 	int i, nb_nodes;
 
-	if (_starpu_cache_enabled == 0) return;
+	if (_starpu_cache_enabled == 0)
+		return;
 
 	starpu_mpi_comm_size(mpi_data->node_tag.comm, &nb_nodes);
 	for(i=0 ; i<nb_nodes ; i++)
@@ -338,7 +349,8 @@ static void _starpu_mpi_cache_flush_nolock(starpu_data_handle_t data_handle)
 
 void _starpu_mpi_cache_flush(starpu_data_handle_t data_handle)
 {
-	if (_starpu_cache_enabled == 0) return;
+	if (_starpu_cache_enabled == 0)
+		return;
 
 	STARPU_PTHREAD_MUTEX_LOCK(&_cache_mutex);
 	_starpu_mpi_cache_flush_nolock(data_handle);
@@ -359,7 +371,8 @@ static void _starpu_mpi_cache_flush_and_invalidate_nolock(MPI_Comm comm, starpu_
 
 void starpu_mpi_cache_flush(MPI_Comm comm, starpu_data_handle_t data_handle)
 {
-	if (_starpu_cache_enabled == 0) return;
+	if (_starpu_cache_enabled == 0)
+		return;
 
 	STARPU_PTHREAD_MUTEX_LOCK(&_cache_mutex);
 	_starpu_mpi_cache_flush_and_invalidate_nolock(comm, data_handle);
@@ -371,7 +384,8 @@ void starpu_mpi_cache_flush_all_data(MPI_Comm comm)
 {
 	struct _starpu_data_entry *entry, *tmp;
 
-	if (_starpu_cache_enabled == 0) return;
+	if (_starpu_cache_enabled == 0)
+		return;
 
 	STARPU_PTHREAD_MUTEX_LOCK(&_cache_mutex);
 	HASH_ITER(hh, _cache_data, entry, tmp)

+ 6 - 3
mpi/src/starpu_mpi_cache_stats.c

@@ -28,7 +28,8 @@ void _starpu_mpi_cache_stats_init()
 	{
 		stats_enabled = 0;
 	}
-	if (stats_enabled == 0) return;
+	if (stats_enabled == 0)
+		return;
 
 	_STARPU_DISP("Warning: StarPU is executed with STARPU_MPI_CACHE_STATS=1, which slows down a bit\n");
 
@@ -36,14 +37,16 @@ void _starpu_mpi_cache_stats_init()
 
 void _starpu_mpi_cache_stats_shutdown()
 {
-	if (stats_enabled == 0) return;
+	if (stats_enabled == 0)
+		return;
 }
 
 void _starpu_mpi_cache_stats_update(unsigned dst, starpu_data_handle_t data_handle, int count)
 {
 	size_t size;
 
-	if (stats_enabled == 0) return;
+	if (stats_enabled == 0)
+		return;
 
 	size = starpu_data_get_size(data_handle);
 

+ 4 - 1
mpi/src/starpu_mpi_comm.c

@@ -181,7 +181,10 @@ int _starpu_mpi_comm_test_recv(MPI_Status *status, struct _starpu_mpi_envelope *
 			}
 		}
 		i++;
-		if (i == _starpu_mpi_comm_nb) i=0;
+		if (i == _starpu_mpi_comm_nb)
+		{
+			i=0;
+		}
 		if (i == _starpu_mpi_comm_tested)
 		{
 			// We have tested all the requests, none has completed

+ 3 - 2
mpi/src/starpu_mpi_select_node.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2014, 2015, 2016  CNRS
+ * Copyright (C) 2014, 2015, 2016, 2017  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
@@ -57,7 +57,8 @@ int starpu_mpi_node_selection_register_policy(starpu_mpi_select_node_policy_func
 	// Look for a unregistered policy
 	while(i<_STARPU_MPI_NODE_SELECTION_MAX_POLICY)
 	{
-		if (_policies[i] == NULL) break;
+		if (_policies[i] == NULL)
+			break;
 		i++;
 	}
 	STARPU_ASSERT_MSG(i<_STARPU_MPI_NODE_SELECTION_MAX_POLICY, "No unused policy available. Unregister existing policies before registering a new one.");

+ 10 - 5
mpi/src/starpu_mpi_stats.c

@@ -32,7 +32,8 @@ void _starpu_mpi_comm_amounts_init(MPI_Comm comm)
 		stats_enabled = 0;
 	}
 
-	if (stats_enabled == 0) return;
+	if (stats_enabled == 0)
+		return;
 
 	_STARPU_DISP("Warning: StarPU is executed with STARPU_COMM_STATS=1, which slows down a bit\n");
 
@@ -44,7 +45,8 @@ void _starpu_mpi_comm_amounts_init(MPI_Comm comm)
 
 void _starpu_mpi_comm_amounts_shutdown()
 {
-	if (stats_enabled == 0) return;
+	if (stats_enabled == 0)
+		return;
 	free(comm_amount);
 }
 
@@ -52,7 +54,8 @@ void _starpu_mpi_comm_amounts_inc(MPI_Comm comm, unsigned dst, MPI_Datatype data
 {
 	int src, size;
 
-	if (stats_enabled == 0) return;
+	if (stats_enabled == 0)
+		return;
 
 	starpu_mpi_comm_rank(comm, &src);
 	MPI_Type_size(datatype, &size);
@@ -64,7 +67,8 @@ void _starpu_mpi_comm_amounts_inc(MPI_Comm comm, unsigned dst, MPI_Datatype data
 
 void starpu_mpi_comm_amounts_retrieve(size_t *comm_amounts)
 {
-	if (stats_enabled == 0) return;
+	if (stats_enabled == 0)
+		return;
 	memcpy(comm_amounts, comm_amount, world_size * sizeof(size_t));
 }
 
@@ -73,7 +77,8 @@ void _starpu_mpi_comm_amounts_display(FILE *stream, int node)
 	int dst;
 	size_t sum = 0;
 
-	if (stats_enabled == 0) return;
+	if (stats_enabled == 0)
+		return;
 
 	for (dst = 0; dst < world_size; dst++)
 	{

+ 11 - 5
mpi/src/starpu_mpi_task_insert.c

@@ -483,7 +483,8 @@ int _starpu_mpi_task_build_v(MPI_Comm comm, struct starpu_codelet *codelet, stru
 
 	/* Find out whether we are to execute the data because we own the data to be written to. */
 	ret = _starpu_mpi_task_decode_v(codelet, me, nb_nodes, &xrank, &do_execute, &descrs, &nb_data, &prio, varg_list);
-	if (ret < 0) return ret;
+	if (ret < 0)
+		return ret;
 
 	_STARPU_TRACE_TASK_MPI_PRE_START();
 	/* Send and receive data as requested */
@@ -503,7 +504,10 @@ int _starpu_mpi_task_build_v(MPI_Comm comm, struct starpu_codelet *codelet, stru
 
 	_STARPU_TRACE_TASK_MPI_PRE_END();
 
-	if (do_execute == 0) return 1;
+	if (do_execute == 0)
+	{
+		return 1;
+	}
 	else
 	{
 		va_list varg_list_copy;
@@ -552,7 +556,8 @@ int _starpu_mpi_task_insert_v(MPI_Comm comm, struct starpu_codelet *codelet, va_
 	int prio;
 
 	ret = _starpu_mpi_task_build_v(comm, codelet, &task, &xrank, &descrs, &nb_data, &prio, varg_list);
-	if (ret < 0) return ret;
+	if (ret < 0)
+		return ret;
 
 	if (ret == 0)
 	{
@@ -612,7 +617,7 @@ struct starpu_task *starpu_mpi_task_build(MPI_Comm comm, struct starpu_codelet *
 	ret = _starpu_mpi_task_build_v(comm, codelet, &task, NULL, NULL, NULL, NULL, varg_list);
 	va_end(varg_list);
 	STARPU_ASSERT(ret >= 0);
-	if (ret > 0) return NULL; else return task;
+	return (ret > 0) ? NULL : task;
 }
 
 int starpu_mpi_task_post_build(MPI_Comm comm, struct starpu_codelet *codelet, ...)
@@ -631,7 +636,8 @@ int starpu_mpi_task_post_build(MPI_Comm comm, struct starpu_codelet *codelet, ..
 	/* Find out whether we are to execute the data because we own the data to be written to. */
 	ret = _starpu_mpi_task_decode_v(codelet, me, nb_nodes, &xrank, &do_execute, &descrs, &nb_data, &prio, varg_list);
 	va_end(varg_list);
-	if (ret < 0) return ret;
+	if (ret < 0)
+		return ret;
 
 	return _starpu_mpi_task_postbuild_v(comm, xrank, do_execute, descrs, nb_data, prio);
 }

+ 11 - 5
mpi/src/starpu_mpi_task_insert_fortran.c

@@ -325,7 +325,8 @@ int _fstarpu_mpi_task_build_v(MPI_Comm comm, struct starpu_codelet *codelet, str
 
 	/* Find out whether we are to execute the data because we own the data to be written to. */
 	ret = _fstarpu_mpi_task_decode_v(codelet, me, nb_nodes, &xrank, &do_execute, &descrs, &nb_data, &prio, arglist);
-	if (ret < 0) return ret;
+	if (ret < 0)
+		return ret;
 
 	_STARPU_TRACE_TASK_MPI_PRE_START();
 	/* Send and receive data as requested */
@@ -344,7 +345,10 @@ int _fstarpu_mpi_task_build_v(MPI_Comm comm, struct starpu_codelet *codelet, str
 		*prio_p = prio;
 	_STARPU_TRACE_TASK_MPI_PRE_END();
 
-	if (do_execute == 0) return 1;
+	if (do_execute == 0)
+	{
+		return 1;
+	}
 	else
 	{
 		_STARPU_MPI_DEBUG(100, "Execution of the codelet %p (%s)\n", codelet, codelet?codelet->name:NULL);
@@ -369,7 +373,8 @@ int _fstarpu_mpi_task_insert_v(MPI_Comm comm, struct starpu_codelet *codelet, vo
 	int prio;
 
 	ret = _fstarpu_mpi_task_build_v(comm, codelet, &task, &xrank, &descrs, &nb_data, &prio, arglist);
-	if (ret < 0) return ret;
+	if (ret < 0)
+		return ret;
 
 	if (ret == 0)
 	{
@@ -420,7 +425,7 @@ struct starpu_task *fstarpu_mpi_task_build(MPI_Fint comm, void ***_arglist)
 
 	ret = _fstarpu_mpi_task_build_v(MPI_Comm_f2c(comm), codelet, &task, NULL, NULL, NULL, NULL, arglist+1);
 	STARPU_ASSERT(ret >= 0);
-	if (ret > 0) return NULL; else return task;
+	return (ret > 0) ? NULL : task;
 }
 
 int fstarpu_mpi_task_post_build(MPI_Fint _comm, void ***_arglist)
@@ -443,7 +448,8 @@ int fstarpu_mpi_task_post_build(MPI_Fint _comm, void ***_arglist)
 
 	/* Find out whether we are to execute the data because we own the data to be written to. */
 	ret = _fstarpu_mpi_task_decode_v(codelet, me, nb_nodes, &xrank, &do_execute, &descrs, &nb_data, &prio, arglist);
-	if (ret < 0) return ret;
+	if (ret < 0)
+		return ret;
 
 	return _starpu_mpi_task_postbuild_v(comm, xrank, do_execute, descrs, nb_data, prio);
 }

+ 2 - 1
mpi/tests/cache.c

@@ -94,7 +94,8 @@ int main(int argc, char **argv)
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_init");
 	starpu_mpi_comm_rank(MPI_COMM_WORLD, &rank);
 
-	if (starpu_mpi_cache_is_enabled() == 0) goto skip;
+	if (starpu_mpi_cache_is_enabled() == 0)
+		goto skip;
 
 	if (rank == 0)
 		starpu_variable_data_register(&data, STARPU_MAIN_RAM, (uintptr_t)&val, sizeof(unsigned));

+ 2 - 1
mpi/tests/cache_disable.c

@@ -58,7 +58,8 @@ int main(int argc, char **argv)
 	starpu_mpi_comm_rank(MPI_COMM_WORLD, &rank);
 
 	cache = starpu_mpi_cache_is_enabled();
-	if (cache == 0) goto skip;
+	if (cache == 0)
+		goto skip;
 
 	val = malloc(sizeof(*val));
 	*val = 12;

+ 11 - 6
mpi/tests/callback.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2013, 2014, 2015  CNRS
+ * Copyright (C) 2013, 2014, 2015, 2017  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
@@ -72,7 +72,8 @@ int main(int argc, char **argv)
 	int rank, size;
 
 	ret = starpu_initialize(NULL, &argc, &argv);
-	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
+	if (ret == -ENODEV)
+		return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
 	ret = starpu_mpi_init(&argc, &argv, 1);
@@ -87,7 +88,8 @@ int main(int argc, char **argv)
 				     0);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_task_insert");
 
-	if (rank == 0) expected_x ++;
+	if (rank == 0)
+		expected_x ++;
 	ret = starpu_mpi_task_insert(MPI_COMM_WORLD,
 				     NULL,
 				     STARPU_EXECUTE_ON_NODE, 0,
@@ -96,7 +98,8 @@ int main(int argc, char **argv)
 				     0);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
 
-	if (rank == 0) expected_x ++;
+	if (rank == 0)
+		expected_x ++;
 	STARPU_ASSERT_MSG(x == expected_x, "x should be equal to %d and not %d\n", expected_x, x);
 
 	ret = starpu_mpi_task_insert(MPI_COMM_WORLD,
@@ -107,7 +110,8 @@ int main(int argc, char **argv)
 				     0);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
 
-	if (rank == 0) expected_y ++;
+	if (rank == 0)
+		expected_y ++;
 	ret = starpu_mpi_task_insert(MPI_COMM_WORLD,
 				     &my_codelet,
 				     STARPU_EXECUTE_ON_NODE, 0,
@@ -117,7 +121,8 @@ int main(int argc, char **argv)
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
 
 	starpu_task_wait_for_all();
-	if (rank == 0) expected_y ++;
+	if (rank == 0)
+		expected_y ++;
 	STARPU_ASSERT_MSG(y == expected_y, "y should be equal to %d and not %d\n", expected_y, y);
 
 	starpu_mpi_shutdown();

+ 4 - 2
mpi/tests/insert_task_compute.c

@@ -125,7 +125,8 @@ int test(int rank, int node, int *before, int *after, int task_insert, int data_
 			if (task)
 			{
 				ret = starpu_task_submit(task);
-				if (ret == -ENODEV) goto enodev;
+				if (ret == -ENODEV)
+					goto enodev;
 				STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_submit");
 			}
 
@@ -239,7 +240,8 @@ int main(int argc, char **argv)
 			for(data_array=0 ; data_array<=2 ; data_array++)
 			{
 				ret = test(rank, node, before, after_node[node], insert_task, data_array);
-				if (ret == -ENODEV || ret) global_ret = ret;
+				if (ret == -ENODEV || ret)
+					global_ret = ret;
 			}
 		}
 	}

+ 6 - 3
mpi/tests/insert_task_dyn_handles.c

@@ -103,7 +103,8 @@ int main(int argc, char **argv)
 		descrs[i].handle = data_handles[i];
 		descrs[i].mode = STARPU_RW;
 	}
-	if (rank == 1) factor=FFACTOR;
+	if (rank == 1)
+		factor=FFACTOR;
 	starpu_variable_data_register(&factor_handle, STARPU_MAIN_RAM, (uintptr_t)&factor, sizeof(factor));
 	starpu_mpi_data_register(factor_handle, FFACTOR, 1);
 
@@ -113,14 +114,16 @@ int main(int argc, char **argv)
 					     STARPU_DATA_MODE_ARRAY, descrs, STARPU_NMAXBUFS-1,
 					     STARPU_R, factor_handle,
 					     0);
-		if (ret == -ENODEV) goto enodev;
+		if (ret == -ENODEV)
+			goto enodev;
 		STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_task_insert");
 
 		ret = starpu_mpi_task_insert(MPI_COMM_WORLD, &codelet,
 					     STARPU_DATA_MODE_ARRAY, descrs, STARPU_NMAXBUFS+15,
 					     STARPU_R, factor_handle,
 					     0);
-		if (ret == -ENODEV) goto enodev;
+		if (ret == -ENODEV)
+			goto enodev;
 		STARPU_CHECK_RETURN_VALUE(ret, "starpu_mpi_task_insert");
 	}
 

+ 2 - 1
mpi/tests/insert_task_node_choice.c

@@ -65,7 +65,8 @@ int main(int argc, char **argv)
 	starpu_mpi_comm_rank(MPI_COMM_WORLD, &rank);
 	starpu_mpi_comm_size(MPI_COMM_WORLD, &size);
 
-	if (rank != 0 && rank != 1) goto end;
+	if (rank != 0 && rank != 1)
+		goto end;
 
 	if (rank == 0)
 	{

+ 2 - 1
mpi/tests/insert_task_owner.c

@@ -105,7 +105,8 @@ int main(int argc, char **argv)
 		return STARPU_TEST_SKIPPED;
 	}
 
-	if (rank != 0 && rank != 1) goto end;
+	if (rank != 0 && rank != 1)
+		goto end;
 
 	if (rank == 0)
 	{

+ 12 - 6
mpi/tests/mpi_earlyrecv2.c

@@ -230,22 +230,28 @@ int main(int argc, char **argv)
 	}
 
 	ret = exchange_variable(rank, 0);
-	if (ret != 0) global_ret = ret;
+	if (ret != 0)
+		global_ret = ret;
 
 	ret = exchange_variable(rank, 1);
-	if (ret != 0) global_ret = ret;
+	if (ret != 0)
+		global_ret = ret;
 
 	ret = exchange_void(rank, 0);
-	if (ret != 0) global_ret = ret;
+	if (ret != 0)
+		global_ret = ret;
 
 	ret = exchange_void(rank, 1);
-	if (ret != 0) global_ret = ret;
+	if (ret != 0)
+		global_ret = ret;
 
 	ret = exchange_complex(rank, 0);
-	if (ret != 0) global_ret = ret;
+	if (ret != 0)
+		global_ret = ret;
 
 	ret = exchange_complex(rank, 1);
-	if (ret != 0) global_ret = ret;
+	if (ret != 0)
+		global_ret = ret;
 
 	starpu_mpi_shutdown();
 	starpu_shutdown();

+ 6 - 3
mpi/tests/mpi_earlyrecv2_sync.c

@@ -223,13 +223,16 @@ int main(int argc, char **argv)
 	}
 
 	ret = exchange_variable(rank);
-	if (ret != 0) global_ret = ret;
+	if (ret != 0)
+		global_ret = ret;
 
 	ret = exchange_void(rank);
-	if (ret != 0) global_ret = ret;
+	if (ret != 0)
+		global_ret = ret;
 
 	ret = exchange_complex(rank);
-	if (ret != 0) global_ret = ret;
+	if (ret != 0)
+		global_ret = ret;
 
 	MPI_Finalize();
 

+ 2 - 1
mpi/tests/mpi_reduction.c

@@ -191,7 +191,8 @@ int main(int argc, char **argv)
 
 	for(x = 0; x < nb_elements; x+=step)
 	{
-		if (handles[x]) starpu_data_unregister(handles[x]);
+		if (handles[x])
+			starpu_data_unregister(handles[x]);
 	}
 	starpu_data_unregister(dot_handle);
 	free(vector);

+ 2 - 1
mpi/tests/temporary.c

@@ -74,7 +74,8 @@ int main(int argc, char **argv)
 		return STARPU_TEST_SKIPPED;
 	}
 
-	if (starpu_mpi_cache_is_enabled() == 0) goto skip;
+	if (starpu_mpi_cache_is_enabled() == 0)
+		goto skip;
 
 	if (rank == 0)
 	{

+ 2 - 2
mpi/tests/user_defined_datatype.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, 2017  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
@@ -175,5 +175,5 @@ int main(int argc, char **argv)
 	starpu_mpi_shutdown();
 	starpu_shutdown();
 
-	if (rank == 0) return !compare; else return ret;
+	return (rank == 0) ? !compare : ret;
 }

+ 5 - 2
src/core/perfmodel/perfmodel_history.c

@@ -1907,8 +1907,11 @@ int starpu_perfmodel_list_combs(FILE *output, struct starpu_perfmodel *model)
 struct starpu_perfmodel_per_arch *starpu_perfmodel_get_model_per_arch(struct starpu_perfmodel *model, struct starpu_perfmodel_arch *arch, unsigned impl)
 {
 	int comb = starpu_perfmodel_arch_comb_get(arch->ndevices, arch->devices);
-	if(comb == -1) return NULL;
-	if(!model->state->per_arch[comb]) return NULL;
+	if (comb == -1)
+		return NULL;
+
+	if (!model->state->per_arch[comb])
+		return NULL;
 
 	return &model->state->per_arch[comb][impl];
 }

+ 15 - 11
src/core/sched_ctx.c

@@ -54,7 +54,7 @@ static void set_priority_hierarchically_on_notified_workers(int* workers_to_add,
 static void fetch_tasks_from_empty_ctx_list(struct _starpu_sched_ctx *sched_ctx);
 static void add_notified_workers(int *workers_to_add, int nworkers_to_add, unsigned sched_ctx_id);
 
-/* notify workers that a ctx change operation is about to proceed. 
+/* notify workers that a ctx change operation is about to proceed.
  *
  * Once this function returns, the notified workers must not start a new
  * scheduling operation until they are notified that the ctx change op is
@@ -603,7 +603,7 @@ struct _starpu_sched_ctx* _starpu_create_sched_ctx(struct starpu_sched_policy *p
 			sched_ctx->sub_ctxs[i] = sub_ctxs[i];
 		sched_ctx->nsub_ctxs = nsub_ctxs;
 	}
-	
+
 	_starpu_add_workers_to_new_sched_ctx(sched_ctx, workerids, nworkers_ctx);
 
 #ifdef STARPU_HAVE_HWLOC
@@ -658,7 +658,7 @@ int starpu_sched_ctx_get_stream_worker(unsigned sub_ctx)
 
 	struct starpu_sched_ctx_iterator it;
 	int worker = -1;
-	
+
 	workers->init_iterator(workers, &it);
 	if(workers->has_next(workers, &it))
 	{
@@ -852,14 +852,14 @@ int fstarpu_sched_ctx_create(int *workerids, int nworkers, const char *sched_ctx
 		else if (arg_type == STARPU_SCHED_CTX_SUB_CTXS)
 		{
 			arg_i++;
-			sub_ctxs = (int*)arglist[arg_i]; 
+			sub_ctxs = (int*)arglist[arg_i];
 			arg_i++;
-			nsub_ctxs = *(int*)arglist[arg_i]; 
+			nsub_ctxs = *(int*)arglist[arg_i];
 		}
 		else if (arg_type == STARPU_SCHED_CTX_CUDA_NSMS)
 		{
 			arg_i++;
-			nsms = *(int*)arglist[arg_i]; 
+			nsms = *(int*)arglist[arg_i];
 		}
 
 		else
@@ -1070,7 +1070,8 @@ static void fetch_tasks_from_empty_ctx_list(struct _starpu_sched_ctx *sched_ctx)
 
 		int ret =  _starpu_push_task_to_workers(old_task);
 		/* if we should stop poping from empty ctx tasks */
-		if(ret == -EAGAIN) break;
+		if (ret == -EAGAIN)
+			break;
 	}
 }
 
@@ -1078,7 +1079,8 @@ unsigned _starpu_can_push_task(struct _starpu_sched_ctx *sched_ctx, struct starp
 {
 	if(sched_ctx->sched_policy && sched_ctx->sched_policy->simulate_push_task)
 	{
-		if (window_size == 0.0) return 1;
+		if (window_size == 0.0)
+			return 1;
 
 		_starpu_sched_ctx_lock_read(sched_ctx->id);
 		double expected_end = sched_ctx->sched_policy->simulate_push_task(task);
@@ -1086,7 +1088,9 @@ unsigned _starpu_can_push_task(struct _starpu_sched_ctx *sched_ctx, struct starp
 
 		double expected_len = 0.0;
 		if(hyp_actual_start_sample[sched_ctx->id] != 0.0)
+		{
 			expected_len = expected_end - hyp_actual_start_sample[sched_ctx->id] ;
+		}
 		else
 		{
 			_STARPU_MSG("%u: sc start is 0.0\n", sched_ctx->id);
@@ -2184,7 +2188,7 @@ void starpu_sched_ctx_move_task_to_ctx_locked(struct starpu_task *task, unsigned
 }
 
 #if 0
-void starpu_sched_ctx_move_task_to_ctx(struct starpu_task *task, unsigned sched_ctx, unsigned manage_mutex, 
+void starpu_sched_ctx_move_task_to_ctx(struct starpu_task *task, unsigned sched_ctx, unsigned manage_mutex,
 				       unsigned with_repush)
 {
 	/* TODO: make something cleaner which differentiates between calls
@@ -2624,13 +2628,13 @@ void _starpu_worker_apply_deferred_ctx_changes(void)
 		{
 			notify_workers_about_changing_ctx_done(chg->nworkers_to_change, chg->workerids_to_change);
 		}
-		
+
 		_starpu_sched_ctx_unlock_write(chg->sched_ctx_id);
 		free(chg->workerids_to_notify);
 		free(chg->workerids_to_change);
 		_starpu_ctx_change_delete(chg);
 	}
-	
+
 
 }
 

+ 8 - 4
src/core/workers.c

@@ -340,9 +340,11 @@ int starpu_worker_can_execute_task_impl(unsigned workerid, struct starpu_task *t
 	struct starpu_codelet *cl;
 	/* TODO: check that the task operand sizes will fit on that device */
 	cl = task->cl;
-	if (!(task->where & _starpu_config.workers[workerid].worker_mask)) return 0;
+	if (!(task->where & _starpu_config.workers[workerid].worker_mask))
+		return 0;
 
-	if (task->workerids_len) {
+	if (task->workerids_len)
+	{
 		size_t div = sizeof(*task->workerids) * 8;
 		if (workerid / div >= task->workerids_len || ! (task->workerids[workerid / div] & (1UL << workerid % div)))
 			return 0;
@@ -387,7 +389,8 @@ int starpu_worker_can_execute_task_first_impl(unsigned workerid, struct starpu_t
 	struct starpu_codelet *cl;
 	/* TODO: check that the task operand sizes will fit on that device */
 	cl = task->cl;
-	if (!(task->where & _starpu_config.workers[workerid].worker_mask)) return 0;
+	if (!(task->where & _starpu_config.workers[workerid].worker_mask))
+		return 0;
 
 	arch = _starpu_config.workers[workerid].arch;
 	if (!task->cl->can_execute)
@@ -2246,7 +2249,8 @@ int starpu_worker_get_nids_ctx_free_by_type(enum starpu_worker_archtype type, in
 						}
 					}
 
-					if(found) break;
+					if(found)
+						break;
 				}
 			}
 			if(!found)

+ 5 - 6
src/core/workers.h

@@ -548,12 +548,11 @@ static inline struct _starpu_worker *_starpu_get_worker_struct(unsigned id)
 	return &_starpu_config.workers[id];
 }
 
-/* Returns the starpu_sched_ctx structure that describes the state of the 
+/* Returns the starpu_sched_ctx structure that describes the state of the
  * specified ctx */
 static inline struct _starpu_sched_ctx *_starpu_get_sched_ctx_struct(unsigned id)
 {
-	if(id > STARPU_NMAX_SCHED_CTXS) return NULL;
-	return &_starpu_config.sched_ctxs[id];
+	return (id > STARPU_NMAX_SCHED_CTXS) ? NULL : &_starpu_config.sched_ctxs[id];
 }
 
 struct _starpu_combined_worker *_starpu_get_combined_worker_struct(unsigned id);
@@ -592,7 +591,7 @@ static inline struct _starpu_sched_ctx* _starpu_get_initial_sched_ctx(void)
 
 int starpu_worker_get_nids_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize);
 
-/* returns workers not belonging to any context, be careful no mutex is used, 
+/* returns workers not belonging to any context, be careful no mutex is used,
    the list might not be updated */
 int starpu_worker_get_nids_ctx_free_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize);
 
@@ -762,7 +761,7 @@ static inline void _starpu_worker_process_block_in_parallel_requests(struct _sta
 		STARPU_ASSERT(!worker->state_unblock_in_parallel_req);
 		STARPU_ASSERT(!worker->state_unblock_in_parallel_ack);
 		STARPU_ASSERT(worker->block_in_parallel_ref_count > 0);
-		
+
 		/* enter effective blocked state */
 		worker->state_blocked_in_parallel = 1;
 
@@ -1072,7 +1071,7 @@ static inline int _starpu_worker_get_relax_state(void)
 	return worker->state_relax_refcnt != 0;
 }
 
-/* lock a worker for observing contents 
+/* lock a worker for observing contents
  *
  * notes:
  * - if the observed worker is not in state_relax_refcnt, the function block until the state is reached */