Bug 956899 - Teach check_spidermonkey_style.py about mozglue; r=njn
authorTerrence Cole <terrence@mozilla.com>
Thu, 10 Mar 2016 09:07:59 -0800
changeset 288641 2f4dc776c043e58c34762e0d463c7d91af0f4471
parent 288640 a0b4612ed03d61bb3f51a41c253528dabc3efaa3
child 288642 14092b3cacbeaab373eb88792f90800e21d2f1f3
push id18174
push usercbook@mozilla.com
push dateTue, 15 Mar 2016 09:44:58 +0000
treeherderfx-team@dd0baa33759d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs956899
milestone48.0a1
Bug 956899 - Teach check_spidermonkey_style.py about mozglue; r=njn
config/check_spidermonkey_style.py
--- a/config/check_spidermonkey_style.py
+++ b/config/check_spidermonkey_style.py
@@ -222,52 +222,53 @@ class FileKind(object):
 
 
 def check_style():
     # We deal with two kinds of name.
     # - A "filename" is a full path to a file from the repository root.
     # - An "inclname" is how a file is referred to in a #include statement.
     #
     # Examples (filename -> inclname)
-    # - "mfbt/Attributes.h"     -> "mozilla/Attributes.h"
-    # - "mfbt/decimal/Decimal.h -> "mozilla/Decimal.h"
-    # - "js/public/Vector.h"    -> "js/Vector.h"
-    # - "js/src/vm/String.h"    -> "vm/String.h"
+    # - "mfbt/Attributes.h"         -> "mozilla/Attributes.h"
+    # - "mfbt/decimal/Decimal.h     -> "mozilla/Decimal.h"
+    # - "mozglue/misc/TimeStamp.h   -> "mozilla/TimeStamp.h"
+    # - "memory/mozalloc/mozalloc.h -> "mozilla/mozalloc.h"
+    # - "js/public/Vector.h"        -> "js/Vector.h"
+    # - "js/src/vm/String.h"        -> "vm/String.h"
 
-    mfbt_inclnames = set()      # type: set(inclname)
-    mozalloc_inclnames = set()  # type: set(inclname)
-    js_names = dict()           # type: dict(filename, inclname)
+    non_js_dirnames = ('mfbt/',
+                       'memory/mozalloc/',
+                       'mozglue/')  # type: tuple(str)
+    non_js_inclnames = set()        # type: set(inclname)
+    js_names = dict()               # type: dict(filename, inclname)
 
     # Select the appropriate files.
     for filename in get_all_toplevel_filenames():
-        if filename.startswith('mfbt/') and filename.endswith('.h'):
-            inclname = 'mozilla/' + filename.split('/')[-1]
-            mfbt_inclnames.add(inclname)
-
-        if filename.startswith('memory/mozalloc/') and filename.endswith('.h'):
-            inclname = 'mozilla/' + filename.split('/')[-1]
-            mozalloc_inclnames.add(inclname)
+        for non_js_dir in non_js_dirnames:
+            if filename.startswith(non_js_dir) and filename.endswith('.h'):
+                inclname = 'mozilla/' + filename.split('/')[-1]
+                non_js_inclnames.add(inclname)
 
         if filename.startswith('js/public/') and filename.endswith('.h'):
             inclname = 'js/' + filename[len('js/public/'):]
             js_names[filename] = inclname
 
         if filename.startswith('js/src/') and \
            not filename.startswith(tuple(ignored_js_src_dirs)) and \
            filename.endswith(('.c', '.cpp', '.h', '.tbl', '.msg')):
             inclname = filename[len('js/src/'):]
             js_names[filename] = inclname
 
-    all_inclnames = mfbt_inclnames | mozalloc_inclnames | set(js_names.values())
+    all_inclnames = non_js_inclnames | set(js_names.values())
 
     edges = dict()      # type: dict(inclname, set(inclname))
 
     # We don't care what's inside the MFBT and MOZALLOC files, but because they
     # are #included from JS files we have to add them to the inclusion graph.
-    for inclname in mfbt_inclnames | mozalloc_inclnames:
+    for inclname in non_js_inclnames:
         edges[inclname] = set()
 
     # Process all the JS files.
     for filename in js_names.keys():
         inclname = js_names[filename]
         file_kind = FileKind.get(filename)
         if file_kind == FileKind.C or file_kind == FileKind.CPP or \
            file_kind == FileKind.H or file_kind == FileKind.INL_H: