From: Edward Cree <ecree.xilinx@gmail.com>
To: op-tee@lists.trustedfirmware.org
Subject: Re: [PATCH 000/141] Fix fall-through warnings for Clang
Date: Wed, 25 Nov 2020 22:44:35 +0000 [thread overview]
Message-ID: <44005bde-f6d4-5eaa-39b8-1a5efeedb2d3@gmail.com> (raw)
In-Reply-To: < <CANiq72kqO=bYMJnFS2uYRpgWATJ=uXxZuNUsTXT+3aLtrpnzvQ@mail.gmail.com>>
[-- Attachment #1: Type: text/plain, Size: 2339 bytes --]
On 25/11/2020 00:32, Miguel Ojeda wrote:
> I have said *authoring* lines of *this* kind takes a minute per line.
> Specifically: lines fixing the fallthrough warning mechanically and
> repeatedly where the compiler tells you to, and doing so full-time for
> a month.
<snip>
> It is useful since it makes intent clear.
To make the intent clear, you have to first be certain that you
understand the intent; otherwise by adding either a break or a
fallthrough to suppress the warning you are just destroying the
information that "the intent of this code is unknown".
Figuring out the intent of a piece of unfamiliar code takes more
than 1 minute; just because
case foo:
thing;
case bar:
break;
produces identical code to
case foo:
thing;
break;
case bar:
break;
doesn't mean that *either* is correct — maybe the author meant
to write
case foo:
return thing;
case bar:
break;
and by inserting that break you've destroyed the marker that
would direct someone who knew what the code was about to look
at that point in the code and spot the problem.
Thus, you *always* have to look at more than just the immediate
mechanical context of the code, to make a proper judgement that
yes, this was the intent. If you think that that sort of thing
can be done in an *average* time of one minute, then I hope you
stay away from code I'm responsible for!
One minute would be an optimistic target for code that, as the
maintainer, one is already somewhat familiar with. For code
that you're seeing for the first time, as is usually the case
with the people doing these mechanical fix-a-warning patches,
it's completely unrealistic.
A warning is only useful because it makes you *think* about the
code. If you suppress the warning without doing that thinking,
then you made the warning useless; and if the warning made you
think about code that didn't *need* it, then the warning was
useless from the start.
So make your mind up: does Clang's stricter -Wimplicit-fallthrough
flag up code that needs thought (in which case the fixes take
effort both to author and to review) or does it flag up code
that can be mindlessly "fixed" (in which case the warning is
worthless)? Proponents in this thread seem to be trying to
have it both ways.
-ed
next parent reply other threads:[~2020-11-25 22:44 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] < <CANiq72kqO=bYMJnFS2uYRpgWATJ=uXxZuNUsTXT+3aLtrpnzvQ@mail.gmail.com>
2020-11-25 22:44 ` Edward Cree [this message]
2020-11-26 14:53 ` [PATCH 000/141] Fix fall-through warnings for Clang Miguel Ojeda
[not found] < <CAKwvOdntVfXj2WRR5n6Kw7BfG7FdKpTeHeh5nPu5AzwVMhOHTg@mail.gmail.com>
2020-11-24 1:46 ` Jakub Kicinski
2020-11-24 21:25 ` Kees Cook
2020-11-25 23:02 ` Edward Cree
2020-12-01 14:08 ` Dan Carpenter
[not found] < <CAMuHMdV5kOakvZJMWLxbpigFPS+Xuw6DVYsWCWZy7wGsv3idcw@mail.gmail.com>
2020-11-26 16:18 ` Karol Herbst
2020-11-26 17:05 ` Miguel Ojeda
[not found] < <CANiq72nobq=ptWK-qWxU91JHqkKhMcRtJNnw2XJd5-vSJWZd8Q@mail.gmail.com>
2020-11-26 15:28 ` Geert Uytterhoeven
[not found] < <4993259d01a0064f8bb22770503490f9252f3659.camel@HansenPartnership.com>
2020-11-25 0:32 ` Miguel Ojeda
2020-11-25 10:38 ` Andy Shevchenko
[not found] < <fc45750b6d0277c401015b7aa11e16cd15f32ab2.camel@HansenPartnership.com>
2020-11-23 16:24 ` Rafael J. Wysocki
2020-11-23 16:32 ` Joe Perches
2020-11-23 18:56 ` Miguel Ojeda
2020-11-25 9:01 ` Sean Young
[not found] < <CANiq72=z+tmuey9wj3Kk7wX5s0hTHpsQdLhAqcOVNrHon6xn5Q@mail.gmail.com>
2020-11-24 0:58 ` Finn Thain
2020-11-24 1:05 ` Joe Perches
2020-11-24 2:48 ` Finn Thain
2020-11-24 23:46 ` Miguel Ojeda
[not found] < <CANiq72k5tpDoDPmJ0ZWc1DGqm+81Gi-uEENAtvEs9v3SZcx6_Q@mail.gmail.com>
2020-11-23 20:37 ` James Bottomley
[not found] < <CANiq72m22Jb5_+62NnwX8xds2iUdWDMAqD8PZw9cuxdHd95W0A@mail.gmail.com>
2020-11-23 15:58 ` James Bottomley
[not found] < <1c7d7fde126bc0acf825766de64bf2f9b888f216.camel@HansenPartnership.com>
2020-11-23 14:19 ` Miguel Ojeda
[not found] < <CANiq72nZrHWTA4_Msg6MP9snTyenC6-eGfD27CyfNSu7QoVZbw@mail.gmail.com>
2020-11-22 22:36 ` James Bottomley
2020-11-22 22:54 ` Finn Thain
2020-11-22 23:04 ` James Bottomley
2020-11-23 14:05 ` Miguel Ojeda
[not found] < <9b57fd4914b46f38d54087d75e072d6e947cb56d.camel@HansenPartnership.com>
2020-11-22 18:25 ` Joe Perches
2020-11-22 19:12 ` James Bottomley
2020-11-22 20:35 ` Miguel Ojeda
2020-11-22 22:10 ` Sam Ravnborg
[not found] < <0147972a72bc13f3629de8a32dee6f1f308994b5.camel@HansenPartnership.com>
2020-11-22 19:22 ` Joe Perches
2020-11-22 19:53 ` James Bottomley
[not found] < <20201120115142.292999b2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
2020-11-20 20:48 ` Kees Cook
2020-11-22 16:17 ` Kees Cook
2020-11-22 18:21 ` James Bottomley
2020-11-24 1:32 ` Nick Desaulniers
2020-12-01 14:04 ` Dan Carpenter
[not found] < <20201120105344.4345c14e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
2020-11-20 19:04 ` Gustavo A. R. Silva
2020-11-20 19:30 ` Kees Cook
2020-11-20 19:51 ` Jakub Kicinski
2020-11-20 18:21 Gustavo A. R. Silva
2020-11-20 18:28 ` Joe Perches
2020-11-20 19:02 ` Gustavo A. R. Silva
2020-11-20 18:53 ` Jakub Kicinski
2020-11-20 22:21 ` Miguel Ojeda
2020-11-23 20:03 ` Jason Gunthorpe
2020-11-24 14:47 ` Gustavo A. R. Silva
2020-11-23 20:38 ` Mark Brown
2020-11-24 14:47 ` Gustavo A. R. Silva
2020-12-01 5:52 ` Martin K. Petersen
2020-12-01 8:20 ` Gustavo A. R. Silva
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=44005bde-f6d4-5eaa-39b8-1a5efeedb2d3@gmail.com \
--to=ecree.xilinx@gmail.com \
--cc=op-tee@lists.trustedfirmware.org \
/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