浏览代码

Make sure we do not include sys/time.h, but include starpu_util instead, which Does The Right Thing.

Samuel Thibault 11 年之前
父节点
当前提交
69cb5ea77b

+ 10 - 1
Makefile.am

@@ -1,6 +1,6 @@
 # StarPU --- Runtime system for heterogeneous multicore architectures.
 #
-# Copyright (C) 2009-2013  Université de Bordeaux 1
+# Copyright (C) 2009-2014  Université de Bordeaux 1
 # Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
 #
 # StarPU is free software; you can redistribute it and/or modify
@@ -127,6 +127,15 @@ EXTRA_DIST = AUTHORS COPYING.LGPL README STARPU-VERSION STARPU-REVISION build-au
 
 DISTCLEANFILES = STARPU-REVISION
 
+if STARPU_DEVEL
+all-local:
+	if grep -r sys/time.h $$( find $(srcdir)/src $(srcdir)/mpi/src $(srcdir)/include -name \*.[ch] -a \! -name starpu_util.h ) ; \
+	then \
+		echo "Please do not include sys/time, it is not available on Windows, include starpu_util.h and use starpu_timing_now() instead" ; \
+		false ; \
+	fi
+endif
+
 include starpu-top/extradist
 
 showcheck:

+ 1 - 0
configure.ac

@@ -1947,6 +1947,7 @@ if test "x$STARPU_DEVEL" != x; then
 	IS_SUPPORTED_CFLAG(-Wundef)
 	IS_SUPPORTED_CFLAG(-Wshadow)
 fi
+AM_CONDITIONAL([STARPU_DEVEL],[test "x$STARPU_DEVEL" != x])
 
 AC_SUBST(GLOBAL_AM_CFLAGS)
 

+ 1 - 1
include/starpu_profiling.h

@@ -21,7 +21,7 @@
 #include <starpu.h>
 #include <errno.h>
 #include <time.h>
-#include <sys/time.h>
+#include <starpu_util.h>
 
 #ifdef __cplusplus
 extern "C"

+ 14 - 0
include/starpu_util.h

@@ -273,6 +273,20 @@ int starpu_data_cpy(starpu_data_handle_t dst_handle, starpu_data_handle_t src_ha
 
 double starpu_timing_now(void);
 
+#ifdef _WIN32
+#ifndef _TIMESPEC_DEFINED
+#ifndef STARPU_TIMESPEC_DEFINED
+#define STARPU_TIMESPEC_DEFINED 1
+struct timespec {
+  time_t  tv_sec;  /* Seconds */
+  long    tv_nsec; /* Nanoseconds */
+};
+#endif /* STARPU_TIMESPEC_DEFINED */
+#endif
+#else
+#include <sys/time.h>
+#endif /* _WIN32 */
+
 #ifdef __cplusplus
 }
 #endif

+ 1 - 1
src/common/timing.c

@@ -15,9 +15,9 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 
-#include <sys/time.h>
 #include <starpu.h>
 #include <common/config.h>
+#include <starpu_util.h>
 #include <profiling/profiling.h>
 #include <common/timing.h>
 #include <math.h>

+ 2 - 2
src/common/timing.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009, 2010  Université de Bordeaux 1
+ * Copyright (C) 2009, 2010, 2014  Université de Bordeaux 1
  * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -23,11 +23,11 @@
  * functions.
  */
 
-#include <sys/time.h>
 #include <unistd.h>
 #include <stdint.h>
 #include <common/config.h>
 #include <starpu.h>
+#include <starpu_util.h>
 
 void _starpu_timing_init(void);
 void _starpu_clock_gettime(struct timespec *ts);

+ 1 - 1
src/drivers/driver_common/driver_common.h

@@ -18,8 +18,8 @@
 #ifndef __DRIVER_COMMON_H__
 #define __DRIVER_COMMON_H__
 
-#include <sys/time.h>
 #include <starpu.h>
+#include <starpu_util.h>
 #include <core/jobs.h>
 #include <common/utils.h>
 

+ 2 - 2
src/profiling/profiling.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2012  Université de Bordeaux 1
+ * Copyright (C) 2010-2012, 2014  Université de Bordeaux 1
  * Copyright (C) 2010, 2011, 2013  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -18,9 +18,9 @@
 #ifndef __PROFILING_H__
 #define __PROFILING_H__
 
-#include <sys/time.h>
 #include <starpu.h>
 #include <starpu_profiling.h>
+#include <starpu_util.h>
 #include <common/config.h>
 
 /* Create a task profiling info structure (with the proper time stamps) in case