public inbox for op-tee@lists.trustedfirmware.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: op-tee@lists.trustedfirmware.org
Subject: Re: [PATCH 000/141] Fix fall-through warnings for Clang
Date: Tue, 01 Dec 2020 17:08:49 +0300	[thread overview]
Message-ID: <20201201140849.GH2767@kadam> (raw)
In-Reply-To: < <CAKwvOdntVfXj2WRR5n6Kw7BfG7FdKpTeHeh5nPu5AzwVMhOHTg@mail.gmail.com>>

[-- Attachment #1: Type: text/plain, Size: 1405 bytes --]

On Mon, Nov 23, 2020 at 05:32:51PM -0800, Nick Desaulniers wrote:
> On Sun, Nov 22, 2020 at 8:17 AM Kees Cook <keescook@chromium.org> wrote:
> >
> > On Fri, Nov 20, 2020 at 11:51:42AM -0800, Jakub Kicinski wrote:
> > > If none of the 140 patches here fix a real bug, and there is no change
> > > to machine code then it sounds to me like a W=2 kind of a warning.
> >
> > FWIW, this series has found at least one bug so far:
> > https://lore.kernel.org/lkml/CAFCwf11izHF=g1mGry1fE5kvFFFrxzhPSM6qKAO8gxSp=Kr_CQ(a)mail.gmail.com/
> 
> So looks like the bulk of these are:
> switch (x) {
>   case 0:
>     ++x;
>   default:
>     break;
> }

This should not generate a warning.

> 
> I have a patch that fixes those up for clang:
> https://reviews.llvm.org/D91895
> 
> There's 3 other cases that don't quite match between GCC and Clang I
> observe in the kernel:
> switch (x) {
>   case 0:
>     ++x;
>   default:
>     goto y;
> }
> y:;

This should generate a warning.

> 
> switch (x) {
>   case 0:
>     ++x;
>   default:
>     return;
> }

Warn for this.


> 
> switch (x) {
>   case 0:
>     ++x;
>   default:
>     ;
> }

Don't warn for this.

If adding a break statement changes the flow of the code then warn about
potentially missing break statements, but if it doesn't change anything
then don't warn about it.

regards,
dan carpenter

  parent reply	other threads:[~2020-12-01 14:08 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] < <CAKwvOdntVfXj2WRR5n6Kw7BfG7FdKpTeHeh5nPu5AzwVMhOHTg@mail.gmail.com>
2020-11-24  1:46 ` [PATCH 000/141] Fix fall-through warnings for Clang Jakub Kicinski
2020-11-24 21:25 ` Kees Cook
2020-11-25 23:02   ` Edward Cree
2020-12-01 14:08 ` Dan Carpenter [this message]
     [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] < <CANiq72kqO=bYMJnFS2uYRpgWATJ=uXxZuNUsTXT+3aLtrpnzvQ@mail.gmail.com>
2020-11-25 22:44 ` Edward Cree
2020-11-26 14:53   ` Miguel Ojeda
     [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] < <4993259d01a0064f8bb22770503490f9252f3659.camel@HansenPartnership.com>
2020-11-25  0:32 ` Miguel Ojeda
2020-11-25 10:38 ` Andy Shevchenko
     [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=20201201140849.GH2767@kadam \
    --to=dan.carpenter@oracle.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