public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "U.Mutlu" <um@mutluit.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: 1x -Werror=unused-variable happens :-)
Date: Sat, 23 Jun 2018 21:42:00 -0000	[thread overview]
Message-ID: <5B2EB760.3070902@mutluit.com> (raw)
In-Reply-To: <5B2E9EA1.6040508@mutluit.com>

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.


  reply	other threads:[~2018-06-23 21:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-23 12:10 U.Mutlu
2018-06-23 17:14 ` U.Mutlu
2018-06-24  6:13   ` U.Mutlu
2018-06-23 19:25 ` Jonathan Wakely
2018-06-23 21:11   ` U.Mutlu
2018-06-23 21:42     ` U.Mutlu [this message]
2018-06-24 14:46       ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5B2EB760.3070902@mutluit.com \
    --to=um@mutluit.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).