[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    Re: [PATCH] libiberty: Fix -Wimplicit-fallthrough warnings.
From:       Allan Sandfeld Jensen <kde () carewolf ! com>
Date:       2016-11-18 23:45:21
Message-ID: 201611190045.22241.kde () carewolf ! com
[Download RAW message or body]



On Wednesday 02 November 2016, Mark Wielaard wrote:
> -    case 11: c+=((hashval_t)k[10]<<24);
> -    case 10: c+=((hashval_t)k[9]<<16);
> -    case 9 : c+=((hashval_t)k[8]<<8);
> +    case 11: c+=((hashval_t)k[10]<<24);	/* fall through */
> +    case 10: c+=((hashval_t)k[9]<<16);	/* fall through */
> +    case 9 : c+=((hashval_t)k[8]<<8);	/* fall through */
>        /* the first byte of c is reserved for the length */

This really highlights another exception -Wimplicit-fallthough should tolerate 
at least on level 1. Single line of code.

case X: my_statement();
case y: my_statement();

and 
case X:
	my_statement();
case y:
	my_statement();

In both cases, the lack of break is obvious at a glance and thus a comment 
highlighting it has never been needed and shouldn't be enforced.

Well, at least in my opinion, and it would take away all the rest of false 
positives I run into.

Best regards
`Allan
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic