浏览代码

tools: fixes for minor warning detected by cppcheck

Nathalie Furmento 8 年之前
父节点
当前提交
c24911ca84
共有 3 个文件被更改,包括 9 次插入6 次删除
  1. 5 3
      tools/starpu_fxt_stats.c
  2. 3 2
      tools/starpu_lp2paje.c
  3. 1 1
      tools/starpu_machine_display.c

+ 5 - 3
tools/starpu_fxt_stats.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2011, 2012, 2013, 2014  CNRS
+ * Copyright (C) 2011, 2012, 2013, 2014, 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
@@ -193,12 +193,14 @@ int main(int argc, char **argv)
 		{
 			if (transfers[src][dst] != 0)
 			{
-				fprintf(fd_out, "%d -> %d \t %ld MB\n", src, dst, transfers[src][dst]/(1024*1024));
+				fprintf(fd_out, "%u -> %u \t %lu MB\n", src, dst, transfers[src][dst]/(1024*1024));
 			}
 		}
 	}
 
-	fprintf(fd_out, "There was %d tasks and %d work stealing\n", njob, nws);
+	fprintf(fd_out, "There was %u tasks and %u work stealing\n", njob, nws);
+	if (fd_out != stdout)
+		fclose(fd_out);
 
 	return 0;
 }

+ 3 - 2
tools/starpu_lp2paje.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2011, 2013-2014  Université de Bordeaux
- * 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
@@ -35,7 +35,7 @@ int main(int argc, char *argv[])
 {
 	int nw, nt;
 	double tmax;
-	int i, w, ww, t, tt, t2;
+	int i, w, ww, t, tt;
 	int foo;
 	double bar;
 
@@ -142,6 +142,7 @@ int main(int argc, char *argv[])
 
 		for (t = 0; t < nt; t++)
 		{
+			int t2;
 			for (t2 = 0; t2 < nt; t2++)
 			{
 				if (t != t2 && task[t].worker == task[t2].worker)

+ 1 - 1
tools/starpu_machine_display.c

@@ -178,7 +178,7 @@ int main(int argc, char **argv)
 	display_worker_names(STARPU_OPENCL_WORKER);
 
 #ifdef STARPU_USE_MIC
-	fprintf(stdout, "\t%d MIC cores (from %d devices)\n", nmiccores, nmicdevs);
+	fprintf(stdout, "\t%u MIC cores (from %u devices)\n", nmiccores, nmicdevs);
 	display_worker_names(STARPU_MIC_WORKER);
 #endif