summaryrefslogtreecommitdiffstats
path: root/src/gallium/include/pipe/p_compiler.h
diff options
context:
space:
mode:
authorThomas Balling Sørensen <tball@tball-laptop.(none)>2010-10-05 12:04:08 +0200
committerThomas Balling Sørensen <tball@tball-laptop.(none)>2010-10-05 12:04:08 +0200
commit1218430e1200a08cd64b6555d3fd1fd0274ad9e5 (patch)
treee060fb27b8388a4bd237ca39fc20f1675c5e367c /src/gallium/include/pipe/p_compiler.h
parent63b1525cf0a50e3d31328c3b56355a86056e4c05 (diff)
parentbf21b7006c63c3dc47045c22d4f372dfe6c7ce67 (diff)
Merge branch 'master' into pipe-video
Conflicts: configs/linux-dri configure.ac src/gallium/drivers/nvfx/Makefile src/gallium/include/pipe/p_defines.h src/gallium/include/pipe/p_screen.h src/gallium/include/state_tracker/dri1_api.h src/gallium/include/state_tracker/drm_api.h src/gallium/tests/python/samples/tri.py src/gallium/tests/trivial/Makefile src/gallium/tests/unit/Makefile src/gallium/tests/unit/SConscript src/gallium/tests/unit/u_format_test.c src/gallium/winsys/nouveau/drm/nouveau_drm_api.c
Diffstat (limited to 'src/gallium/include/pipe/p_compiler.h')
-rw-r--r--src/gallium/include/pipe/p_compiler.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index 9b31555f1b1..50205995911 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -35,6 +35,7 @@
#include <string.h>
#include <stddef.h>
#include <stdarg.h>
+#include <limits.h>
#if defined(_WIN32) && !defined(__WIN32__)
@@ -60,6 +61,11 @@
#include <stdbool.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
#if !defined(__HAIKU__) && !defined(__USE_MISC)
typedef unsigned int uint;
typedef unsigned short ushort;
@@ -74,6 +80,14 @@ typedef unsigned char boolean;
#define FALSE false
#endif
+#ifndef va_copy
+#ifdef __va_copy
+#define va_copy(dest, src) __va_copy((dest), (src))
+#else
+#define va_copy(dest, src) (dest) = (src)
+#endif
+#endif
+
/* Function inlining */
#ifndef INLINE
# ifdef __cplusplus
@@ -97,11 +111,23 @@ typedef unsigned char boolean;
# endif
#endif
+/* Forced function inlining */
+#ifndef ALWAYS_INLINE
+# ifdef __GNUC__
+# define ALWAYS_INLINE inline __attribute__((always_inline))
+# elif defined(_MSC_VER)
+# define ALWAYS_INLINE __forceinline
+# else
+# define ALWAYS_INLINE INLINE
+# endif
+#endif
/* Function visibility */
#ifndef PUBLIC
# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
# define PUBLIC __attribute__((visibility("default")))
+# elif defined(_MSC_VER)
+# define PUBLIC __declspec(dllexport)
# else
# define PUBLIC
# endif
@@ -182,6 +208,25 @@ typedef unsigned char boolean;
#endif
+
+#if defined(__GNUC__)
+
+#define PIPE_READ_WRITE_BARRIER() __asm__("":::"memory")
+
+#elif defined(_MSC_VER)
+
+void _ReadWriteBarrier(void);
+#pragma intrinsic(_ReadWriteBarrier)
+#define PIPE_READ_WRITE_BARRIER() _ReadWriteBarrier()
+
+#else
+
+#warning "Unsupported compiler"
+#define PIPE_READ_WRITE_BARRIER() /* */
+
+#endif
+
+
/* You should use these macros to mark if blocks where the if condition
* is either likely to be true, or unlikely to be true.
*
@@ -222,4 +267,10 @@ typedef unsigned char boolean;
#define unlikely(x) !!(x)
#endif
+
+#if defined(__cplusplus)
+}
+#endif
+
+
#endif /* P_COMPILER_H */