From: Daniel Stenberg Date: Sun, 12 Jan 2025 21:52:13 +0000 (+0100) Subject: checksrc: check for return with parens around a value/name X-Git-Tag: curl-8_12_0~138 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3833e5fea17f7e653b750fbbe6cbe4d45744c5b0;p=thirdparty%2Fcurl.git checksrc: check for return with parens around a value/name Ref: #15979 Closes #15983 --- diff --git a/scripts/checksrc.pl b/scripts/checksrc.pl index a58163e304..876265a53e 100755 --- a/scripts/checksrc.pl +++ b/scripts/checksrc.pl @@ -188,7 +188,7 @@ sub readlocalfile { undef $banfunc{$1}; } else { - die "Invalid format in $dir/.checksrc on line $i\n"; + die "Invalid format in $dir/.checksrc on line $i: $_\n"; } } close($rcfile); @@ -770,6 +770,12 @@ sub scanfile { } } + # check for "return" with parentheses around just a value/name + if($l =~ /^(.*\W)return \(\w*\);/) { + checkwarn("RETURNPAREN", $line, length($1)+7, $file, $l, + "return with paren"); + } + # check for "sizeof" without parenthesis if(($l =~ /^(.*)sizeof *([ (])/) && ($2 ne "(")) { if($1 =~ / *\#/) {