[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Make checkSpace.pl enforce our ctags-friendly function decl...



Update of /home/or/cvsroot/tor/contrib
In directory moria:/tmp/cvs-serv11740/contrib

Modified Files:
	checkSpace.pl 
Log Message:
Make checkSpace.pl enforce our ctags-friendly function declaration rules

Index: checkSpace.pl
===================================================================
RCS file: /home/or/cvsroot/tor/contrib/checkSpace.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- checkSpace.pl	11 Jun 2005 18:52:37 -0000	1.8
+++ checkSpace.pl	30 Sep 2005 01:07:55 -0000	1.9
@@ -81,6 +81,25 @@
                     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) {