summaryrefslogtreecommitdiff
path: root/contrib/checkSpace.pl
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-09-30 01:07:55 +0000
committerNick Mathewson <nickm@torproject.org>2005-09-30 01:07:55 +0000
commit6ce1add8da1de0c814b4f10f99e7c1f89736ed90 (patch)
tree812a172d4b10471735e2ba18ecb09f83319fe58b /contrib/checkSpace.pl
parentacc601fd3690346093340d752ae67aba267621a6 (diff)
downloadtor-6ce1add8da1de0c814b4f10f99e7c1f89736ed90.tar.gz
tor-6ce1add8da1de0c814b4f10f99e7c1f89736ed90.zip
Make checkSpace.pl enforce our ctags-friendly function declaration rules
svn:r5159
Diffstat (limited to 'contrib/checkSpace.pl')
-rwxr-xr-xcontrib/checkSpace.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/contrib/checkSpace.pl b/contrib/checkSpace.pl
index f001450ec7..cdbfb79077 100755
--- a/contrib/checkSpace.pl
+++ b/contrib/checkSpace.pl
@@ -81,6 +81,25 @@ for $fn (@ARGV) {
print " fn ():$fn:$.\n";
}
}
+ ## Warn about functions not declared at start of line.
+ if ($in_func_head || ($fn !~ /\.h$/ && /^[a-zA-Z0-9_]/ &&
+ ! /^(?:static )?(?:typedef|struct|union)/ &&
+ ! /= *\{$/ && ! /;$/)) {
+
+ if (/.\{$/){
+ print "fn() {:$fn:$.\n";
+ $in_func_head = 0;
+ } elsif (/^\S[^\(]* +[a-zA-Z0-9_]+\(/) {
+ $in_func_head = -1; # started with tp fn
+ } elsif (/;$/) {
+ $in_func_head = 0;
+ } elsif (/\{/) {
+ if ($in_func_head == -1) {
+ print "tp fn():$fn:$.\n";
+ }
+ $in_func_head = 0;
+ }
+ }
}
}
if (! $lastnil) {