summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-02-06 11:10:41 -0800
committerEric Anholt <eric@anholt.net>2014-02-06 11:16:11 -0800
commitc99653408057065d5a3adb443dc9ba5420de0219 (patch)
tree216273948432af6bebee2a3ed4fc1c641af48caa /src
parent79600fa6d28bbf2718840f8396878db8f5569c8c (diff)
Define the rest of the khrplatform.h types, and prevent its inclusion.
One of the problems with krhplatform.h (besides it being a terrible idea in the first place) is that it's not present on many systems at all, including apple, win32, and linux before late 2009. So, unless we introduce the first ./configure dependency to the core library build, we really do need to define these standard types to their standard values. But if we allow khrplatform.h inclusion as well, we'll get long-vs-int redefinition warnings on 32-bit. So, we have to completely replicate the header, which is a thing we've done for everything else except for eglplatform.h. A testcase will be used to make sure that our types don't drift from the system khrplatform.h types, if it even exists. Fixes #17
Diffstat (limited to 'src')
-rwxr-xr-xsrc/gen_dispatch.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py
index abf7e3a..d0cb89a 100755
--- a/src/gen_dispatch.py
+++ b/src/gen_dispatch.py
@@ -486,8 +486,12 @@ class Generator(object):
if self.target == "egl":
self.outln('#include "EGL/eglplatform.h"')
else:
- # Add some ridiculous inttypes.h redefinitions that are from
- # khrplatform.h and not included in the XML.
+ # Add some ridiculous inttypes.h redefinitions that are
+ # from khrplatform.h and not included in the XML. We
+ # don't directly include khrplatform.h because it's not
+ # present on many systems, and coming up with #ifdefs to
+ # decide when it's not present would be hard.
+ self.outln('#define __khrplatform_h_ 1')
self.outln('typedef int8_t khronos_int8_t;')
self.outln('typedef int16_t khronos_int16_t;')
self.outln('typedef int32_t khronos_int32_t;')
@@ -499,8 +503,16 @@ class Generator(object):
self.outln('typedef float khronos_float_t;')
self.outln('typedef intptr_t khronos_intptr_t;')
self.outln('typedef ptrdiff_t khronos_ssize_t;')
+ self.outln('typedef unsigned long khronos_usize_t;')
self.outln('typedef uint64_t khronos_utime_nanoseconds_t;')
self.outln('typedef int64_t khronos_stime_nanoseconds_t;')
+ self.outln('#define KHRONOS_MAX_ENUM 0x7FFFFFFF')
+ self.outln('typedef enum {')
+ self.outln(' KHRONOS_FALSE = 0,')
+ self.outln(' KHRONOS_TRUE = 1,')
+ self.outln(' KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM')
+ self.outln('} khronos_boolean_enum_t;')
+ self.outln('typedef uintptr_t khronos_uintptr_t;')
if self.target == "glx":
self.outln('#include <X11/Xlib.h>')