This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] fix C++ warning bootstrap on sparc


Hello all,

the attached patch fixes bootstrap on sparc solaris and I assume also on x86 solaris.

It has been tested on sparc-solaris2.8/10, darwin-x86/ppc, linux-ppc and hppa2.0w-hp-hpux11.11/hppa64--hp-hpux11.11.

I'm not sure if the caddr_t is available everywhere. If not we might need to add configury magic.

Ok for main if caddr_t is available everywhere?

Thanks,
Andreas

And thanks to Kaveh for pointing me in the right direction.

2008-07-01 Andreas Tobler <a.tobler@schweiz.org>

	* ggc-common.c (mmap_gt_pch_get_address): Fix -Wc++-compat warnings.
	(mmap_gt_pch_use_address): Likewise.
	* config/host-solaris.c (sol_gt_pch_use_address): Likewise.
Index: config/host-solaris.c
===================================================================
--- config/host-solaris.c	(revision 137257)
+++ config/host-solaris.c	(working copy)
@@ -42,7 +42,7 @@
   if (size == 0)
     return -1;
 
-  addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE,
+  addr = mmap ((caddr_t) base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE,
 	       fd, offset);
 
   /* Solaris isn't good about honoring the mmap START parameter
@@ -55,18 +55,18 @@
       size_t i;
 
       if (addr != (void *) MAP_FAILED)
-	munmap (addr, size);
+	munmap ((caddr_t) addr, size);
 
       errno = 0;
       for (i = 0; i < size; i += page_size)
-	if (mincore ((char *)base + i, page_size, (void *)&one_byte) == -1
+	if (mincore ((char *)base + i, page_size, (char *) &one_byte) == -1
 	    && errno == ENOMEM)
 	  continue; /* The page is not mapped.  */
 	else
 	  break;
 
       if (i >= size)
-	addr = mmap (base, size, 
+	addr = mmap ((caddr_t) base, size, 
 		     PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED,
 		     fd, offset);
     }
Index: ggc-common.c
===================================================================
--- ggc-common.c	(revision 137257)
+++ ggc-common.c	(working copy)
@@ -638,7 +638,7 @@
   if (ret == (void *) MAP_FAILED)
     ret = NULL;
   else
-    munmap (ret, size);
+    munmap ((caddr_t) ret, size);
 
   return ret;
 }
@@ -662,7 +662,7 @@
   if (size == 0)
     return -1;
 
-  addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE,
+  addr = mmap ((caddr_t) base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE,
 	       fd, offset);
 
   return addr == base ? 1 : -1;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]