Browse Source

fixes for minor bugs detected by cppcheck

Nathalie Furmento 8 years ago
parent
commit
f7da831dad
3 changed files with 11 additions and 10 deletions
  1. 7 5
      mpi/src/starpu_mpi_comm.c
  2. 0 1
      src/profiling/profiling_helpers.c
  3. 4 4
      tools/cppcheck/suppressions.txt

+ 7 - 5
mpi/src/starpu_mpi_comm.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016  CNRS
+ * Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017  CNRS
  * Copyright (C) 2011-2016  Université de Bordeaux
  * Copyright (C) 2014 INRIA
  *
@@ -121,7 +121,7 @@ void _starpu_mpi_comm_register(MPI_Comm comm)
 		starpu_pthread_queue_init(&_comm->queue);
 		starpu_pthread_queue_register(&wait, &_comm->queue);
 		_comm->done = 0;
-#endif	
+#endif
 	}
 	STARPU_PTHREAD_MUTEX_UNLOCK(&_starpu_mpi_comms_mutex);
 }
@@ -203,11 +203,13 @@ void _starpu_mpi_comm_cancel_recv()
 		struct _starpu_mpi_comm *_comm = _starpu_mpi_comms[i]; // get the ith _comm;
 		if (_comm->posted == 1)
 		{
-			MPI_Status status;
 			MPI_Cancel(&_comm->request);
 #ifndef STARPU_SIMGRID
-			MPI_Wait(&_comm->request, &status);
-#endif			
+			{
+				MPI_Status status;
+				MPI_Wait(&_comm->request, &status);
+			}
+#endif
 			_comm->posted = 0;
 		}
 	}

+ 0 - 1
src/profiling/profiling_helpers.c

@@ -33,7 +33,6 @@ static double convert_to_byte_units(float d, unsigned max_unit, unsigned *unit)
 
 void _starpu_profiling_bus_helper_display_summary(FILE *stream)
 {
-	const char *stats;
 	int long long sum_transferred = 0;
 	const char *byte_units[] = { "B", "KB", "MB", "GB", "TB" };
 	unsigned max_unit = sizeof(byte_units) / sizeof(byte_units[0]);

+ 4 - 4
tools/cppcheck/suppressions.txt

@@ -28,8 +28,8 @@ unusedPrivateFunction:tests/main/combined_workers/bfs/timer.h:45
 redundantAssignment:tests/main/driver_api/init_run_deinit.c
 redundantAssignment:tests/main/driver_api/run_driver.c
 
-uselessAssignmentPtrArg:mpi/src/starpu_mpi.c:155
-unreadVariable:mpi/src/starpu_mpi.c:849
+uselessAssignmentPtrArg:mpi/src/starpu_mpi.c:171
+unreadVariable:mpi/src/starpu_mpi.c:945
 redundantAssignment:src/core/workers.c
 
 invalidPointerCast:src/core/perfmodel/perfmodel_nan.c:74
@@ -42,20 +42,20 @@ unusedStructMember:src/core/perfmodel/perfmodel_bus.c:65
 unusedStructMember:src/core/perfmodel/perfmodel_bus.c:66
 unusedStructMember:src/core/simgrid.c:225
 unusedStructMember:src/core/simgrid.c:226
+wrongPrintfScanfArgNum:src/core/simgrid.c:719
 duplicateExpression:src/util/starpu_task_insert.c:52
 
 // TODO: this could be an error?
 redundantCopy:src/core/disk_ops/disk_leveldb.cpp:192
 
 nullPointerRedundantCheck:src/common/rbtree.c
-wrongPrintfScanfArgNum:src/core/simgrid.c:715
 unreadVariable:src/datawizard/interfaces/*
 unreadVariable:src/drivers/driver_common/driver_common.c:482
 clarifyCondition:src/drivers/opencl/driver_opencl.c:936
 unreadVariable:src/drivers/opencl/driver_opencl.c:767
 clarifyCondition:src/drivers/cuda/driver_cuda.c:506
 arithOperationsOnVoidPointer:src/drivers/scc/*
-nullPointerRedundantCheck:src/sched_policies/deque_modeling_policy_data_aware.c:197
+nullPointerRedundantCheck:src/sched_policies/deque_modeling_policy_data_aware.c:196
 sizeofDereferencedVoidPointer:src/util/fstarpu.c
 
 allocaCalled:gcc-plugin/src/*