From patchwork Sat Mar 9 15:02:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 226337 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 A1D862C034F for ; Sun, 10 Mar 2013 02:03:09 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1363446190; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Message-ID:Date:From:User-Agent:MIME-Version: To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=Lrduo9/x2DOr/iGuh6htVthbjxY=; b=YsKcDoh6IzfA4jA IzaEjgke85q/rZ5f3I/Jd5dXhVbACrHn8sBH+SPLYdVajbw84FUeRdN9p2mG6CwS PbDtFjUYPlf1fsO1qBy4UykeHEDKLaPvj0S9pX1NxwnKRw3G+caHJy4mvBX5Jzen L5XAh04DiZpmXtwlmKLmdf2nWfug= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Q8fuf2h7m9CHtm/rHk54PxAKOvv8acTjpp1usj6f4eiwKasmewhYhZTMyTadhi Iz5w8zjUmADeCXd1CLlqLj7GuaY00XriOG+ZXDmiWDTNNep6JHgJeYJtNUu6KOLZ Okh1O4tinlvnKekD3mP2tX1bPlL2CUOdCEyCL3qj07Hic=; Received: (qmail 16595 invoked by alias); 9 Mar 2013 15:02:55 -0000 Received: (qmail 16558 invoked by uid 22791); 9 Mar 2013 15:02:52 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 09 Mar 2013 15:02:42 +0000 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r29F2eFm024359 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 9 Mar 2013 15:02:41 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r29F2eTo019674 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 9 Mar 2013 15:02:40 GMT Received: from abhmt105.oracle.com (abhmt105.oracle.com [141.146.116.57]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r29F2dUR022879; Sat, 9 Mar 2013 09:02:39 -0600 Received: from [192.168.1.4] (/79.33.221.193) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 09 Mar 2013 07:02:39 -0800 Message-ID: <513B4F0D.40100@oracle.com> Date: Sat, 09 Mar 2013 16:02:37 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] Tweak a recent testcase vs -Wunused X-IsSubscribed: yes 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 Hi, just avoid spurious fails with -Wunused (or -Wall -Wno-unused-local-typdefs, which is what I often actually try). Thanks, Paolo. //////////////////// 2013-03-09 Paolo Carlini * testsuite/20_util/function_objects/mem_fn/55463.cc: Avoid -Wunused warnings. Index: testsuite/20_util/function_objects/mem_fn/55463.cc =================================================================== --- testsuite/20_util/function_objects/mem_fn/55463.cc (revision 196571) +++ testsuite/20_util/function_objects/mem_fn/55463.cc (working copy) @@ -50,59 +50,63 @@ void test01() { - int& i1 = std::mem_fn( &X::func )( X() ); - int& i2 = std::mem_fn( &X::func )( Y() ); - int& i3 = std::mem_fn( &X::func )( ref() ); - int& i4 = std::mem_fn( &X::func )( yref() ); - int& i5 = std::mem_fn( &X::func )( X_ptr() ); - int& i6 = std::mem_fn( &X::func )( smart_ptr() ); + int& i1 __attribute__((unused)) = std::mem_fn( &X::func )( X() ); + int& i2 __attribute__((unused)) = std::mem_fn( &X::func )( Y() ); + int& i3 __attribute__((unused)) = std::mem_fn( &X::func )( ref() ); + int& i4 __attribute__((unused)) = std::mem_fn( &X::func )( yref() ); + int& i5 __attribute__((unused)) = std::mem_fn( &X::func )( X_ptr() ); + int& i6 __attribute__((unused)) = std::mem_fn( &X::func )( smart_ptr() ); - char& c1 = std::mem_fn( &X::func_c )( X() ); - char& c2 = std::mem_fn( &X::func_c )( CX() ); - char& c3 = std::mem_fn( &X::func_c )( Y() ); - char& c4 = std::mem_fn( &X::func_c )( ref() ); - char& c5 = std::mem_fn( &X::func_c )( cref() ); - char& c6 = std::mem_fn( &X::func_c )( yref() ); - char& c7 = std::mem_fn( &X::func_c )( X_ptr() ); - char& c8 = std::mem_fn( &X::func_c )( smart_ptr() ); + char& c1 __attribute__((unused)) = std::mem_fn( &X::func_c )( X() ); + char& c2 __attribute__((unused)) = std::mem_fn( &X::func_c )( CX() ); + char& c3 __attribute__((unused)) = std::mem_fn( &X::func_c )( Y() ); + char& c4 __attribute__((unused)) = std::mem_fn( &X::func_c )( ref() ); + char& c5 __attribute__((unused)) = std::mem_fn( &X::func_c )( cref() ); + char& c6 __attribute__((unused)) = std::mem_fn( &X::func_c )( yref() ); + char& c7 __attribute__((unused)) = std::mem_fn( &X::func_c )( X_ptr() ); + char& c8 __attribute__((unused)) = std::mem_fn( &X::func_c )( smart_ptr() ); - short& s1 = std::mem_fn( &X::func_v )( X() ); - short& s2 = std::mem_fn( &X::func_v )( Y() ); - short& s3 = std::mem_fn( &X::func_v )( ref() ); - short& s4 = std::mem_fn( &X::func_v )( yref() ); - short& s5 = std::mem_fn( &X::func_v )( X_ptr() ); - short& s6 = std::mem_fn( &X::func_v )( smart_ptr() ); + short& s1 __attribute__((unused)) = std::mem_fn( &X::func_v )( X() ); + short& s2 __attribute__((unused)) = std::mem_fn( &X::func_v )( Y() ); + short& s3 __attribute__((unused)) = std::mem_fn( &X::func_v )( ref() ); + short& s4 __attribute__((unused)) = std::mem_fn( &X::func_v )( yref() ); + short& s5 __attribute__((unused)) = std::mem_fn( &X::func_v )( X_ptr() ); + short& s6 __attribute__((unused)) = std::mem_fn( &X::func_v )( smart_ptr() ); - double& d1 = std::mem_fn( &X::func_cv )( X() ); - double& d2 = std::mem_fn( &X::func_cv )( CX() ); - double& d3 = std::mem_fn( &X::func_cv )( Y() ); - double& d4 = std::mem_fn( &X::func_cv )( ref() ); - double& d5 = std::mem_fn( &X::func_cv )( cref() ); - double& d6 = std::mem_fn( &X::func_cv )( yref() ); - double& d7 = std::mem_fn( &X::func_cv )( X_ptr() ); - double& d8 = std::mem_fn( &X::func_cv )( smart_ptr() ); + double& d1 __attribute__((unused)) = std::mem_fn( &X::func_cv )( X() ); + double& d2 __attribute__((unused)) = std::mem_fn( &X::func_cv )( CX() ); + double& d3 __attribute__((unused)) = std::mem_fn( &X::func_cv )( Y() ); + double& d4 __attribute__((unused)) = std::mem_fn( &X::func_cv )( ref() ); + double& d5 __attribute__((unused)) = std::mem_fn( &X::func_cv )( cref() ); + double& d6 __attribute__((unused)) = std::mem_fn( &X::func_cv )( yref() ); + double& d7 __attribute__((unused)) = std::mem_fn( &X::func_cv )( X_ptr() ); + double& d8 __attribute__((unused)) + = std::mem_fn( &X::func_cv )( smart_ptr() ); // [expr.mptr.oper] // The result of a .* expression whose second operand is a pointer to a // data member is of the same value category (3.10) as its first operand. - int&& rval = std::mem_fn( &X::data )( X() ); - const int&& crval = std::mem_fn( &X::data )( CX() ); - int&& yrval = std::mem_fn( &X::data )( Y() ); - const int&& ycrval = std::mem_fn( &X::data )( CY() ); + int&& rval __attribute__((unused)) = std::mem_fn( &X::data )( X() ); + const int&& crval __attribute__((unused)) = std::mem_fn( &X::data )( CX() ); + int&& yrval __attribute__((unused)) = std::mem_fn( &X::data )( Y() ); + const int&& ycrval __attribute__((unused)) = std::mem_fn( &X::data )( CY() ); - int& val = std::mem_fn( &X::data )( ref() ); - const int& cval = std::mem_fn( &X::data )( cref() ); - int& yval = std::mem_fn( &X::data )( yref() ); + int& val __attribute__((unused)) = std::mem_fn( &X::data )( ref() ); + const int& cval __attribute__((unused)) = std::mem_fn( &X::data )( cref() ); + int& yval __attribute__((unused)) = std::mem_fn( &X::data )( yref() ); - int& pval = std::mem_fn( &X::data )( X_ptr() ); - int& sval = std::mem_fn( &X::data )( smart_ptr() ); + int& pval __attribute__((unused)) = std::mem_fn( &X::data )( X_ptr() ); + int& sval __attribute__((unused)) = std::mem_fn( &X::data )( smart_ptr() ); } void test02() { std::reference_wrapper r = ref(); - X& x1 = std::mem_fn( &std::reference_wrapper::get )( r ); + X& x1 __attribute__((unused)) + = std::mem_fn( &std::reference_wrapper::get )( r ); const std::reference_wrapper cr = ref(); - const X& x3 = std::mem_fn( &std::reference_wrapper::get )( cr ); - X& x2 = std::mem_fn( &std::reference_wrapper::get )( ref() ); + const X& x3 __attribute__((unused)) + = std::mem_fn( &std::reference_wrapper::get )( cr ); + X& x2 __attribute__((unused)) + = std::mem_fn( &std::reference_wrapper::get )( ref() ); }