From 4e97084591c206338af4425c33edb833de348816 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 6 Jul 2017 18:40:53 -0700 Subject: [PATCH] egl: Fix inclusion of egl.h+mesa_glinterop.h Previously clang would warn about redefinition of typedef EGLDisplay. Avoid this by adding preprocessor guards to mesa_glinterop.h and including it after EGL.h is indirectly included. Reviewed-by: Jordan Justen --- include/GL/mesa_glinterop.h | 4 ++++ src/egl/drivers/dri2/egl_dri2.c | 2 +- src/egl/main/eglapi.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/GL/mesa_glinterop.h b/include/GL/mesa_glinterop.h index 173476a..45fda93 100644 --- a/include/GL/mesa_glinterop.h +++ b/include/GL/mesa_glinterop.h @@ -58,12 +58,16 @@ extern "C" { #endif /* Forward declarations to avoid inclusion of GL/glx.h */ +#ifndef GLX_H struct _XDisplay; struct __GLXcontextRec; +#endif /* Forward declarations to avoid inclusion of EGL/egl.h */ +#ifndef __egl_h_ typedef void *EGLDisplay; typedef void *EGLContext; +#endif /** Returned error codes. */ enum { diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index ed79e0d..1259433 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -46,7 +46,6 @@ #endif #include #include -#include "GL/mesa_glinterop.h" #include #include @@ -61,6 +60,7 @@ #endif #include "egl_dri2.h" +#include "GL/mesa_glinterop.h" #include "loader/loader.h" #include "util/u_atomic.h" #include "util/u_vector.h" diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index c935c4d..e3f10fc 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -88,7 +88,6 @@ #include #include "c99_compat.h" #include "c11/threads.h" -#include "GL/mesa_glinterop.h" #include "util/macros.h" #include "eglglobals.h" @@ -102,6 +101,7 @@ #include "eglimage.h" #include "eglsync.h" +#include "GL/mesa_glinterop.h" /** * Macros to help return an API entrypoint. -- 2.7.4