From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16549 invoked by alias); 20 Nov 2012 01:06:22 -0000 Received: (qmail 16476 invoked by uid 22791); 20 Nov 2012 01:06:21 -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 01:06:15 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1TacI2-0003iB-7S from joseph_myers@mentor.com for libc-ports@sourceware.org; Mon, 19 Nov 2012 17:06:14 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 19 Nov 2012 17:06:13 -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 01:06:12 +0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.76) (envelope-from ) id 1TacHz-0000cK-5P for libc-ports@sourceware.org; Tue, 20 Nov 2012 01:06:11 +0000 Date: Tue, 20 Nov 2012 01:06:00 -0000 From: "Joseph S. Myers" To: Subject: Fix warnings from aborting MIPS atomic macros 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/msg00072.txt.bz2 The MIPS atomic macros contain versions that abort for unsupported sizes for atomic operations (8-bit, 16-bit; 64-bit for o32). These result in compiler warnings from the "__prev = __cmp = 0" assignments, when __prev is of pointer type but __cmp = 0 is of integer type. I've applied this patch to fix this by separating the two assignments (since assigning constant 0 to both integer and pointer variables is always fine), which in turn requires a cast of __cmp to (void) to avoid "set but not used" warnings for that variable. This reduces the number of warnings I see in MIPS glibc builds (with GCC 4.7) to below 100 for each of the three ABIs. 2012-11-20 Joseph Myers * sysdeps/mips/bits/atomic.h [!__GNUC_PREREQ (4, 8)] (__arch_compare_and_exchange_xxx_8_int): Separate assignments to __prev and __cmp. Cast __cmp to void. [!__GNUC_PREREQ (4, 8)] (__arch_compare_and_exchange_xxx_16_int): Likewise. [!__GNUC_PREREQ (4, 8) && _MIPS_SIM == _ABIO32] (__arch_compare_and_exchange_xxx_64_int): Likewise. diff --git a/ports/sysdeps/mips/bits/atomic.h b/ports/sysdeps/mips/bits/atomic.h index c5a26b9..3466df7 100644 --- a/ports/sysdeps/mips/bits/atomic.h +++ b/ports/sysdeps/mips/bits/atomic.h @@ -209,10 +209,10 @@ typedef uintmax_t uatomic_max_t; in which values are returned. */ # define __arch_compare_and_exchange_xxx_8_int(mem, newval, oldval, rel, acq) \ - (abort (), __prev = __cmp = 0) + (abort (), __prev = 0, __cmp = 0, (void) __cmp) # define __arch_compare_and_exchange_xxx_16_int(mem, newval, oldval, rel, acq) \ - (abort (), __prev = __cmp = 0) + (abort (), __prev = 0, __cmp = 0, (void) __cmp) # define __arch_compare_and_exchange_xxx_32_int(mem, newval, oldval, rel, acq) \ __asm__ __volatile__ ( \ @@ -236,7 +236,7 @@ typedef uintmax_t uatomic_max_t; # if _MIPS_SIM == _ABIO32 /* We can't do an atomic 64-bit operation in O32. */ # define __arch_compare_and_exchange_xxx_64_int(mem, newval, oldval, rel, acq) \ - (abort (), __prev = __cmp = 0) + (abort (), __prev = 0, __cmp = 0, (void) __cmp) # else # define __arch_compare_and_exchange_xxx_64_int(mem, newval, oldval, rel, acq) \ __asm__ __volatile__ ("\n" \ -- Joseph S. Myers joseph@codesourcery.com