From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20992 invoked by alias); 20 Nov 2012 02:41:08 -0000 Received: (qmail 20922 invoked by uid 22791); 20 Nov 2012 02:41:07 -0000 X-SWARE-Spam-Status: No, hits=-4.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Nov 2012 02:40:58 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1Tadlh-0007DB-Hw from joseph_myers@mentor.com for libc-ports@sourceware.org; Mon, 19 Nov 2012 18:40:57 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 19 Nov 2012 18:40:57 -0800 Received: from digraph.polyomino.org.uk (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.1.289.1; Tue, 20 Nov 2012 02:40:55 +0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.76) (envelope-from ) id 1Tadle-0001R1-3Q for libc-ports@sourceware.org; Tue, 20 Nov 2012 02:40:54 +0000 Date: Tue, 20 Nov 2012 02:41:00 -0000 From: "Joseph S. Myers" To: Subject: Fix int-to-pointer-cast warnings for MIPS Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2012-11/txt/msg00073.txt.bz2 MIPS glibc builds for n32 and o32 ABIs produce various -Wint-to-pointer-cast warnings because of converting 64-bit integers to 32-bit pointers (even on o32, certain structures use 64-bit fields for registers to match the kernel). I've applied this patch to fix these warnings by inserting appropriate intermediate casts to an integer type of the same size as pointers. 2012-11-20 Joseph Myers * sysdeps/mips/jmpbuf-unwind.h (_JMPBUF_CFA_UNWINDS_ADJ): Cast _Unwind_GetCFA return to _Unwind_Ptr before casting to a pointer type. * sysdeps/unix/sysv/linux/mips/____longjmp_chk.c (CHECK_SP): Cast ss_sp to long before casting to sp_type. * sysdeps/unix/sysv/linux/mips/sigcontextinfo.h [_MIPS_SIM == _ABIO32] (GET_PC): Cast to unsigned long before casting to a pointer type. [_MIPS_SIM == _ABIO32] (GET_FRAME): Likewise. [_MIPS_SIM == _ABIO32] (GET_STACK): Likewise. [_MIPS_SIM != _ABIO32] (GET_PC): Likewise. [_MIPS_SIM != _ABIO32] (GET_FRAME): Likewise. [_MIPS_SIM != _ABIO32] (GET_STACK): Likewise. diff --git a/ports/sysdeps/mips/jmpbuf-unwind.h b/ports/sysdeps/mips/jmpbuf-unwind.h index 31c9c8d..ba174d6 100644 --- a/ports/sysdeps/mips/jmpbuf-unwind.h +++ b/ports/sysdeps/mips/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2003-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,8 +25,10 @@ #define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ ((void *) (address) < (void *) demangle ((jmpbuf)[0].__sp)) -#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ - _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ + _JMPBUF_UNWINDS_ADJ (_jmpbuf, \ + (void *) (_Unwind_Ptr) _Unwind_GetCFA (_context), \ + _adj) static inline uintptr_t __attribute__ ((unused)) _jmpbuf_sp (__jmp_buf regs) diff --git a/ports/sysdeps/unix/sysv/linux/mips/____longjmp_chk.c b/ports/sysdeps/unix/sysv/linux/mips/____longjmp_chk.c index d8da270..943b404 100644 --- a/ports/sysdeps/unix/sysv/linux/mips/____longjmp_chk.c +++ b/ports/sysdeps/unix/sysv/linux/mips/____longjmp_chk.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Free Software Foundation, Inc. +/* Copyright (C) 2009-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ int ret = __sigaltstack (NULL, &ss); \ if (ret == 0 \ && (!(ss.ss_flags & SS_ONSTACK) \ - || ((unsigned sp_type) ((sp_type) ss.ss_sp \ + || ((unsigned sp_type) ((sp_type) (long) ss.ss_sp \ + (sp_type) ss.ss_size \ - sp_saved) \ < ss.ss_size))) \ diff --git a/ports/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h b/ports/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h index 9edde21..7793e21 100644 --- a/ports/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h +++ b/ports/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2000-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger , 2000. @@ -23,9 +23,9 @@ #define SIGCONTEXT unsigned long _code, struct sigcontext * #define SIGCONTEXT_EXTRA_ARGS _code, -#define GET_PC(ctx) ((void *) ctx->sc_pc) -#define GET_FRAME(ctx) ((void *) ctx->sc_regs[30]) -#define GET_STACK(ctx) ((void *) ctx->sc_regs[29]) +#define GET_PC(ctx) ((void *) (unsigned long) ctx->sc_pc) +#define GET_FRAME(ctx) ((void *) (unsigned long) ctx->sc_regs[30]) +#define GET_STACK(ctx) ((void *) (unsigned long) ctx->sc_regs[29]) #define CALL_SIGHANDLER(handler, signo, ctx) \ (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) @@ -33,9 +33,9 @@ #define SIGCONTEXT unsigned long _code, ucontext_t * #define SIGCONTEXT_EXTRA_ARGS _code, -#define GET_PC(ctx) ((void *) ctx->uc_mcontext.pc) -#define GET_FRAME(ctx) ((void *) ctx->uc_mcontext.gregs[30]) -#define GET_STACK(ctx) ((void *) ctx->uc_mcontext.gregs[29]) +#define GET_PC(ctx) ((void *) (unsigned long) ctx->uc_mcontext.pc) +#define GET_FRAME(ctx) ((void *) (unsigned long) ctx->uc_mcontext.gregs[30]) +#define GET_STACK(ctx) ((void *) (unsigned long) ctx->uc_mcontext.gregs[29]) #define CALL_SIGHANDLER(handler, signo, ctx) \ (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) -- Joseph S. Myers joseph@codesourcery.com