gpu-compute, mem-ruby, configs: Add GCN3 ISA support to GPU model
[gem5.git] / util / hgstyle.py
index ccb04a94f9a7acfe146a363894bde0e5e68ecc43..3b7168f9dd58ec42d49af06a2c2c25ef51f70edd 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python2.7
 # Copyright (c) 2014 ARM Limited
 # All rights reserved
 #
@@ -38,9 +38,6 @@
 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors: Nathan Binkert
-#          Steve Reinhardt
 
 import sys
 import os
@@ -50,8 +47,6 @@ current_dir = os.path.dirname(__file__)
 sys.path.insert(0, current_dir)
 
 from style.verifiers import all_verifiers
-from style.validators import all_validators
-from style.file_types import lang_type
 from style.style import MercurialUI, check_ignores
 from style.region import *
 
@@ -85,35 +80,6 @@ def modregions(wctx, fname):
     return mod_regions
 
 
-def validate(filename, verbose, exit_code):
-    lang = lang_type(filename)
-    if lang not in ('C', 'C++'):
-        return
-
-    def bad():
-        if exit_code is not None:
-            sys.exit(exit_code)
-
-    try:
-        f = file(filename, 'r')
-    except OSError:
-        if verbose > 0:
-            print 'could not open file %s' % filename
-        bad()
-        return None
-
-    vals = [ v(filename, verbose=(verbose > 1), language=lang)
-             for v in all_validators ]
-
-    for i, line in enumerate(f):
-        line = line.rstrip('\n')
-        for v in vals:
-            v.validate_line(i, line)
-
-
-    return vals
-
-
 def _modified_regions(repo, patterns, **kwargs):
     opt_all = kwargs.get('all', False)
     opt_no_ignore = kwargs.get('no_ignore', False)
@@ -198,37 +164,6 @@ def do_check_style(hgui, repo, *pats, **opts):
 
     return False
 
-def do_check_format(hgui, repo, *pats, **opts):
-    """check files for gem5 code formatting violations
-
-    Without an argument, checks all modified and added files for gem5
-    code formatting violations. A list of files can be specified to
-    limit the checker to a subset of the repository. The style rules
-    are normally applied on a diff of the repository state (i.e.,
-    added files are checked in their entirety while only modifications
-    of modified files are checked).
-
-    The --all option can be specified to include clean files and check
-    modified files in their entirety.
-    """
-    ui = MercurialUI(hgui, hgui.verbose)
-
-    verbose = 0
-    for fname, mod_regions in _modified_regions(repo, pats, **opts):
-        vals = validate(joinpath(repo.root, fname), verbose, None)
-        if vals is None:
-            return True
-        elif any([not v for v in vals]):
-            print "%s:" % fname
-            for v in vals:
-                v.dump()
-            result = ui.prompt("invalid formatting\n(i)gnore or (a)bort?",
-                               'ai', 'a')
-            if result == 'a':
-                return True
-
-    return False
-
 def check_hook(hooktype):
     if hooktype not in ('pretxncommit', 'pre-qrefresh'):
         raise AttributeError, \
@@ -247,17 +182,6 @@ def check_style(ui, repo, hooktype, **kwargs):
         traceback.print_exc()
         return True
 
-def check_format(ui, repo, hooktype, **kwargs):
-    check_hook(hooktype)
-    args = {}
-
-    try:
-        return do_check_format(ui, repo, **args)
-    except Exception, e:
-        import traceback
-        traceback.print_exc()
-        return True
-
 try:
     from mercurial.i18n import _
 except ImportError:
@@ -287,31 +211,9 @@ cmdtable = {
     '^m5style' : (
         do_check_style, all_opts + _common_region_options + commands.walkopts,
         _('hg m5style [-a] [FILE]...')),
-    '^m5format' :
-    ( do_check_format, [
-            ] + _common_region_options + commands.walkopts,
-      _('hg m5format [FILE]...')),
 }
 
 if __name__ == '__main__':
-    import argparse
-
-    parser = argparse.ArgumentParser(
-        description="Check a file for style violations")
-
-    parser.add_argument("--verbose", "-v", action="count",
-                        help="Produce verbose output")
-
-    parser.add_argument("file", metavar="FILE", nargs="+",
-                        type=str,
-                        help="Source file to inspect")
-
-    args = parser.parse_args()
-
-    for filename in args.file:
-        vals = validate(filename, verbose=args.verbose,
-                        exit_code=1)
-
-        if args.verbose > 0 and vals is not None:
-            for v in vals:
-                v.dump()
+    print >> sys.stderr, "This file cannot be used from the command line. Use"
+    print >> sys.stderr, "style.py instead."
+    sys.exit(1)