From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106008 invoked by alias); 23 Jun 2018 21:11:08 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 105163 invoked by uid 89); 23 Jun 2018 21:11:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,KAM_SHORT,SPF_HELO_PASS,SPF_PASS,TVD_RCVD_SPACE_BRACKET autolearn=ham version=3.3.2 spammy=H*i:sk:5B2E9EA, hint, H*f:sk:5B2E9EA X-HELO: mutluit.com Received: from mutluit.com (HELO mutluit.com) (82.211.8.197) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 23 Jun 2018 21:11:00 +0000 Received: from [37.139.71.2] (ip4d16cd28.dynamic.kabel-deutschland.de [77.22.205.40]:35796) by mutluit.com (s2.mutluit.com [82.211.8.197]:50025) with ESMTP ([XMail 1.27 ESMTP Server]) id for from ; Sat, 23 Jun 2018 23:10:57 +0200 Subject: Re: 1x -Werror=unused-variable happens :-) To: Jonathan Wakely Cc: "gcc@gcc.gnu.org" References: <5B2E3145.8030000@mutluit.com> <5B2E9EA1.6040508@mutluit.com> From: "U.Mutlu" Message-ID: <5B2EB760.3070902@mutluit.com> Date: Sat, 23 Jun 2018 21:42:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0 SeaMonkey/2.37a1 MIME-Version: 1.0 In-Reply-To: <5B2E9EA1.6040508@mutluit.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00249.txt.bz2 U.Mutlu wrote on 06/23/2018 09:25 PM: > Jonathan Wakely wrote on 06/23/2018 07:14 PM: >> On Sat, 23 Jun 2018 at 12:39, U.Mutlu wrote: >>> >>> Hi, >>> when building the languages=c,c++ with "-g0 -DNDEBUG", then the following >>> error happens: >>> >>> ../../../gcc_trunk/libitm/method-serial.cc: In member function 'void >>> GTM::gtm_thread::serialirr_mode()': >>> ../../../gcc_trunk/libitm/method-serial.cc:309:12: error: unused variable 'ok' >>> [-Werror=unused-variable] >>> bool ok = disp->trycommit (priv_time); >>> ^~ >>> >>> Of course one can get rid of it by giving also -Wno-error=unused-variable. >>> >>> >>> But nevertheless, someone more knowledgeable should check & possibly fix that >>> assert related error: >>> >>> bool ok = disp->trycommit (priv_time); >>> // Given that we're already serial, the trycommit better work. >>> assert (ok); >>> >>> I think maybe so: >>> >>> // Given that we're already serial, the trycommit better work. >>> #ifndef NDEBUG >>> const bool ok = disp->trycommit (priv_time); >>> assert (ok); >>> #else >>> disp->trycommit (priv_time); >>> #endif >> >> No, because now the statement has to be maintained twice. This is what >> __attribute__((unused)) is for. > > Yes, true, got it. > >> This belongs in bugzilla really, not this mailing list. > > Ok, I'll do it shortly, after getting an account there first :-) Ok, bug report has just been filed, together with the above hint on how to fix it: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86293 Btw, of course I could fix that simple thing also myself, but I'm a newbie here :-), and I think I don't have svn write access as I haven't applied for it yet.