From: Antonio Quartulli <a@unstable.cc>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, cake@lists.bufferbloat.net, toke@toke.dk,
jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us,
stephen@networkplumber.org
Subject: Re: [Cake] [PATCH] net/sch_generic.h: use sizeof_member() and get rid of unused variable
Date: Wed, 20 May 2020 10:39:33 +0200 [thread overview]
Message-ID: <2a6a8d4b-cb78-f717-5ede-29a921c5cb05@unstable.cc> (raw)
In-Reply-To: <20200519.154019.1247104207621510920.davem@davemloft.net>
Hi David,
On 20/05/2020 00:40, David Miller wrote:
> From: Antonio Quartulli <a@unstable.cc>
> Date: Tue, 19 May 2020 11:13:33 +0200
>
>> Compiling with -Wunused triggers the following warning:
>>
>> ./include/net/sch_generic.h: In function ‘qdisc_cb_private_validate’:
>> ./include/net/sch_generic.h:464:23: warning: unused variable ‘qcb’ [-Wunused-variable]
>> 464 | struct qdisc_skb_cb *qcb;
>> | ^~~
>>
>> as the qcb variable is only used to compute the sizeof one of its members.
>
> It's referenced in the code, therefore it is not "unused".
True.
>
> If in some configuration BUILD_BUG_ON() does not reference it's arguments,
> that's the bug that needs to be fixed.
>
I don't think it's BUILD_BUG_ON()'s fault, because qcb->data is passed
to sizeof() first.
My best guess is that gcc is somewhat optimizing the sizeof(gcb->data)
and thus leaving the gcb variable unused.
This said, I think it's better for the code style (and for the compiler)
if we used sizeof_member().
Should I resend the patch with a commit message that does not mention
the "unused" warning?
Thanks a lot.
Best Regards,
--
Antonio Quartulli
next prev parent reply other threads:[~2020-05-20 8:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 9:13 Antonio Quartulli
2020-05-19 22:40 ` David Miller
2020-05-20 8:39 ` Antonio Quartulli [this message]
2020-05-20 18:17 ` David Miller
2020-05-20 21:25 ` Antonio Quartulli
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
List information: https://lists.bufferbloat.net/postorius/lists/cake.lists.bufferbloat.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2a6a8d4b-cb78-f717-5ede-29a921c5cb05@unstable.cc \
--to=a@unstable.cc \
--cc=cake@lists.bufferbloat.net \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
--cc=toke@toke.dk \
--cc=xiyou.wangcong@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