All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Johan Hovold <johan@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: USB: serial: io_edgeport: mark expected switch fall-throughs
Date: Mon, 2 Jul 2018 10:51:00 +0200	[thread overview]
Message-ID: <20180702085100.GF9802@localhost> (raw)

On Thu, Jun 28, 2018 at 01:40:30PM -0500, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/usb/serial/io_edgeport.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
> index 97c69d3..441dab6 100644
> --- a/drivers/usb/serial/io_edgeport.c
> +++ b/drivers/usb/serial/io_edgeport.c
> @@ -1760,7 +1760,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
>  				edge_serial->rxState = EXPECT_HDR2;
>  				break;
>  			}
> -			/* otherwise, drop on through */
> +			/* else: fall through */

This doesn't silence the compiler warning with gcc 7.2.0 as the "else: "
pattern isn't recognised.

>  		case EXPECT_HDR2:
>  			edge_serial->rxHeader2 = *buffer;
>  			++buffer;
> @@ -1820,7 +1820,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
>  					edge_serial->rxState = EXPECT_DATA;
>  					break;
>  				}
> -				/* Else, drop through */
> +				/* else: fall through */
>  			}

And this doesn't work either due to the "else: " as well as the fact
that the compiler expects the fallthrough comment to precede the case
statement directly (e.g. it would need to be moved out of the else
block, but that isn't necessarily desirable as we discussed last year: 

	lkml.kernel.org/r/20171027203906.GA7054@embeddedor.com

)

>  		case EXPECT_DATA: /* Expect data */
>  			if (bufferLength < edge_serial->rxBytesRemaining) {

How do you compile test these these patches?

Thanks,
Johan
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <johan@kernel.org>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Johan Hovold <johan@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] USB: serial: io_edgeport: mark expected switch fall-throughs
Date: Mon, 2 Jul 2018 10:51:00 +0200	[thread overview]
Message-ID: <20180702085100.GF9802@localhost> (raw)
In-Reply-To: <20180628184030.GA23656@embeddedor.com>

On Thu, Jun 28, 2018 at 01:40:30PM -0500, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/usb/serial/io_edgeport.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
> index 97c69d3..441dab6 100644
> --- a/drivers/usb/serial/io_edgeport.c
> +++ b/drivers/usb/serial/io_edgeport.c
> @@ -1760,7 +1760,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
>  				edge_serial->rxState = EXPECT_HDR2;
>  				break;
>  			}
> -			/* otherwise, drop on through */
> +			/* else: fall through */

This doesn't silence the compiler warning with gcc 7.2.0 as the "else: "
pattern isn't recognised.

>  		case EXPECT_HDR2:
>  			edge_serial->rxHeader2 = *buffer;
>  			++buffer;
> @@ -1820,7 +1820,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
>  					edge_serial->rxState = EXPECT_DATA;
>  					break;
>  				}
> -				/* Else, drop through */
> +				/* else: fall through */
>  			}

And this doesn't work either due to the "else: " as well as the fact
that the compiler expects the fallthrough comment to precede the case
statement directly (e.g. it would need to be moved out of the else
block, but that isn't necessarily desirable as we discussed last year: 

	lkml.kernel.org/r/20171027203906.GA7054@embeddedor.com

)

>  		case EXPECT_DATA: /* Expect data */
>  			if (bufferLength < edge_serial->rxBytesRemaining) {

How do you compile test these these patches?

Thanks,
Johan

             reply	other threads:[~2018-07-02  8:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-02  8:51 Johan Hovold [this message]
2018-07-02  8:51 ` [PATCH] USB: serial: io_edgeport: mark expected switch fall-throughs Johan Hovold
  -- strict thread matches above, loose matches on Subject: below --
2018-07-02 15:16 Johan Hovold
2018-07-02 15:16 ` [PATCH] " Johan Hovold
2018-07-02 13:00 Gustavo A. R. Silva
2018-07-02 13:00 ` [PATCH] " Gustavo A. R. Silva
2018-06-28 18:40 Gustavo A. R. Silva
2018-06-28 18:40 ` [PATCH] " 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=20180702085100.GF9802@localhost \
    --to=johan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo@embeddedor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.