From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: Jeff Law <jeffreyalaw@gmail.com>
Cc: Denis Chertykov <chertykov@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: PING: [AVR] Fix unused argument warning
Date: Tue, 5 Oct 2021 17:03:14 +0200 [thread overview]
Message-ID: <20211005150314.vlta6filnn4y67dx@lug-owl.de> (raw)
In-Reply-To: <fba7a03d-2b76-cd2c-91ae-56f6e770255a@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2658 bytes --]
Hi Jeff,
On Tue, 2021-10-05 08:53:00 -0600, Jeff Law <jeffreyalaw@gmail.com> wrote:
> On 10/5/2021 8:46 AM, Jan-Benedict Glaw wrote:
> > On Thu, 2021-09-30 21:27:23 +0200, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
> > > gcc/ChangeLog:
> > >
> > > * common/config/avr/avr-common.c (avr_handle_option): Mark
> > > argument as ATTRIBUTE_UNUSED.
> > >
> > > diff --git a/gcc/common/config/avr/avr-common.c b/gcc/common/config/avr/avr-common.c
> > > index 6486659d27c..a6939ad03d3 100644
> > > --- a/gcc/common/config/avr/avr-common.c
> > > +++ b/gcc/common/config/avr/avr-common.c
> > > @@ -77,7 +77,8 @@ static const struct default_options avr_option_optimization_table[] =
> > > static bool
> > > avr_handle_option (struct gcc_options *opts, struct gcc_options*,
> > > - const struct cl_decoded_option *decoded, location_t loc)
> > > + const struct cl_decoded_option *decoded,
> > > + location_t loc ATTRIBUTE_UNUSED)
> > > {
> > > int value = decoded->value;
> > >
> > >
> > > Ok for trunk?
> > Wanted to give this a ping.
> I thought I sent a reply a few days ago. Instead of using ATTRIBUTE_UNUSED,
> just drop the parameter's name. You should consider that pre-approved for
> this and any other cases you run into.
Not quite I think. The `loc`ation parameter is used under some
circumstances, though it's dependant on some #ifdefs:
78 static bool
79 avr_handle_option (struct gcc_options *opts, struct gcc_options*,
80 const struct cl_decoded_option *decoded,
81 location_t loc ATTRIBUTE_UNUSED)
82 {
83 int value = decoded->value;
84
85 switch (decoded->opt_index)
86 {
87 case OPT_mdouble_:
88 if (value == 64)
89 {
90 #if !defined (HAVE_DOUBLE64)
91 error_at (loc, "option %<-mdouble=64%> is only available if "
92 "configured %<--with-double={64|64,32|32,64}%>");
93 #endif
94 opts->x_avr_long_double = 64;
95 }
96 else if (value == 32)
97 {
98 #if !defined (HAVE_DOUBLE32)
99 error_at (loc, "option %<-mdouble=32%> is only available if "
100 "configured %<--with-double={32|32,64|64,32}%>");
101 #endif
102 }
Also, this implements the TARGET_HANDLE_OPTION function, so changing
the arguments wouldn't really work and as the `loc` argument is used
under certain circumstances, I kept it as is and marked it unused.
(Adding an #ifdef in front doesn't make the code any more readable.)
Thanks,
Jan-Benedict
--
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2021-10-05 15:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 19:27 Jan-Benedict Glaw
2021-10-05 14:46 ` PING: " Jan-Benedict Glaw
2021-10-05 14:53 ` Jeff Law
2021-10-05 15:03 ` Jan-Benedict Glaw [this message]
2021-10-05 15:06 ` Jeff Law
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=20211005150314.vlta6filnn4y67dx@lug-owl.de \
--to=jbglaw@lug-owl.de \
--cc=chertykov@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@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).