> >>>find a patch attached that fixes all remaining strict-aliasing problems
> >>>when compiling Mesa with gcc 4 (at least for me).
> >>
> >>Are you sure you've got the #ifdef logic correct?
Actually, no. And I didn't recognize what you were referring to until
today...
You are right, it should have been the other way round.
However, I dug a little bit deeper, and found that even the interface
(in glut/glx/glutint.h) only wants to get a void **, and as we do not
have to access the fbconfig anyway, I patched everything to be void **.
This compiles cleanly.
> >>#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig)
> >>typedef void *fbc_t;
> >>#else
> >>typedef GLXFBConfigSGIX fbc_t;
> >>#endif
> >>
> >>I would expect that the proper test would be:
> >>
> >>#if defined(GLX_SGIX_fbconfig)
> >>typedef GLXFBConfigSGIX fbc_t;
> >>#else
> >>typedef void *fbc_t;
> >>#endif
I still keep the test for GLX_VERSION_1_1. It shouldn't hurt, and maybe
there are some subtle flaws in old header files.
> Would mind creating a new patch? I don't have any time to do so.
> -Brian
I know, this took much longer than it should, however, here's finnally
the updated patch.
Thanks
Matthias
--
Matthias Hopf <[EMAIL PROTECTED]> __ __ __
Maxfeldstr. 5 / 90409 Nuernberg (_ | | (_ |__ [EMAIL PROTECTED]
Phone +49-911-74053-715 __) |_| __) |__ labs www.mshopf.de
Index: src/glut/glx/glut_dstr.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/glut/glx/glut_dstr.c,v
retrieving revision 1.5
diff -u -p -r1.5 glut_dstr.c
--- src/glut/glx/glut_dstr.c 12 Feb 2003 23:56:23 -0000 1.5
+++ src/glut/glx/glut_dstr.c 1 Sep 2005 16:30:17 -0000
@@ -1530,11 +1530,7 @@ main(int argc, char **argv)
char *str, buffer[1024];
int tty = isatty(fileno(stdin));
int overlay = 0, showconfig = 0;
-#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig)
- GLXFBConfigSGIX fbc;
-#else
void *fbc;
-#endif
#if !defined(_WIN32)
dpy = XOpenDisplay(NULL);
@@ -1563,10 +1559,10 @@ main(int argc, char **argv)
} else {
if (overlay) {
vinfo = getVisualInfoFromString(str, &treatAsSingle,
- requiredOverlayCriteria, numRequiredOverlayCriteria,
requiredOverlayCriteriaMask, (void**) &fbc);
+ requiredOverlayCriteria, numRequiredOverlayCriteria,
requiredOverlayCriteriaMask, &fbc);
} else {
vinfo = getVisualInfoFromString(str, &treatAsSingle,
- requiredWindowCriteria, numRequiredWindowCriteria,
requiredWindowCriteriaMask, (void**) &fbc);
+ requiredWindowCriteria, numRequiredWindowCriteria,
requiredWindowCriteriaMask, &fbc);
}
if (vinfo) {
printf("\n");
Index: src/glut/glx/glut_overlay.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/glut/glx/glut_overlay.c,v
retrieving revision 1.4
diff -u -p -r1.4 glut_overlay.c
--- src/glut/glx/glut_overlay.c 12 Feb 2003 23:56:23 -0000 1.4
+++ src/glut/glx/glut_overlay.c 1 Sep 2005 16:30:17 -0000
@@ -362,11 +362,7 @@ glutEstablishOverlay(void)
GLUToverlay *overlay;
GLUTwindow *window;
XSetWindowAttributes wa;
-#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig)
- GLXFBConfigSGIX fbc;
-#else
void *fbc;
-#endif
/* Register a routine to free an overlay with glut_win.c;
this keeps glut_win.c from pulling in all of
@@ -389,7 +385,7 @@ glutEstablishOverlay(void)
__glutFatalError("out of memory.");
overlay->vis = determineOverlayVisual(&overlay->treatAsSingle,
- &overlay->visAlloced, (void **) &fbc);
+ &overlay->visAlloced, &fbc);
if (!overlay->vis) {
__glutFatalError("lacks overlay support.");
}
Index: src/glut/glx/glut_win.c
===================================================================
RCS file: /cvs/mesa/Mesa/src/glut/glx/glut_win.c,v
retrieving revision 1.6
diff -u -p -r1.6 glut_win.c
--- src/glut/glx/glut_win.c 12 Feb 2003 23:56:23 -0000 1.6
+++ src/glut/glx/glut_win.c 1 Sep 2005 16:30:17 -0000
@@ -30,7 +30,7 @@ GLUTwindow *__glutMenuWindow = NULL;
void (*__glutFreeOverlayFunc) (GLUToverlay *);
XVisualInfo *(*__glutDetermineVisualFromString) (char *string, Bool *
treatAsSingle,
- Criterion * requiredCriteria, int nRequired, int requiredMask, void** fbc) =
NULL;
+ Criterion * requiredCriteria, int nRequired, int requiredMask, void **fbc) =
NULL;
static Criterion requiredWindowCriteria[] =
{
@@ -471,11 +471,7 @@ __glutCreateWindow(GLUTwindow * parent,
unsigned long attribMask;
int winnum;
int i;
-#if defined(GLX_VERSION_1_1) && defined(GLX_SGIX_fbconfig)
- GLXFBConfigSGIX fbc;
-#else
void *fbc;
-#endif
#if defined(_WIN32)
WNDCLASS wc;
@@ -501,7 +497,7 @@ __glutCreateWindow(GLUTwindow * parent,
#if !defined(_WIN32)
window->vis = __glutDetermineWindowVisual(&window->treatAsSingle,
- &window->visAlloced, (void**) &fbc);
+ &window->visAlloced, &fbc);
if (!window->vis) {
__glutFatalError(
"visual with necessary capabilities not found.");