Whamcloud - gitweb
Improve nn-check.py output to be less verbose.
authorAndreas Dilger <andreas.dilger@oracle.com>
Wed, 14 Jul 2010 16:27:48 +0000 (20:27 +0400)
committerMikhail Pershin <tappro@sun.com>
Fri, 16 Jul 2010 09:45:11 +0000 (13:45 +0400)
Don't complain about common english words that may be in comments.  Require
that "up", "down", and "completion" be used as functions with opening "("
before they are flagged.

I thought about, and rejected, discarding all comments, but it still makes
sense to clean up non-portable function names in comments.

build/nn-check.py
build/nn-final-symbol-list.txt

index 12d28aa..dcb281a 100755 (executable)
@@ -58,16 +58,11 @@ def search_symbol(line, linenum):
 
                if regex_match:
                        print_symbol = regex_match.group(0)
-                       print 'WARNING: Found %s at line %d:' \
+                       print 'warning: Found %s at line %d:' \
                                % (print_symbol, linenum)
                        print '%s' % line.rstrip()
                        bad_symbol_cnt += 1
 
-# The main portion of the script
-print '================='
-print 'Starting nn-check'
-print '================='
-
 # Open the nn-final-symbol-list.txt file and pull in the symbols to check into
 # a dictionary object.
 try:
@@ -95,7 +90,12 @@ except IOError:
        print 'Check the path provided for the diff file.'
        sys.exit(1)
 
-index = re.compile(r'^\+\+\+ b/(.*)')
+# The main portion of the script
+print '==================================================='
+print '%s: starting nn-check' % sys.argv[1]
+print '==================================================='
+
+index = re.compile(r'^\+\+\+ [b/]*([^ \t]*)')
 plus = re.compile(r'^\+')
 for line in f:
        # Check for the "diff --cc " delimiter in order to grab the file name.
@@ -104,7 +104,7 @@ for line in f:
        if index_match:
                # Store the file name
                filename=index_match.group(1)
-               print '--> Checking File: %s' % filename
+               print '%s: ' % filename
        else:
                # Check if the line starts with a "+" character.
                plus_match = plus.match(line)
index e2aa87e..5c13bc5 100644 (file)
 \blist_add\b
 \bspin_unlock_irqrestore\b
 \batomic_t\b
-\bup\b
+\bup *\(\b
 \bspin_lock_irqsave\b
 \bspin_lock_init\b
 \blist_for_each_entry\b
 \bwrite_unlock_irqrestore\b
 \batomic_set\b
-\bdown\b
+\bdown *\(\b
 \bhlist_node\b
 \bHZ\b
 \batomic_dec\b
-\bcompletion\b
+\bcompletion *\(\b
 \blist_for_each_safe\b
 \bin_interrupt\b
 \blist_for_each_entry_safe\b
@@ -81,7 +81,8 @@
 \bunlock_kernel\b
 \bschedule_timeout\b
 \brw_semaphore\b
-\bmodule\b
+\bmodule_init\b
+\bmodule_exit\b
 \bhlist_del_init\b
 \batomic_inc_return\b
 \btime_after\b