On Thu, May 23, 2002 at 10:44:20PM +0200, Felix Kühling wrote:
>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.

Here's the patch used in the XFree86 CVS:

David
--
--- quicksort.cc        2001/01/15 21:48:59     1.1.1.1
+++ quicksort.cc        2002/01/23 17:06:18     1.2
@@ -58,7 +61,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*/
   
@@ -72,7 +74,7 @@
   quicksort(v, last+1, right, comp);
 }
 
-void swap(void *v[], int i, int j)
+static void swap(void *v[], int i, int j)
 {
   void *temp;
   temp = v[i];

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to