1x -Werror=unused-variable happens :-)

Jonathan Wakely jwakely.gcc@gmail.com
Sun Jun 24 14:46:00 GMT 2018


On Sat, 23 Jun 2018 at 22:11, U.Mutlu <um@mutluit.com> wrote:
>
> 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

Thanks!

> 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.
>
>



More information about the Gcc mailing list