1 /**************************************************************************
3 * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
40 #if defined(_WIN32) && !defined(__WIN32__)
46 /* Avoid 'expression is always true' warning */
47 #pragma warning(disable: 4296)
53 * Alternative stdint.h and stdbool.h headers are supplied in include/c99 for
54 * systems that lack it.
56 #ifndef __STDC_LIMIT_MACROS
57 #define __STDC_LIMIT_MACROS 1
63 #if !defined(__HAIKU__) && !defined(__USE_MISC)
64 typedef unsigned int uint
;
65 typedef unsigned short ushort
;
67 typedef unsigned char ubyte
;
69 typedef unsigned char boolean
;
77 typedef unsigned short half
;
79 /* Function inlining */
82 # define INLINE inline
83 # elif defined(__GNUC__)
84 # define INLINE __inline__
85 # elif defined(_MSC_VER)
86 # define INLINE __inline
88 # define INLINE __inline
89 # elif defined(__INTEL_COMPILER)
90 # define INLINE inline
91 # elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
92 # define INLINE __inline
93 # elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
94 # define INLINE inline
95 # elif (__STDC_VERSION__ >= 199901L) /* C99 */
96 # define INLINE inline
103 /* Function visibility */
105 # if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
106 # define PUBLIC __attribute__((visibility("default")))
113 /* The __FUNCTION__ gcc variable is generally only used for debugging.
114 * If we're not using gcc, define __FUNCTION__ as a cpp symbol here.
117 # if !defined(__GNUC__)
118 # if (__STDC_VERSION__ >= 199901L) /* C99 */ || \
119 (defined(__SUNPRO_C) && defined(__C99FEATURES__))
120 # define __FUNCTION__ __func__
122 # define __FUNCTION__ "<unknown>"
125 # if defined(_MSC_VER) && _MSC_VER < 1300
126 # define __FUNCTION__ "<unknown>"
132 /* This should match linux gcc cdecl semantics everywhere, so that we
133 * just codegen one calling convention on all platforms.
136 #define PIPE_CDECL __cdecl
143 #if defined(__GNUC__)
144 #define PIPE_DEPRECATED __attribute__((__deprecated__))
146 #define PIPE_DEPRECATED
151 /* Macros for data alignment. */
152 #if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
154 /* See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Type-Attributes.html */
155 #define PIPE_ALIGN_TYPE(_alignment, _type) _type __attribute__((aligned(_alignment)))
157 /* See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Variable-Attributes.html */
158 #define PIPE_ALIGN_VAR(_alignment) __attribute__((aligned(_alignment)))
160 #if (__GNUC__ > 4 || (__GNUC__ == 4 &&__GNUC_MINOR__>1)) && !defined(PIPE_ARCH_X86_64)
161 #define PIPE_ALIGN_STACK __attribute__((force_align_arg_pointer))
163 #define PIPE_ALIGN_STACK
166 #elif defined(_MSC_VER)
168 /* See http://msdn.microsoft.com/en-us/library/83ythb65.aspx */
169 #define PIPE_ALIGN_TYPE(_alignment, _type) __declspec(align(_alignment)) _type
170 #define PIPE_ALIGN_VAR(_alignment) __declspec(align(_alignment))
172 #define PIPE_ALIGN_STACK
176 #define PIPE_ALIGN_TYPE(_alignment, _type) _type
177 #define PIPE_ALIGN_VAR(_alignment)
179 #define PIPE_ALIGN_STACK
183 #error "Unsupported compiler"
189 #endif /* P_COMPILER_H */