From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128462 invoked by alias); 23 Jun 2018 17:14:43 -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 128451 invoked by uid 89); 23 Jun 2018 17:14:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HX-HELO:sk:mail-io X-HELO: mail-io0-f179.google.com Received: from mail-io0-f179.google.com (HELO mail-io0-f179.google.com) (209.85.223.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 23 Jun 2018 17:14:42 +0000 Received: by mail-io0-f179.google.com with SMTP id g7-v6so8800510ioh.11 for ; Sat, 23 Jun 2018 10:14:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=t40OAli9hY5WZqUdikLvswce6uWeHSxSPM5mI/G0Oyc=; b=f9fTbS1HbRN6X6vTCUcuOTuBfjgYcCeICwiiRQtVYf5q50FPNTXHQWoX9vPDeMHfHj roIOffhkfLFxZpREb56bNinLD93GVPskAI60UIPNlGCoZORT9ZTHG7OcGphVOkVKEVvU BcITlc0ALI8EFBqgldHDyr5YOnwrD9XIF9sTN4XzthhHFf/EOfcppekc6pHxaYOxJVgo 0VDNLqt5s08tsBknhG5Ac990g+VYc2cJJtctU95lmRJPZb5Lm9gf/eauvXKpmzHU7DNE KP8/vvf/jIdv8eROBqAo3Olk4MtyNepr3JEELA3MOIIr7Z5zf2iLgBrthRCPQda7Koub 1GfQ== X-Gm-Message-State: APt69E3E4i3QfDS/yACO8vPfkPFvBA6h791dzseakeGjJtN6/Pr4ozhr AIp6dZlqlyYCFrE8DPYMxlIH3RaEFxJkIbVN4z7goA== X-Google-Smtp-Source: ADUXVKLCbDmfo06qrT8OSRzEbGRsjxslmgGxxTgHOzciFl0lEwnUrxe2Yr1RRKjA95vuAQSuoNY/rmOO+NDy1LbIChE= X-Received: by 2002:a6b:7015:: with SMTP id l21-v6mr5452242ioc.160.1529774080256; Sat, 23 Jun 2018 10:14:40 -0700 (PDT) MIME-Version: 1.0 References: <5B2E3145.8030000@mutluit.com> In-Reply-To: <5B2E3145.8030000@mutluit.com> From: Jonathan Wakely Date: Sat, 23 Jun 2018 19:25:00 -0000 Message-ID: Subject: Re: 1x -Werror=unused-variable happens :-) To: um@mutluit.com Cc: "gcc@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00247.txt.bz2 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. This belongs in bugzilla really, not this mailing list.