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"
43 #if defined(_WIN32) && !defined(__WIN32__)
49 /* Avoid 'expression is always true' warning */
50 #pragma warning(disable: 4296)
56 * Alternative stdint.h and stdbool.h headers are supplied in include/c99 for
57 * systems that lack it.
59 #ifndef __STDC_LIMIT_MACROS
60 #define __STDC_LIMIT_MACROS 1
67 typedef unsigned int uint
;
68 typedef unsigned short ushort
;
70 typedef unsigned char ubyte
;
75 typedef unsigned char boolean
;
85 /* Function inlining */
88 # define INLINE inline
89 # elif defined(__GNUC__)
90 # define INLINE __inline__
91 # elif defined(_MSC_VER)
92 # define INLINE __inline
94 # define INLINE __inline
95 # elif defined(__INTEL_COMPILER)
96 # define INLINE inline
97 # elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
98 # define INLINE __inline
99 # elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
100 # define INLINE inline
101 # elif (__STDC_VERSION__ >= 199901L) /* C99 */
102 # define INLINE inline
108 /* The __FUNCTION__ gcc variable is generally only used for debugging.
109 * If we're not using gcc, define __FUNCTION__ as a cpp symbol here.
112 # if (!defined(__GNUC__) || (__GNUC__ < 2))
113 # if (__STDC_VERSION__ >= 199901L) /* C99 */ || \
114 (defined(__SUNPRO_C) && defined(__C99FEATURES__))
115 # define __FUNCTION__ __func__
117 # define __FUNCTION__ "<unknown>"
124 /* This should match linux gcc cdecl semantics everywhere, so that we
125 * just codegen one calling convention on all platforms.
128 #define PIPE_CDECL __cdecl
135 #if defined(__GNUC__)
136 #define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME##___aligned[SIZE] __attribute__(( aligned( 16 ) ))
137 #define ALIGN16_ASSIGN(NAME) NAME##___aligned
138 #define ALIGN16_ATTRIB __attribute__(( aligned( 16 ) ))
139 #define ALIGN8_ATTRIB __attribute__(( aligned( 8 ) ))
140 #if (__GNUC__ > 4 || (__GNUC__ == 4 &&__GNUC_MINOR__>1)) && !defined(PIPE_ARCH_X86_64)
141 #define ALIGN_STACK __attribute__((force_align_arg_pointer))
146 #define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME##___unaligned[SIZE + 1]
147 #define ALIGN16_ASSIGN(NAME) align16(NAME##___unaligned)
148 #define ALIGN16_ATTRIB
149 #define ALIGN8_ATTRIB
155 #endif /* P_COMPILER_H */