]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
checksrc: check for return with parens around a value/name
authorDaniel Stenberg <daniel@haxx.se>
Sun, 12 Jan 2025 21:52:13 +0000 (22:52 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 13 Jan 2025 08:10:50 +0000 (09:10 +0100)
Ref: #15979
Closes #15983

scripts/checksrc.pl

index a58163e30445a5cd4eb69b2b5536ea14ccbf39a6..876265a53e839a01c03cc5d4e4a19298b63bb6a3 100755 (executable)
@@ -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 =~ / *\#/) {