EGL: Change __EGLapiImports to use (void *) for function pointers.

Trying to cast between __eglMustCastToProperFunctionPointerType and other
function pointer types causes strict aliasing warnings on some compilers.

Instead, just use a simple (void *) type for retrieving function pointers from
a vendor library, like libGLX does.
This commit is contained in:
Kyle Brenneman 2016-08-30 13:22:59 -06:00
parent 6c4f5ef9f7
commit 3053b22f3e
2 changed files with 5 additions and 6 deletions

View file

@ -277,7 +277,7 @@ typedef struct __EGLapiImportsRec {
* \return A pointer to a function, or \c NULL if the vendor does not
* support the function.
*/
__eglMustCastToProperFunctionPointerType (* getProcAddress) (const char *procName);
void * (* getProcAddress) (const char *procName);
/*!
* This retrieves vendor-neutral functions which use the
@ -293,7 +293,7 @@ typedef struct __EGLapiImportsRec {
* \return A pointer to a function, or \c NULL if the vendor does not
* support the function or \p procName is not a EGL display function.
*/
__eglMustCastToProperFunctionPointerType (*getDispatchAddress) (const char *procName);
void * (*getDispatchAddress) (const char *procName);
/*!
* This notifies the vendor library which dispatch table index is

View file

@ -193,8 +193,7 @@ static GLboolean LookupVendorEntrypoints(__EGLvendorInfo *vendor)
// normal EGL dispatch functions, instead of having to special-case them.
#define LOADENTRYPOINT(ptr, name) do { \
*((__eglMustCastToProperFunctionPointerType *) &vendor->staticDispatch.ptr) = \
vendor->eglvc.getProcAddress(name); \
vendor->staticDispatch.ptr = vendor->eglvc.getProcAddress(name); \
if (vendor->staticDispatch.ptr == NULL) { return GL_FALSE; } \
} while(0)
@ -229,8 +228,8 @@ static GLboolean LookupVendorEntrypoints(__EGLvendorInfo *vendor)
// The remaining functions here are optional.
#define LOADENTRYPOINT(ptr, name) \
*((__eglMustCastToProperFunctionPointerType *) &vendor->staticDispatch.ptr) = \
vendor->eglvc.getProcAddress(name);
vendor->staticDispatch.ptr = vendor->eglvc.getProcAddress(name);
LOADENTRYPOINT(bindAPI, "eglBindAPI" );
LOADENTRYPOINT(createSync, "eglCreateSync" );
LOADENTRYPOINT(destroySync, "eglDestroySync" );