Bug 1063924 - Optimize check_spidermonkey_style.py and remove some cruft. r=njn
authorJan de Mooij <jdemooij@mozilla.com>
Mon, 08 Sep 2014 11:12:04 +0200
changeset 227361 f9e4fe104f049aca04e795fdcc9f9ea75df592f6
parent 227360 aff9ef151f254a6985a63376de3013fe9046f07f
child 227362 3368efceb99f5da86ac9a975ae90ebc089fe9ee1
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1063924
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1063924 - Optimize check_spidermonkey_style.py and remove some cruft. r=njn
config/check_spidermonkey_style.py
--- a/config/check_spidermonkey_style.py
+++ b/config/check_spidermonkey_style.py
@@ -394,16 +394,20 @@ class HashIfBlock(object):
         return False
 
 
 def do_file(filename, inclname, file_kind, f, all_inclnames, included_h_inclnames):
     block_stack = [HashIfBlock()]
 
     # Extract the #include statements as a tree of IBlocks and IIncludes.
     for linenum, line in enumerate(f, start=1):
+        # We're only interested in lines that contain a '#'.
+        if not '#' in line:
+            continue
+
         # Look for a |#include "..."| line.
         m = re.match(r'\s*#\s*include\s+"([^"]*)"', line)
         if m is not None:
             block_stack[-1].kids.append(Include(m.group(1), linenum, False))
 
         # Look for a |#include <...>| line.
         m = re.match(r'\s*#\s*include\s+<([^>]*)>', line)
         if m is not None:
@@ -477,26 +481,22 @@ def do_file(filename, inclname, file_kin
 
         section1 = include1.section(inclname)
         section2 = include2.section(inclname)
         if (section1 > section2) or \
            ((section1 == section2) and (include1.inclname.lower() > include2.inclname.lower())):
             error(filename, str(include1.linenum) + ':' + str(include2.linenum),
                   include1.quote() + ' should be included after ' + include2.quote())
 
-    # The #include statements in the files in assembler/ have all manner of implicit
-    # ordering requirements.  Boo.  Ignore them.
-    skip_order_checking = inclname.startswith('assembler/')
-
     # Check the extracted #include statements, both individually, and the ordering of
     # adjacent pairs that live in the same block.
     def pair_traverse(prev, this):
         if this.isLeaf():
             check_include_statement(this)
-            if prev is not None and prev.isLeaf() and not skip_order_checking:
+            if prev is not None and prev.isLeaf():
                 check_includes_order(prev, this)
         else:
             for prev2, this2 in zip([None] + this.kids[0:-1], this.kids):
                 pair_traverse(prev2, this2)
 
     pair_traverse(None, block_stack[-1])