mirror of
https://github.com/curl/curl.git
synced 2026-04-15 00:01:41 +03:00
checksrc: ensure using ifdef/ifndef when possible, fix fallouts
Follow-up to 89771d19d5 #18018
Closes #20065
This commit is contained in:
parent
e8415a8296
commit
4ad87f2cb8
9 changed files with 30 additions and 11 deletions
|
|
@ -162,6 +162,7 @@ my %warnings = (
|
|||
'EXCLAMATIONSPACE' => 'Whitespace after exclamation mark in expression',
|
||||
'FIXME' => 'FIXME or TODO comment',
|
||||
'FOPENMODE' => 'fopen needs a macro for the mode string',
|
||||
'IFDEFSINGLE', => 'use ifdef/ifndef for single macro checks',
|
||||
'INCLUDEDUP', => 'same file is included again',
|
||||
'INDENTATION' => 'wrong start column for code',
|
||||
'LONGLINE' => "Line longer than $max_column",
|
||||
|
|
@ -658,6 +659,11 @@ sub scanfile {
|
|||
$line, length($1), $file, $l, "\/\/ comment");
|
||||
}
|
||||
|
||||
if($l =~ /^\s*#\s*if\s+!?\s*defined\([a-zA-Z0-9_]+\)$/) {
|
||||
checkwarn("IFDEFSINGLE",
|
||||
$line, length($1), $file, $l, "use ifdef/ifndef for single macro checks");
|
||||
}
|
||||
|
||||
if($l =~ /^(\#\s*include\s+)([\">].*[>}"])/) {
|
||||
my ($pre, $path) = ($1, $2);
|
||||
if($includes{$path}) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue