diff options
author | Emanuele Torre <torreemanuele6@gmail.com> | 2023-04-27 19:01:28 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-04-27 23:26:50 +0200 |
commit | 7f712399d5338a2dd838a8bb16ca1548b491dfb3 (patch) | |
tree | a8d7f5e8c2eb84a53976527af1067e5370187592 /scripts | |
parent | 5cdff4f5a92797ce49a3cd01e27388cce35aab7a (diff) | |
download | curl-7f712399d5338a2dd838a8bb16ca1548b491dfb3.tar.gz |
checksrc: check for spaces before the colon of switch labels
Closes #11047
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checksrc.pl | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/checksrc.pl b/scripts/checksrc.pl index 974184bbd..540b22978 100755 --- a/scripts/checksrc.pl +++ b/scripts/checksrc.pl @@ -90,6 +90,7 @@ my %warnings = ( 'SPACEBEFORECOMMA' => 'space before a comma', 'SPACEBEFOREPAREN' => 'space before an open parenthesis', 'SPACESEMICOLON' => 'space before semicolon', + 'SPACESWITCHCOLON' => 'space before colon of switch label', 'TABS' => 'TAB characters not allowed', 'TRAILINGSPACE' => 'Trailing whitespace on the line', 'TYPEDEFSTRUCT' => 'typedefed struct', @@ -690,6 +691,12 @@ sub scanfile { $line, length($1), $file, $ol, "no space before semicolon"); } + # check for space before the colon in a switch label + if($l =~ /^( *(case .+|default)) :/) { + checkwarn("SPACESWITCHCOLON", + $line, length($1), $file, $ol, "no space before colon of switch label"); + } + # scan for use of banned functions if($l =~ /^(.*\W) (gmtime|localtime| |