[patch #2] fix C++ warning bootstrap failure on sparc

Gabriel Dos Reis gdr@integrable-solutions.net
Sun Jul 6 04:32:00 GMT 2008


On Sat, Jul 5, 2008 at 3:58 PM, Andreas Tobler <andreast-list@fgznet.ch> wrote:
> Hi all,
>
> second attempt to fix this bootstrap failure on solaris.
>
> Ok?
>
> Thanks,
> Andreas
>
> 2008-07-05  Andreas Tobler  <a.tobler@schweiz.org>
>
>        * configure.ac: Check for caddr_t, define to char * if not defined.
>        * configure: Regenerate.
>        * 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: configure.ac
> ===================================================================
> --- configure.ac        (revision 137510)
> +++ configure.ac        (working copy)
> @@ -1010,6 +1010,7 @@
>  fi
>
>  AC_CHECK_TYPE(ssize_t, int)
> +AC_CHECK_TYPE(caddr_t, char *)
>
>  # Try to determine the array type of the second argument of getgroups
>  # for the target system (int or gid_t).
> Index: ggc-common.c
> ===================================================================
> --- ggc-common.c        (revision 137510)
> +++ 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: config/host-solaris.c
> ===================================================================
> --- config/host-solaris.c       (revision 137510)
> +++ 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);
>     }
>
>

Looks good to me.  But, you would need a SPARC maintainer approval too.

-- Gaby



More information about the Gcc-patches mailing list