Hi,

I had trouble when compiling DRI with g++ 3.0.4 and -O3 related to
function inlining. The function swap is declared static globally in
quicksort.cc. In function quicksort it is redeclared. The redeclaration
prevents g++ from inlining the swap function. Instead it emits function
calls. In contrast to g++ 2.95 the 3.0.4 compiler did not keep a copy of
swap. I assume that it does not relate the global and the local
declaration to the same function. This leads to an undefined symbol as
soon as a program using libGLU (like TuxRacer) was started.

The fix is simple. Just leave out the useless local redeclaration of
swap. This allows inlining the swap function in both 2.95 and 3.0.4.
Note I checked all this in the assembler output. I'm just not sure
whether the problem should be regarded a g++ bug or not.

The patch is attached.

Regards,
    Felix Kühling

               __\|/__    ___     ___     ___
__Tschüß_______\_6 6_/___/__ \___/__ \___/___\___You can do anything,___
_____Felix_______\Ä/\ \_____\ \_____\ \______U___just not everything____
  [EMAIL PROTECTED]    >o<__/   \___/   \___/        at the same time!
--- xc/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/quicksort.cc.orig       
 Thu May 23 22:12:51 2002
+++ xc/xc/extras/ogl-sample/main/gfx/lib/glu/libnurbs/nurbtess/quicksort.cc     Thu 
+May 23 22:12:59 2002
@@ -58,7 +58,6 @@
               int (*comp) (void *, void *))
 {
   int i, last;
-  void swap(void *v[], int , int);
   if(left >= right) /*do nothing if array contains */
     return;         /*fewer than two elements*/
   

Reply via email to