summaryrefslogtreecommitdiff
path: root/src/mapi/mapi/u_compiler.h
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-04-23 16:06:26 +0800
committerChia-I Wu <olv@lunarg.com>2010-05-07 10:41:11 +0800
commita73c6540d9a7f6e26d8568ba2fc522cb865f0a6c (patch)
treeedeb695b6ed24d3cb0016fbabadea48931de779f /src/mapi/mapi/u_compiler.h
parent296adbd545b8efd38c9ed508166b2de2764a444b (diff)
mapi: Add mapi and share the code with glapi.
Specifically, move all or most of glapi/glapi.c to mapi/u_current.c, glapi/glapi_execmem.c to mapi/u_execmem.c, glapi/glthread.[ch] to mapi/u_thread.[ch] and remove their dependencies on core Mesa headers.
Diffstat (limited to 'src/mapi/mapi/u_compiler.h')
-rw-r--r--src/mapi/mapi/u_compiler.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/mapi/mapi/u_compiler.h b/src/mapi/mapi/u_compiler.h
new file mode 100644
index 0000000000..cc9e2cd1e8
--- /dev/null
+++ b/src/mapi/mapi/u_compiler.h
@@ -0,0 +1,48 @@
+#ifndef _U_COMPILER_H_
+#define _U_COMPILER_H_
+
+/* Function inlining */
+#ifndef INLINE
+# ifdef __cplusplus
+# define INLINE inline
+# elif defined(__GNUC__)
+# define INLINE __inline__
+# elif defined(_MSC_VER)
+# define INLINE __inline
+# elif defined(__ICL)
+# define INLINE __inline
+# elif defined(__INTEL_COMPILER)
+# define INLINE inline
+# elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
+# define INLINE __inline
+# elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
+# define INLINE inline
+# elif (__STDC_VERSION__ >= 199901L) /* C99 */
+# define INLINE inline
+# else
+# define INLINE
+# endif
+#endif
+
+/* Function visibility */
+#ifndef PUBLIC
+# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+# define PUBLIC __attribute__((visibility("default")))
+# define HIDDEN __attribute__((visibility("hidden")))
+# else
+# define PUBLIC
+# define HIDDEN
+# endif
+#endif
+
+#ifndef likely
+# if defined(__GNUC__)
+# define likely(x) __builtin_expect(!!(x), 1)
+# define unlikely(x) __builtin_expect(!!(x), 0)
+# else
+# define likely(x) (x)
+# define unlikely(x) (x)
+# endif
+#endif
+
+#endif /* _U_COMPILER_H_ */