Commit c7f36574 authored by Julien Isorce's avatar Julien Isorce Committed by Emil Velikov
Browse files

darwin: Suppress type conversion warnings for GLhandleARB

This patch and its description are inspired from Jose Fonseca
explanations and suggestions.

With this patch the following logic applies and only if __APPLE__:

When building mesa, GLhandleARB is defined as unsigned long and
at some point casted to GLuint in gl fuction implementations.
These exact points are where these errors and warnings appear.

When building an application GLhandleARB is defined as void*.
Later when calling a gl function, for example glBindAttribLocationARB,
it will be dispatched to _mesa_BindAttribLocation. So internally
void* will be treated as unsigned long which has the same size.
So the same truncation happens when casting it to GLuint.

Same when GLhandleARB appears as return value.
For mesa it will be GLuint -> unsigned long.
For an application it will be GLuint -> unsigned long -> void*.
Note that the value will be preserved when casting back to GLuint.

When GLhandleARB appears as a pointer there are also separate
entry-points, i.e. _mesa_FuncNameARB. So the same logic can
be applied.


Signed-off-by: Julien Isorce's avatarJulien Isorce <>
Reviewed-by: Jose Fonseca's avatarJose Fonseca <>
Reviewed-by: Emil Velikov's avatarEmil Velikov <>
parent 64cb0140
......@@ -1354,7 +1354,7 @@ if test "x$enable_dri" = xyes; then
if test "x$with_dri_drivers" = "xyes"; then
......@@ -3879,7 +3879,12 @@ GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value);
#ifndef GL_ARB_shader_objects
#define GL_ARB_shader_objects 1
#ifdef __APPLE__
/* Avoid uint <-> void* warnings */
typedef unsigned long GLhandleARB;
typedef void *GLhandleARB;
typedef unsigned int GLhandleARB;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment