mirror of
https://github.com/curl/curl.git
synced 2026-07-26 12:37:16 +03:00
checksrc: warn for leading spaces before the preprocessor hash
Fix the 40+ fallouts Closes #20282
This commit is contained in:
parent
dac98ccfa2
commit
f057ed05be
10 changed files with 55 additions and 46 deletions
|
|
@ -152,6 +152,7 @@ my %warnings = (
|
|||
'COMMENTNOSPACESTART' => 'no space following /*',
|
||||
'COPYRIGHT' => 'file missing a copyright statement',
|
||||
'CPPCOMMENTS' => '// comment detected',
|
||||
"CPPSPACE" => 'space before preprocessor hash',
|
||||
'DOBRACE' => 'A single space between do and open brace',
|
||||
'EMPTYLINEBRACE' => 'Empty line before the open brace',
|
||||
'EQUALSNOSPACE' => 'equals sign without following space',
|
||||
|
|
@ -672,6 +673,11 @@ sub scanfile {
|
|||
$includes{$path} = $l;
|
||||
}
|
||||
|
||||
# detect leading space before the hash
|
||||
if($l =~ /^([ \t]+)\#/) {
|
||||
checkwarn("CPPSPACE",
|
||||
$line, 0, $file, $l, "space before preprocessor hash");
|
||||
}
|
||||
# detect and strip preprocessor directives
|
||||
if($l =~ /^[ \t]*\#/) {
|
||||
# preprocessor line
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue