[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH RESEND 01/13] scripts/checkpatch.pl: Detect superfluous semic
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [PATCH RESEND 01/13] scripts/checkpatch.pl: Detect superfluous semicolon in C code |
Date: |
Tue, 18 Feb 2020 09:49:05 +0000 |
User-agent: |
Mutt/1.13.3 (2020-01-12) |
* Philippe Mathieu-Daudé (address@hidden) wrote:
> Display error when a commit contains superfluous semicolon:
>
> $ git show 6663a0a3376 | scripts/checkpatch.pl -q -
> ERROR: superfluous trailing semicolon
> #276: FILE: block/io_uring.c:186:
> + ret = -ENOSPC;;
> total: 1 errors, 1 warnings, 485 lines checked
>
> Reported-by: Luc Michel <address@hidden>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
> ---
> Cc: Paolo Bonzini <address@hidden>
> ---
> scripts/checkpatch.pl | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index ce43a306f8..11512a8a09 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1830,6 +1830,11 @@ sub process {
> ERROR("suspicious ; after while (0)\n" . $herecurr);
> }
>
> +# Check superfluous trailing ';'
> + if ($line =~ /;;$/) {
> + ERROR("superfluous trailing semicolon\n" . $herecurr);
> + }
> +
> # Check relative indent for conditionals and blocks.
> if ($line =~ /\b(?:(?:if|while|for)\s*\(|do\b)/ && $line !~
> /^.\s*#/ && $line !~ /\}\s*while\s*/) {
> my ($s, $c) = ($stat, $cond);
> --
> 2.21.1
>
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK