[PATCH] xfree86: Fix powerpc build with -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast

Jeremy Huddleston jeremyhu at apple.com
Tue Nov 1 15:05:12 PDT 2011


While this does fix the build failure, I'd much rather change memType to be a uintptr_t everywhere, but it was explicitly set to uint64_t for 32bit powerpc by Ian in the commit referenced below.  Ian, can you explain why you set memType to 64bits even though void * is only 32bits?  You referenced ppc32 code running on ppc64, but I don't see why that would be problematic.

commit e18d34f4238e13e226b0407fa2f5f77d2038de39
Author: Ian Romanick <idr at umwelt.(none)>
Date:   Fri Jul 21 16:47:45 2006 -0700

    Make the various implementations of xf86ExtendedInitInt10 use the
    libpciaccess interfaces.  This eliminates all calls to mapPciRom,
    which in turn allows the elimination of hw/xfree86/int10/pci.c.


On Nov 1, 2011, at 3:01 PM, Jeremy Huddleston wrote:

> memType is a uint64_t on powerpc
> 
> Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
> ---
> hw/xfree86/os-support/linux/lnx_video.c |    6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/xfree86/os-support/linux/lnx_video.c b/hw/xfree86/os-support/linux/lnx_video.c
> index 3d45511..c12a654 100644
> --- a/hw/xfree86/os-support/linux/lnx_video.c
> +++ b/hw/xfree86/os-support/linux/lnx_video.c
> @@ -469,11 +469,11 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
> static void
> unmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
> {
> -    memType alignOff = (memType)Base 
> -	- ((memType)Base & ~(getpagesize() - 1));
> +    memType alignOff = (memType)(uintptr_t)Base 
> +	- ((memType)(uintptr_t)Base & ~(getpagesize() - 1));
> 
>     DebugF("alignment offset: %lx\n",alignOff);
> -    munmap((caddr_t)((memType)Base - alignOff), (Size + alignOff));
> +    munmap((void *)(uintptr_t)((memType)(uintptr_t)Base - alignOff), (Size + alignOff));
> }
> 
> 
> -- 
> 1.7.7



More information about the xorg-devel mailing list