diff options
author | Eric Anholt <eric@anholt.net> | 2013-12-12 11:18:28 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2013-12-12 11:39:34 -0800 |
commit | 0cfb0a044bc43245409c020e2ca34091c96283d4 (patch) | |
tree | 4aae7d9ddbc86f681b654bf1e091612394723403 /src | |
parent | 8d8334c350e8979c23bd9fe7c942693fcf76f958 (diff) |
Fix most GLhandleARB warnings on OS X with a big comment in our code.
Diffstat (limited to 'src')
-rwxr-xr-x | src/gen_dispatch.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py index 4bcf4e3..652dfff 100755 --- a/src/gen_dispatch.py +++ b/src/gen_dispatch.py @@ -107,12 +107,31 @@ class GLFunction(object): elif name == "far": name = "yon" + # Mac screwed up GLhandleARB and made it a void * instead of + # uint32_t, despite it being specced as only necessarily 32 + # bits wide, causing portability problems all over. There are + # prototype conflicts between things like + # glAttachShader(GLuint program, GLuint shader) and + # glAttachObjectARB(GLhandleARB container, GLhandleARB obj), + # even though they are marked as aliases in the XML (and being + # aliases in Mesa). + # + # We retain those aliases. In the x86_64 ABI, the first 6 + # args are stored in 64-bit registers, so the calls end up + # being the same despite the different types. We just need to + # add a cast to uintptr_t to shut up the compiler. + if type == 'GLhandleARB': + assert(len(self.args) < 6) + arg_list_name = '(uintptr_t)' + name + else: + arg_list_name = name + self.args.append((type, name)) if self.args_decl == 'void': - self.args_list = name + self.args_list = arg_list_name self.args_decl = type + ' ' + name else: - self.args_list += ', ' + name + self.args_list += ', ' + arg_list_name self.args_decl += ', ' + type + ' ' + name def add_provider(self, condition, loader, condition_name): |