1 /**************************************************************************
3 * Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
4 * Copyright 2010 LunarG, Inc.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
27 **************************************************************************/
30 #ifndef EGLCOMPILER_INCLUDED
31 #define EGLCOMPILER_INCLUDED
35 * Get standard integer types
37 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
39 #elif defined(_MSC_VER)
40 typedef __int8
int8_t;
41 typedef unsigned __int8
uint8_t;
42 typedef __int16
int16_t;
43 typedef unsigned __int16
uint16_t;
44 typedef __int32
int32_t;
45 typedef unsigned __int32
uint32_t;
46 typedef __int64
int64_t;
47 typedef unsigned __int64
uint64_t;
50 typedef __int64
intptr_t;
51 typedef unsigned __int64
uintptr_t;
53 typedef __int32
intptr_t;
54 typedef unsigned __int32
uintptr_t;
57 # define INT64_C(__val) __val##i64
58 # define UINT64_C(__val) __val##ui64
60 /* hope the best instead of adding a bunch of ifdef's */
69 # define INLINE __inline__
70 #elif defined(__MSC__)
71 # define INLINE __inline
72 #elif defined(_MSC_VER)
73 # define INLINE __inline
75 # define INLINE __inline
76 #elif defined(__INTEL_COMPILER)
77 # define INLINE inline
78 #elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
79 # define INLINE __inline
80 #elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
81 # define INLINE inline
82 # define __inline inline
83 # define __inline__ inline
84 #elif (__STDC_VERSION__ >= 199901L) /* C99 */
85 # define INLINE inline
95 # if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
96 # define PUBLIC __attribute__((visibility("default")))
97 # elif defined(_MSC_VER)
98 # define PUBLIC __declspec(dllexport)
105 * The __FUNCTION__ gcc variable is generally only used for debugging.
106 * If we're not using gcc, define __FUNCTION__ as a cpp symbol here.
107 * Don't define it if using a newer Windows compiler.
111 # define __FUNCTION__ "VMS$NL:"
112 # elif (!defined __GNUC__) && (!defined __xlC__) && \
113 (!defined(_MSC_VER) || _MSC_VER < 1300)
114 # if (__STDC_VERSION__ >= 199901L) /* C99 */ || \
115 (defined(__SUNPRO_C) && defined(__C99FEATURES__))
116 # define __FUNCTION__ __func__
118 # define __FUNCTION__ "<unknown>"
123 #endif /* EGLCOMPILER_INCLUDED */