From a6b8fe2a5f6f18bd1a6fd0767a961fa1e87aba3e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 17 Mar 2015 13:05:01 +0100 Subject: checksrc: use space before paren in "return (expr);" --- lib/checksrc.pl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/checksrc.pl') diff --git a/lib/checksrc.pl b/lib/checksrc.pl index f561492a7..c4174709b 100755 --- a/lib/checksrc.pl +++ b/lib/checksrc.pl @@ -6,7 +6,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 2011 - 2013, Daniel Stenberg, , et al. +# Copyright (C) 2011 - 2015, Daniel Stenberg, , et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -144,6 +144,17 @@ sub scanfile { } } + # check for "return(" without space + if($l =~ /^(.*)return\(/) { + if($1 =~ / *\#/) { + # this is a #if, treat it differently + } + else { + checkwarn($line, length($1)+6, $file, $l, + "return without space before paren"); + } + } + # check for "} else" if($l =~ /^(.*)\} *else/) { checkwarn($line, length($1), $file, $l, "else after closing brace on same line"); -- cgit v1.2.3