From: Gary Benson <gbenson@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [OB PATCH] Avoid testcase build failures with -Wunused-value
Date: Tue, 23 Jun 2020 12:45:29 +0100 [thread overview]
Message-ID: <20200623114529.GA5308@blade.nx> (raw)
In-Reply-To: <27d9d693-8afb-d07f-6d14-d867d42babdd@redhat.com>
Pedro Alves wrote:
> On 6/23/20 12:26 PM, Gary Benson via Gdb-patches wrote:
> > --- a/gdb/testsuite/gdb.cp/namespace.cc
> > +++ b/gdb/testsuite/gdb.cp/namespace.cc
> > @@ -150,22 +150,22 @@ namespace C
> > // plan to have GDB try to print out, just to make sure that the
> > // compiler and I agree which ones should be legal! It's easy
> > // to screw up when testing the boundaries of namespace stuff.
> > - c;
> > + int unused1 = c;
>
> It looks like such a fix will only work until the compiler decides
> to enable -Wunused-variable by default too:
>
> testsuite/gdb.cp/namespace.cc:153:11: warning: unused variable 'unused' [-Wunused-variable]
> int unused = c;
> ^
>
> Try compiling the testcase with -Wall, with both g++ and clang++:
>
> $ clang++ testsuite/gdb.cp/namespace.cc -Wall
>
> I think we should fix this with the more usual cast-to-void way:
>
> (void) c;
Ok, but, out of interest, what stops the compiler ignoring that?
Thanks,
Gary
next prev parent reply other threads:[~2020-06-23 11:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-23 11:26 Gary Benson
2020-06-23 11:41 ` Pedro Alves
2020-06-23 11:45 ` Gary Benson [this message]
2020-06-23 11:53 ` Pedro Alves
2020-06-23 14:13 ` [OB PATCH] Improve -Wunused-value testcase build failures fix Gary Benson
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=20200623114529.GA5308@blade.nx \
--to=gbenson@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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