p_compiler.h

Go to the documentation of this file.
00001 /**************************************************************************
00002  * 
00003  * Copyright 2007-2008 Tungsten Graphics, Inc., Cedar Park, Texas.
00004  * All Rights Reserved.
00005  * 
00006  * Permission is hereby granted, free of charge, to any person obtaining a
00007  * copy of this software and associated documentation files (the
00008  * "Software"), to deal in the Software without restriction, including
00009  * without limitation the rights to use, copy, modify, merge, publish,
00010  * distribute, sub license, and/or sell copies of the Software, and to
00011  * permit persons to whom the Software is furnished to do so, subject to
00012  * the following conditions:
00013  * 
00014  * The above copyright notice and this permission notice (including the
00015  * next paragraph) shall be included in all copies or substantial portions
00016  * of the Software.
00017  * 
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
00021  * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
00022  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00023  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00024  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00025  * 
00026  **************************************************************************/
00027 
00028 #ifndef P_COMPILER_H
00029 #define P_COMPILER_H
00030 
00031 
00032 #include "p_config.h"
00033 
00034 #ifndef XFree86Server
00035 #include <stdlib.h>
00036 #include <string.h>
00037 #else
00038 #include "xf86_ansic.h"
00039 #include "xf86_libc.h"
00040 #endif
00041 
00042 
00043 #if defined(_WIN32) && !defined(__WIN32__)
00044 #define __WIN32__
00045 #endif
00046 
00047 #if defined(_MSC_VER)
00048 
00049 /* Avoid 'expression is always true' warning */
00050 #pragma warning(disable: 4296)
00051 
00052 #endif /* _MSC_VER */
00053 
00054 
00055 #if defined(_MSC_VER)
00056 
00057 typedef __int8             int8_t;
00058 typedef unsigned __int8    uint8_t;
00059 typedef __int16            int16_t;
00060 typedef unsigned __int16   uint16_t;
00061 #ifndef __eglplatform_h_
00062 typedef __int32            int32_t;
00063 #endif
00064 typedef unsigned __int32   uint32_t;
00065 typedef __int64            int64_t;
00066 typedef unsigned __int64   uint64_t;
00067 
00068 #if defined(_WIN64)
00069 typedef __int64            intptr_t;
00070 typedef unsigned __int64   uintptr_t;
00071 #else
00072 typedef __int32            intptr_t;
00073 typedef unsigned __int32   uintptr_t;
00074 #endif
00075 
00076 #define INT64_C(__val) __val##i64
00077 #define UINT64_C(__val) __val##ui64
00078 
00079 #ifndef __cplusplus
00080 #define false   0
00081 #define true    1
00082 #define bool    _Bool
00083 typedef int     _Bool;
00084 #define __bool_true_false_are_defined   1
00085 #endif /* !__cplusplus */
00086 
00087 #else
00088 #ifndef __STDC_LIMIT_MACROS
00089 #define __STDC_LIMIT_MACROS 1
00090 #endif
00091 #include <stdint.h>
00092 #include <stdbool.h>
00093 #endif
00094 
00095 
00096 typedef unsigned int       uint;
00097 typedef unsigned char      ubyte;
00098 typedef unsigned short     ushort;
00099 typedef uint64_t           uint64;
00100 
00101 #if 0
00102 #define boolean bool
00103 #else
00104 typedef unsigned char boolean;
00105 #endif
00106 #ifndef TRUE
00107 #define TRUE  true
00108 #endif
00109 #ifndef FALSE
00110 #define FALSE false
00111 #endif
00112 
00113 
00114 /* Function inlining */
00115 #ifdef __cplusplus
00116 #  define INLINE inline
00117 #elif defined(__GNUC__)
00118 #  define INLINE __inline__
00119 #elif defined(_MSC_VER)
00120 #  define INLINE __inline
00121 #elif defined(__ICL)
00122 #  define INLINE __inline
00123 #elif defined(__INTEL_COMPILER)
00124 #  define INLINE inline
00125 #elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
00126 #  define INLINE __inline
00127 #else
00128 #  define INLINE
00129 #endif
00130 
00131 
00132 /* This should match linux gcc cdecl semantics everywhere, so that we
00133  * just codegen one calling convention on all platforms.
00134  */
00135 #ifdef _MSC_VER
00136 #define PIPE_CDECL __cdecl
00137 #else
00138 #define PIPE_CDECL
00139 #endif
00140 
00141 
00142 
00143 #if defined(__GNUC__)
00144 #define ALIGN16_DECL(TYPE, NAME, SIZE)  TYPE NAME##___aligned[SIZE] __attribute__(( aligned( 16 ) ))
00145 #define ALIGN16_ASSIGN(NAME) NAME##___aligned
00146 #define ALIGN16_ATTRIB  __attribute__(( aligned( 16 ) ))
00147 #else
00148 #define ALIGN16_DECL(TYPE, NAME, SIZE)  TYPE NAME##___unaligned[SIZE + 1]
00149 #define ALIGN16_ASSIGN(NAME) align16(NAME##___unaligned)
00150 #define ALIGN16_ATTRIB
00151 #endif
00152 
00153 
00154 
00155 #endif /* P_COMPILER_H */

Generated on Tue Sep 29 06:25:17 2009 for Gallium3D by  doxygen 1.5.4