Commit abe89c7d by Jamie Madill Committed by Commit Bot

Tweak platform method signatures.

This works around a limitation in UBSAN which can't handle decltype. Instead use void * and typedef where appropriate. BUG=chromium:692274 Change-Id: I4eab796db3aa2e51c0fc558170eb2af61f07223d Reviewed-on: https://chromium-review.googlesource.com/443885Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent f7bbc8a3
...@@ -240,12 +240,15 @@ extern "C" { ...@@ -240,12 +240,15 @@ extern "C" {
// match the compiled signature for this ANGLE, false is returned. On success true is returned. // match the compiled signature for this ANGLE, false is returned. On success true is returned.
// The application should set any platform methods it cares about on the returned pointer. // The application should set any platform methods it cares about on the returned pointer.
// If display is not valid, behaviour is undefined. // If display is not valid, behaviour is undefined.
ANGLE_PLATFORM_EXPORT bool ANGLE_APIENTRY //
ANGLEGetDisplayPlatform(angle::EGLDisplayType display, // Use a void * here to silence a sanitizer limitation with decltype.
const char *const methodNames[], // TODO(jmadill): Use angle::PlatformMethods ** if UBSAN is fixed to handle decltype.
unsigned int methodNameCount,
void *context, ANGLE_PLATFORM_EXPORT bool ANGLE_APIENTRY ANGLEGetDisplayPlatform(angle::EGLDisplayType display,
angle::PlatformMethods **platformMethodsOut); const char *const methodNames[],
unsigned int methodNameCount,
void *context,
void *platformMethodsOut);
// Sets the platform methods back to their defaults. // Sets the platform methods back to their defaults.
// If display is not valid, behaviour is undefined. // If display is not valid, behaviour is undefined.
...@@ -255,8 +258,14 @@ ANGLE_PLATFORM_EXPORT void ANGLE_APIENTRY ANGLEResetDisplayPlatform(angle::EGLDi ...@@ -255,8 +258,14 @@ ANGLE_PLATFORM_EXPORT void ANGLE_APIENTRY ANGLEResetDisplayPlatform(angle::EGLDi
namespace angle namespace angle
{ {
using GetDisplayPlatformFunc = decltype(&ANGLEGetDisplayPlatform); // Use typedefs here instead of decltype to work around sanitizer limitations.
using ResetDisplayPlatformFunc = decltype(&ANGLEResetDisplayPlatform); // TODO(jmadill): Use decltype here if UBSAN is fixed.
typedef bool(ANGLE_APIENTRY *GetDisplayPlatformFunc)(angle::EGLDisplayType,
const char *const *,
unsigned int,
void *,
void *);
typedef void(ANGLE_APIENTRY *ResetDisplayPlatformFunc)(angle::EGLDisplayType);
} // namespace angle } // namespace angle
// This function is not exported // This function is not exported
......
...@@ -27,8 +27,11 @@ bool ANGLE_APIENTRY ANGLEGetDisplayPlatform(angle::EGLDisplayType display, ...@@ -27,8 +27,11 @@ bool ANGLE_APIENTRY ANGLEGetDisplayPlatform(angle::EGLDisplayType display,
const char *const methodNames[], const char *const methodNames[],
unsigned int methodNameCount, unsigned int methodNameCount,
void *context, void *context,
angle::PlatformMethods **platformMethodsOut) void *platformMethods)
{ {
angle::PlatformMethods **platformMethodsOut =
reinterpret_cast<angle::PlatformMethods **>(platformMethods);
// We allow for a lower input count of impl platform methods if the subset is correct. // We allow for a lower input count of impl platform methods if the subset is correct.
if (methodNameCount > angle::g_NumPlatformMethods) if (methodNameCount > angle::g_NumPlatformMethods)
{ {
......
Markdown is supported
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