summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-01-31 15:19:09 -0800
committerEric Anholt <eric@anholt.net>2014-01-31 15:52:28 -0800
commit36847f88a7790d3bb917a82494e04fff708b39dd (patch)
treed08c95515e231023d02c10ab499fe81e24ae113c
parent7c660c5c7ae94043a2c4b9d260ccc9367992989e (diff)
downloadlibepoxy-36847f88a7790d3bb917a82494e04fff708b39dd.tar.gz
Fix compiler warnings in the tests.
I didn't have CWARNFLAGS in the Makefile.am, so lots of things that would generate warnings had crept in.
-rw-r--r--test/egl_common.c7
-rw-r--r--test/glx_common.c2
-rw-r--r--test/glx_common.h2
-rw-r--r--test/glx_glxgetprocaddress_nocontext.c3
-rw-r--r--test/glx_public_api_core.c25
5 files changed, 23 insertions, 16 deletions
diff --git a/test/egl_common.c b/test/egl_common.c
index 4cc0409..d2f11a3 100644
--- a/test/egl_common.c
+++ b/test/egl_common.c
@@ -23,6 +23,7 @@
#include <err.h>
#include <epoxy/egl.h>
+#include "egl_common.h"
/**
* Do whatever it takes to get us an EGL display for the system.
@@ -34,15 +35,17 @@ get_egl_display_or_skip(void)
{
Display *dpy = XOpenDisplay(NULL);
EGLint major, minor;
+ EGLDisplay *edpy;
+ bool ok;
if (!dpy)
errx(77, "couldn't open display\n");
- EGLDisplay *edpy = eglGetDisplay(dpy);
+ edpy = eglGetDisplay(dpy);
if (!edpy)
errx(1, "Couldn't get EGL display for X11 Display.\n");
- bool ok = eglInitialize(edpy, &major, &minor);
+ ok = eglInitialize(edpy, &major, &minor);
if (!ok)
errx(1, "eglInitialize() failed\n");
diff --git a/test/glx_common.c b/test/glx_common.c
index 4a1d460..fda1602 100644
--- a/test/glx_common.c
+++ b/test/glx_common.c
@@ -24,7 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
-#include "epoxy/glx.h"
+#include "glx_common.h"
Display *
get_display_or_skip(void)
diff --git a/test/glx_common.h b/test/glx_common.h
index 3a2e41d..8b6c263 100644
--- a/test/glx_common.h
+++ b/test/glx_common.h
@@ -26,7 +26,7 @@
Display *
get_display_or_skip(void);
-GLXContext
+void
make_glx_context_current_or_skip(Display *dpy);
GLXFBConfig
diff --git a/test/glx_glxgetprocaddress_nocontext.c b/test/glx_glxgetprocaddress_nocontext.c
index fc81894..2182215 100644
--- a/test/glx_glxgetprocaddress_nocontext.c
+++ b/test/glx_glxgetprocaddress_nocontext.c
@@ -43,12 +43,13 @@ int
main(int argc, char **argv)
{
bool pass = true;
+ void *func;
dpy = get_display_or_skip();
if (epoxy_glx_version(dpy, 0) < 14)
errx(77, "GLX version 1.4 required for glXGetProcAddress().\n");
- void *func = glXGetProcAddress((const GLubyte *)"glGetString");
+ func = glXGetProcAddress((const GLubyte *)"glGetString");
if (!func)
errx(1, "glXGetProcAddress() returned NULL\n");
diff --git a/test/glx_public_api_core.c b/test/glx_public_api_core.c
index c130d86..29252ec 100644
--- a/test/glx_public_api_core.c
+++ b/test/glx_public_api_core.c
@@ -134,15 +134,9 @@ int
main(int argc, char **argv)
{
bool pass = true;
-
- dpy = get_display_or_skip();
-
- if (!epoxy_has_glx_extension(dpy, 0, "GLX_ARB_create_context_profile"))
- errx(77, "Test requires GLX_ARB_create_context_profile");
-
- XVisualInfo *visinfo = get_glx_visual(dpy);
- Window win = get_glx_window(dpy, visinfo, false);
- GLXFBConfig config = get_fbconfig_for_visinfo(dpy, visinfo);
+ XVisualInfo *visinfo;
+ Window win;
+ GLXFBConfig config;
static const int attribs[] = {
GLX_CONTEXT_PROFILE_MASK_ARB,
GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
@@ -152,8 +146,17 @@ main(int argc, char **argv)
2,
None
};
- GLXContext ctx = glXCreateContextAttribsARB(dpy, config, NULL, True,
- attribs);
+ GLXContext ctx;
+
+ dpy = get_display_or_skip();
+
+ if (!epoxy_has_glx_extension(dpy, 0, "GLX_ARB_create_context_profile"))
+ errx(77, "Test requires GLX_ARB_create_context_profile");
+
+ visinfo = get_glx_visual(dpy);
+ win = get_glx_window(dpy, visinfo, false);
+ config = get_fbconfig_for_visinfo(dpy, visinfo);
+ ctx = glXCreateContextAttribsARB(dpy, config, NULL, True, attribs);
if (ctx == None)
errx(77, "glXCreateContext failed");