Re: Mesa strict aliasing probs fixed

2005-09-02 Thread Brian Paul

Matthias Hopf wrote:

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.  I've checked it in.

-Brian


---
SF.Net email is Sponsored by the Better Software Conference  EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile  Plan-Driven Development * Managing Projects  Teams * Testing  QA
Security * Process Improvement  Measurement * http://www.sqe.com/bsce5sf
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: Mesa strict aliasing probs fixed

2005-09-01 Thread Matthias Hopf
 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.c12 Feb 2003 23:56:23 -  1.5
+++ src/glut/glx/glut_dstr.c1 Sep 2005 16:30:17 -
@@ -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 -  1.4
+++ src/glut/glx/glut_overlay.c 1 Sep 2005 16:30:17 -
@@ -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 -  1.6
+++ src/glut/glx/glut_win.c 1 Sep 2005 16:30:17 -
@@ -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 

Re: Mesa strict aliasing probs fixed

2005-07-14 Thread Matthias Hopf
 Would mind creating a new patch?  I don't have any time to do so.

Sure. Just don't expect this to happen today.

I'll have a couple of other patches next week, some of which are likely
to be debatable.

Matthias

-- 
Matthias Hopf [EMAIL PROTECTED]   ____   __
Maxfeldstr. 5 / 90409 Nuernberg(_   | |  (_   |__ [EMAIL PROTECTED]
Phone +49-911-74053-715__)  |_|  __)  |__  labs   www.mshopf.de


---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Mesa strict aliasing probs fixed

2005-07-13 Thread Matthias Hopf
Hi,

find a patch attached that fixes all remaining strict-aliasing problems
when compiling Mesa with gcc 4 (at least for me).

CU all

Matthias

-- 
Matthias Hopf [EMAIL PROTECTED],  SuSE labs,  Zimmer 3.2.06,  Tel. 74053-715
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.c12 Feb 2003 23:56:23 -  1.5
+++ src/glut/glx/glut_dstr.c8 Jul 2005 17:04:00 -
@@ -34,6 +34,12 @@ static int glxcap[NUM_GLXCAPS] =
   GLX_LEVEL,
 };
 
+#if defined(GLX_VERSION_1_1)  defined(GLX_SGIX_fbconfig)
+typedef void *fbc_t;
+#else
+typedef GLXFBConfigSGIX fbc_t;
+#endif
+
 #ifdef TEST
 
 #if !defined(_WIN32)
@@ -41,7 +47,7 @@ char *__glutProgramName = dstr;
 Display *__glutDisplay;
 int __glutScreen;
 XVisualInfo *(*__glutDetermineVisualFromString) (char *string, Bool * 
treatAsSingle,
-  Criterion * requiredCriteria, int nRequired, int requiredMask, void **fbc) = 
NULL;
+  Criterion * requiredCriteria, int nRequired, int requiredMask, fbc_t *fbc) = 
NULL;
 char *__glutDisplayString = NULL;
 #endif
 static int verbose = 0;
@@ -626,7 +632,7 @@ loadVisuals(int *nitems_return)
 
 static XVisualInfo *
 findMatch(FrameBufferMode * fbmodes, int nfbmodes,
-  Criterion * criteria, int ncriteria, void **fbc)
+  Criterion * criteria, int ncriteria, fbc_t *fbc)
 {
   FrameBufferMode *found;
   int *bestScore, *thisScore;
@@ -1420,7 +1426,7 @@ static int nfbmodes = 0;
 
 static XVisualInfo *
 getVisualInfoFromString(char *string, Bool * treatAsSingle,
-  Criterion * requiredCriteria, int nRequired, int requiredMask, void **fbc)
+  Criterion * requiredCriteria, int nRequired, int requiredMask, fbc_t *fbc)
 {
   Criterion *criteria;
   XVisualInfo *visinfo;
@@ -1530,11 +1536,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
+  fbc_t *fbc;
 
 #if !defined(_WIN32)
   dpy = XOpenDisplay(NULL);
@@ -1563,10 +1565,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 -  1.4
+++ src/glut/glx/glut_overlay.c 8 Jul 2005 17:04:00 -
@@ -28,6 +28,12 @@
 #include glutint.h
 #include layerutil.h
 
+#if defined(GLX_VERSION_1_1)  defined(GLX_SGIX_fbconfig)
+typedef void *fbc_t;
+#else
+typedef GLXFBConfigSGIX fbc_t;
+#endif
+
 static Criterion requiredOverlayCriteria[] =
 {
   {LEVEL, EQ, 1},   /* This entry gets poked in
@@ -315,7 +321,7 @@ __glutFreeOverlay(GLUToverlay * overlay)
 }
 
 static XVisualInfo *
-determineOverlayVisual(int *treatAsSingle, Bool * visAlloced, void **fbc)
+determineOverlayVisual(int *treatAsSingle, Bool * visAlloced, fbc_t *fbc)
 {
   if (__glutDisplayString) {
 XVisualInfo *vi;
@@ -362,11 +368,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
+  fbc_t *fbc;
 
   /* Register a routine to free an overlay with glut_win.c;
  this keeps glut_win.c from pulling in all of
@@ -389,7 +391,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.);
   }
@@ -567,7 +569,7 @@ glutLayerGet(GLenum param)
 {
   XVisualInfo *vi;
   Bool dummy, visAlloced;
-  void *fbc;
+  fbc_t fbc;
 
   vi = determineOverlayVisual(dummy, visAlloced, fbc);
   if (vi) {
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 -  1.6
+++ 

Re: Mesa strict aliasing probs fixed

2005-07-13 Thread Brian Paul

Matthias Hopf wrote:

Hi,

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?

#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'd probably also replace 'fbc_t' with 'fbconfig_t' to make it more 
readable.


-Brian


---
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: Mesa strict aliasing probs fixed

2005-07-13 Thread Matthias Hopf
On Jul 13, 05 09:16:32 -0600, Brian Paul wrote:
 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?

I just copied the one that was already present and didn't think much
about it.

 #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 would expect that as well. But I wanted a minimal invasive change.
Feel free to change this ;)

 
 I'd probably also replace 'fbc_t' with 'fbconfig_t' to make it more 
 readable.

That's perfectly fine for me.

Thanks

Matthias

-- 
Matthias Hopf [EMAIL PROTECTED]   ____   __
Maxfeldstr. 5 / 90409 Nuernberg(_   | |  (_   |__ [EMAIL PROTECTED]
Phone +49-911-74053-715__)  |_|  __)  |__  labs   www.mshopf.de


---
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel


Re: Mesa strict aliasing probs fixed

2005-07-13 Thread Brian Paul

Matthias Hopf wrote:

On Jul 13, 05 09:16:32 -0600, Brian Paul wrote:


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?



I just copied the one that was already present and didn't think much
about it.



#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 would expect that as well. But I wanted a minimal invasive change.
Feel free to change this ;)


I'd probably also replace 'fbc_t' with 'fbconfig_t' to make it more 
readable.



That's perfectly fine for me.


Would mind creating a new patch?  I don't have any time to do so.

-Brian


---
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
--
___
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel