From patchwork Fri Aug 6 20:04:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Green X-Patchwork-Id: 61152 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id F20B9B6EEE for ; Sat, 7 Aug 2010 06:05:08 +1000 (EST) Received: (qmail 25294 invoked by alias); 6 Aug 2010 20:05:04 -0000 Received: (qmail 24719 invoked by uid 22791); 6 Aug 2010 20:04:59 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_BF, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Aug 2010 20:04:54 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o76K4q0I030755 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 6 Aug 2010 16:04:52 -0400 Received: from gmachine.redhat.com (vpn-10-245.rdu.redhat.com [10.11.10.245]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o76K4oV3027003; Fri, 6 Aug 2010 16:04:51 -0400 From: Anthony Green To: gcc-patches@gcc.gnu.org Subject: [patch, libffi] Remove warnings User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-URL: http://www.redhat.com Date: Fri, 06 Aug 2010 16:04:50 -0400 Message-ID: MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org I'm checking in the following libffi patch. This patch from Dan Witte cleans up a number of build warnings. Thanks, AG 2010-04-13 Dan Witte * msvcc.sh: Build with -W3 instead of -Wall. * src/powerpc/ffi_darwin.c: Remove build warnings. * src/x86/ffi.c: Ditto. * src/x86/ffitarget.h: Ditto. Index: libffi/msvcc.sh =================================================================== --- libffi.orig/msvcc.sh +++ libffi/msvcc.sh @@ -42,7 +42,7 @@ # format and translated into something sensible for cl or ml. # -args="-nologo -W3" +args="-nologo" md=-MD cl="cl" ml="ml" @@ -108,7 +108,8 @@ do shift 1 ;; -Wall) - args="$args -Wall" + # -Wall on MSVC is overzealous. Use -W3 instead. + args="$args -W3" shift 1 ;; -Werror) Index: libffi/src/powerpc/ffi_darwin.c =================================================================== --- libffi.orig/src/powerpc/ffi_darwin.c +++ libffi/src/powerpc/ffi_darwin.c @@ -344,7 +344,7 @@ ffi_status ffi_prep_cif_machdep (ffi_cif *cif) { /* All this is for the DARWIN ABI. */ - int i; + unsigned i; ffi_type **ptr; unsigned bytes; int fparg_count = 0, intarg_count = 0; @@ -542,11 +542,11 @@ ffi_call (ffi_cif *cif, void (*fn)(void) { case FFI_AIX: ffi_call_AIX(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, - ffi_prep_args); + FFI_FN(ffi_prep_args)); break; case FFI_DARWIN: ffi_call_DARWIN(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, - ffi_prep_args); + FFI_FN(ffi_prep_args)); break; default: FFI_ASSERT(0); @@ -799,9 +799,9 @@ ffi_closure_helper_DARWIN (ffi_closure * if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN (arg_types[i]->size, 8); if (size_al < 3 && cif->abi == FFI_DARWIN) - avalue[i] = (void *) pgr + 8 - size_al; + avalue[i] = (char *) pgr + 8 - size_al; else - avalue[i] = (void *) pgr; + avalue[i] = pgr; pgr += (size_al + 7) / 8; #else /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, @@ -812,9 +812,9 @@ ffi_closure_helper_DARWIN (ffi_closure * if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN(arg_types[i]->size, 8); if (size_al < 3 && cif->abi == FFI_DARWIN) - avalue[i] = (void*) pgr + 4 - size_al; + avalue[i] = (char*) pgr + 4 - size_al; else - avalue[i] = (void*) pgr; + avalue[i] = pgr; pgr += (size_al + 3) / 4; #endif break; Index: libffi/src/x86/ffi.c =================================================================== --- libffi.orig/src/x86/ffi.c +++ libffi/src/x86/ffi.c @@ -209,7 +209,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif #endif { cif->flags = FFI_TYPE_STRUCT; - // allocate space for return value pointer + /* allocate space for return value pointer */ cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG); } break; @@ -234,7 +234,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif } #ifdef X86_WIN64 - // ensure space for storing four registers + /* ensure space for storing four registers */ cif->bytes += 4 * sizeof(ffi_arg); #endif @@ -292,8 +292,8 @@ void ffi_call(ffi_cif *cif, void (*fn)(v #ifdef X86_WIN64 case FFI_WIN64: { - // Make copies of all struct arguments - // NOTE: not sure if responsibility should be here or in caller + /* Make copies of all struct arguments + NOTE: not sure if responsibility should be here or in caller */ unsigned int i; for (i=0; i < cif->nargs;i++) { size_t size = cif->arg_types[i]->size; Index: libffi/src/x86/ffitarget.h =================================================================== --- libffi.orig/src/x86/ffitarget.h +++ libffi/src/x86/ffitarget.h @@ -38,7 +38,7 @@ #ifdef X86_WIN64 #define FFI_SIZEOF_ARG 8 -#define USE_BUILTIN_FFS 0 // not yet implemented in mingw-64 +#define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ #endif /* ---- Generic type definitions ----------------------------------------- */