[sheepdog] [PATCH v3] checkpatch.pl: forbid illegal empty lines after break;

MORITA Kazutaka morita.kazutaka at gmail.com
Tue Jan 22 16:25:36 CET 2013


At Tue, 22 Jan 2013 18:05:16 +0900,
Hitoshi Mitake wrote:
> 
> From: Hitoshi Mitake <h.mitake at gmail.com>
> 
> This patch lets checkpatch.pl forbid illegal empty lines after break;.
> 
> Forbidden empty lines are categorized into 2 types:
> 1. empty lines after break; in a switch statement
> 2. empty lines after last break; in a compound statement
> 
> For example, a patch which contains diffs like this:
> +void test(void)
> +{
> +	switch (x) {
> +	case X:
> +		break;		/* treated as an error */
> +
> +	case Y:
> +		break;
> +	default:
> +		break;		/* treated as an error */
> +
> +	}
> +
> +	for ( ; ; ) {
> +		if (0) {
> +			break;	/* treated as an error */
> +
> +		}
> +	}
> +}
> causes an error.
> 
> Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> ---
> v3
>  * trivial fixes for the part of bzero() checking
>  * a little bit cleaning
>  * treat empty lines after last break; of a compound statement as an error
> 8<---
> 
>  script/checkpatch.pl |   36 +++++++++++++++++++++++++++++++++++-
>  1 files changed, 35 insertions(+), 1 deletions(-)

Applied, thanks!

Kazutaka



More information about the sheepdog mailing list