Mesa (master): egl: Silence warnings when compiled with -pedantic.
Chia-I Wu
olv at kemper.freedesktop.org
Fri Feb 19 04:40:40 UTC 2010
Module: Mesa
Branch: master
Commit: 496724b869d4258a64e8343d3ae66d08bfb19f7b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=496724b869d4258a64e8343d3ae66d08bfb19f7b
Author: Chia-I Wu <olv at lunarg.com>
Date: Fri Feb 19 11:47:54 2010 +0800
egl: Silence warnings when compiled with -pedantic.
Just follow gcc's advices here.
---
src/egl/main/eglconfig.c | 2 +-
src/egl/main/egldisplay.h | 2 ++
src/egl/main/egldriver.c | 8 +++++++-
src/egl/main/egltypedefs.h | 2 --
4 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c
index 1190f8c..177cf3e 100644
--- a/src/egl/main/eglconfig.c
+++ b/src/egl/main/eglconfig.c
@@ -112,7 +112,7 @@ enum {
ATTRIB_CRITERION_ATLEAST,
ATTRIB_CRITERION_MASK,
ATTRIB_CRITERION_SPECIAL,
- ATTRIB_CRITERION_IGNORE,
+ ATTRIB_CRITERION_IGNORE
};
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 43b39bd..5d69b87 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -14,6 +14,8 @@ enum _egl_resource_type {
_EGL_NUM_RESOURCES
};
+/* this cannot and need not go into egltypedefs.h */
+typedef enum _egl_resource_type _EGLResourceType;
/**
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 8748fe5..6384242 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -144,7 +144,13 @@ _eglOpenLibrary(const char *driverPath, lib_handle *handle)
mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain");
#elif defined(_EGL_PLATFORM_POSIX)
if (lib) {
- mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain");
+ union {
+ _EGLMain_t func;
+ void *ptr;
+ } tmp = { NULL };
+ /* direct cast gives a warning when compiled with -pedantic */
+ tmp.ptr = dlsym(lib, "_eglMain");
+ mainFunc = tmp.func;
if (!mainFunc)
error = dlerror();
}
diff --git a/src/egl/main/egltypedefs.h b/src/egl/main/egltypedefs.h
index e0c9576..166b133 100644
--- a/src/egl/main/egltypedefs.h
+++ b/src/egl/main/egltypedefs.h
@@ -8,8 +8,6 @@
#include "eglcompiler.h"
-typedef enum _egl_resource_type _EGLResourceType;
-
typedef struct _egl_api _EGLAPI;
typedef struct _egl_config _EGLConfig;
More information about the mesa-commit
mailing list