瀏覽代碼

include: define portable __starpu_inline

Nathalie Furmento 12 年之前
父節點
當前提交
1fe30de34b
共有 4 個文件被更改,包括 21 次插入15 次删除
  1. 6 0
      include/starpu_config.h.in
  2. 1 1
      include/starpu_opencl.h
  3. 10 10
      include/starpu_profiling.h
  4. 4 4
      include/starpu_util.h

+ 6 - 0
include/starpu_config.h.in

@@ -89,6 +89,12 @@ typedef ssize_t starpu_ssize_t;
 #define __starpu_func__ __func__
 #endif
 
+#ifdef STARPU_HAVE_WINDOWS
+#define __starpu_inline __inline
+#else
+#define __starpu_inline inline
+#endif
+
 #undef STARPU_QUICK_CHECK
 #undef STARPU_USE_DRAND48
 #undef STARPU_USE_ERAND48_R

+ 1 - 1
include/starpu_opencl.h

@@ -37,7 +37,7 @@ void starpu_opencl_display_error(const char *func, const char *file, int line, c
 #define STARPU_OPENCL_DISPLAY_ERROR(status) \
 	starpu_opencl_display_error(__starpu_func__, __FILE__, __LINE__, NULL, status)
 
-static inline void starpu_opencl_report_error(const char *func, const char *file, int line, const char *msg, cl_int status)
+static __starpu_inline void starpu_opencl_report_error(const char *func, const char *file, int line, const char *msg, cl_int status)
 {
 	starpu_opencl_display_error(func, file, line, msg, status);
 	assert(0);

+ 10 - 10
include/starpu_profiling.h

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2013  Université de Bordeaux 1
- * Copyright (C) 2010, 2011  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2013  Centre National de la Recherche Scientifique
  *
  * 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
@@ -125,16 +125,16 @@ int starpu_bus_get_profiling_info(int busid, struct starpu_bus_profiling_info *b
 
 /* Some helper functions to manipulate profiling API output */
 /* Reset timespec */
-static inline void starpu_timespec_clear(struct timespec *tsp)
+static __starpu_inline void starpu_timespec_clear(struct timespec *tsp)
 {
 	tsp->tv_sec = 0;
 	tsp->tv_nsec = 0;
 }
 
 /* Computes result = a + b */
-static inline void starpu_timespec_add(struct timespec *a,
-					struct timespec *b,
-					struct timespec *result)
+static __starpu_inline void starpu_timespec_add(struct timespec *a,
+						struct timespec *b,
+						struct timespec *result)
 {
 	result->tv_sec = a->tv_sec + b->tv_sec;
 	result->tv_nsec = a->tv_nsec + b->tv_nsec;
@@ -147,8 +147,8 @@ static inline void starpu_timespec_add(struct timespec *a,
 }
 
 /* Computes res += b */
-static inline void starpu_timespec_accumulate(struct timespec *result,
-						struct timespec *a)
+static __starpu_inline void starpu_timespec_accumulate(struct timespec *result,
+						       struct timespec *a)
 {
 	result->tv_sec += a->tv_sec;
 	result->tv_nsec += a->tv_nsec;
@@ -161,9 +161,9 @@ static inline void starpu_timespec_accumulate(struct timespec *result,
 }
 
 /* Computes result = a - b */
-static inline void starpu_timespec_sub(const struct timespec *a,
-					const struct timespec *b,
-					struct timespec *result)
+static __starpu_inline void starpu_timespec_sub(const struct timespec *a,
+						const struct timespec *b,
+						struct timespec *result)
 {
 	result->tv_sec = a->tv_sec - b->tv_sec;
 	result->tv_nsec = a->tv_nsec - b->tv_nsec;

+ 4 - 4
include/starpu_util.h

@@ -106,12 +106,12 @@ extern "C"
 
 #if defined(__i386__) || defined(__x86_64__)
 
-static __inline unsigned starpu_cmpxchg(unsigned *ptr, unsigned old, unsigned next)
+static __starpu_inline unsigned starpu_cmpxchg(unsigned *ptr, unsigned old, unsigned next)
 {
 	__asm__ __volatile__("lock cmpxchgl %2,%1": "+a" (old), "+m" (*ptr) : "q" (next) : "memory");
 	return old;
 }
-static __inline unsigned starpu_xchg(unsigned *ptr, unsigned next)
+static __starpu_inline unsigned starpu_xchg(unsigned *ptr, unsigned next)
 {
 	/* Note: xchg is always locked already */
 	__asm__ __volatile__("xchgl %1,%0": "+m" (*ptr), "+q" (next) : : "memory");
@@ -121,7 +121,7 @@ static __inline unsigned starpu_xchg(unsigned *ptr, unsigned next)
 #endif
 
 #define STARPU_ATOMIC_SOMETHING(name,expr) \
-static __inline unsigned starpu_atomic_##name(unsigned *ptr, unsigned value) \
+static __starpu_inline unsigned starpu_atomic_##name(unsigned *ptr, unsigned value) \
 { \
 	unsigned old, next; \
 	while (1) \
@@ -207,7 +207,7 @@ extern "C"
 {
 #endif
 
-static __inline int starpu_get_env_number(const char *str)
+static __starpu_inline int starpu_get_env_number(const char *str)
 {
 	char *strval;