Skip to content
Snippets Groups Projects
Commit ee0f3c09 authored by Philippe Mathieu-Daudé's avatar Philippe Mathieu-Daudé Committed by Laurent Vivier
Browse files

scripts/checkpatch.pl: Detect superfluous semicolon in C code


Display error when a commit contains superfluous semicolon:

  $ git show 6663a0a3 | 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: default avatarLuc Michel <luc.michel@greensocs.com>
Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Reviewed-by: default avatarDr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
Reviewed-by: default avatarLuc Michel <luc.michel@greensocs.com>
Message-Id: <20200218094402.26625-2-philmd@redhat.com>
Signed-off-by: default avatarLaurent Vivier <laurent@vivier.eu>
parent b09d51c9
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment