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 **************************************************************************/
38 #include "xf86_ansic.h"
39 #include "xf86_libc.h"
44 #if defined(_WIN32) && !defined(__WIN32__)
50 /* Avoid 'expression is always true' warning */
51 #pragma warning(disable: 4296)
57 * Alternative stdint.h and stdbool.h headers are supplied in include/c99 for
58 * systems that lack it.
60 #ifndef __STDC_LIMIT_MACROS
61 #define __STDC_LIMIT_MACROS 1
67 #if !defined(__HAIKU__) && !defined(__USE_MISC)
68 typedef unsigned int uint
;
69 typedef unsigned short ushort
;
71 typedef unsigned char ubyte
;
73 typedef unsigned char boolean
;
82 /* Function inlining */
85 # define INLINE inline
86 # elif defined(__GNUC__)
87 # define INLINE __inline__
88 # elif defined(_MSC_VER)
89 # define INLINE __inline
91 # define INLINE __inline
92 # elif defined(__INTEL_COMPILER)
93 # define INLINE inline
94 # elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
95 # define INLINE __inline
96 # elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
97 # define INLINE inline
98 # elif (__STDC_VERSION__ >= 199901L) /* C99 */
99 # define INLINE inline
106 /* Function visibility */
108 # if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303) \
109 || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
110 # define PUBLIC __attribute__((visibility("default")))
117 /* The __FUNCTION__ gcc variable is generally only used for debugging.
118 * If we're not using gcc, define __FUNCTION__ as a cpp symbol here.
121 # if (!defined(__GNUC__) || (__GNUC__ < 2))
122 # if (__STDC_VERSION__ >= 199901L) /* C99 */ || \
123 (defined(__SUNPRO_C) && defined(__C99FEATURES__))
124 # define __FUNCTION__ __func__
126 # define __FUNCTION__ "<unknown>"
133 /* This should match linux gcc cdecl semantics everywhere, so that we
134 * just codegen one calling convention on all platforms.
137 #define PIPE_CDECL __cdecl
144 /* Macros for data alignment. */
145 #if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
147 /* See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Type-Attributes.html */
148 #define PIPE_ALIGN_TYPE(_alignment, _type) _type __attribute__((aligned(_alignment)))
150 /* See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Variable-Attributes.html */
151 #define PIPE_ALIGN_VAR(_alignment) __attribute__((aligned(_alignment)))
153 #if (__GNUC__ > 4 || (__GNUC__ == 4 &&__GNUC_MINOR__>1)) && !defined(PIPE_ARCH_X86_64)
154 #define PIPE_ALIGN_STACK __attribute__((force_align_arg_pointer))
156 #define PIPE_ALIGN_STACK
159 #elif defined(_MSC_VER)
161 /* See http://msdn.microsoft.com/en-us/library/83ythb65.aspx */
162 #define PIPE_ALIGN_TYPE(_alignment, _type) __declspec(align(_alignment)) _type
163 #define PIPE_ALIGN_VAR(_alignment) __declspec(align(_alignment))
165 #define PIPE_ALIGN_STACK
169 #define PIPE_ALIGN_TYPE(_alignment, _type) _type
170 #define PIPE_ALIGN_VAR(_alignment)
172 #define PIPE_ALIGN_STACK
176 #error "Unsupported compiler"
182 #endif /* P_COMPILER_H */