path: root/src
diff options
authorPaul Berry <stereotype441@gmail.com>2012-03-16 14:38:18 -0700
committerPaul Berry <stereotype441@gmail.com>2012-03-23 13:36:34 -0700
commit85240ae1a26713683400a3c4fba84a64c0d339cb (patch)
treed755cfa7029274f9ae1e81b7c0041e51e755a2ec /src
parentb4e491a675f038f5dabfbe69edca3d7e2ef511f6 (diff)
Fixup APIENTRY macro on Apple
The version of glut.h that ships on Mac OSX undefines the APIENTRY macro. APIENTRY is used on Windows builds to specify that GL functions use the __stdcall calling convention, so it needs to be defined to be the empty string on Mac OSX. Previously this hasn't been a problem because all of the GL function prototypes and typedefs are finished by the time glut.h is included. However, when we switch to using piglit-dispatch instead of GLEW, there will be at least one compilation unit (piglit-dispatch.c) which needs to use the APIENTRY macro after including glut.h. This patch works around the problem by redefining APIENTRY to the correct value (which is the empty string) after including glut.h on Apple builds.
Diffstat (limited to 'src')
1 files changed, 7 insertions, 0 deletions
diff --git a/src/piglit/glut_wrap.h b/src/piglit/glut_wrap.h
index c2ff532a..e28bac95 100644
--- a/src/piglit/glut_wrap.h
+++ b/src/piglit/glut_wrap.h
@@ -45,6 +45,13 @@ extern "C" {
#ifdef USE_GLUT
# ifdef __APPLE__
# include <GLUT/glut.h>
+ /* Apple's version of glut.h, annoyingly, #undefs
+ * APIENTRY. Redefine it so that Piglit code that
+ * uses it won't get confused.
+ */
+# define APIENTRY
# else
# include <GL/glut.h>
# ifdef FREEGLUT