diff options
author | Gabe Black <gabeblack@google.com> | 2018-03-05 22:05:47 -0800 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-03-06 23:39:01 +0000 |
commit | 0bb50e6745b35c785c4d8051eb43f6bc419fb924 (patch) | |
tree | 97dfd086d6e4b3f4252aec459091ff6dad19f2b6 /src/arch | |
parent | 10e5646dbbe46aa317ec568cb2a58968ca867575 (diff) | |
download | gem5-0bb50e6745b35c785c4d8051eb43f6bc419fb924.tar.xz |
scons: Switch from the print statement to the print function.
Starting with version 3, scons imposes using the print function instead
of the print statement in code it processes. To get things building
again, this change moves all python code within gem5 to use the
function version. Another change by another author separately made this
same change to the site_tools and site_init.py files.
Change-Id: I2de7dc3b1be756baad6f60574c47c8b7e80ea3b0
Reviewed-on: https://gem5-review.googlesource.com/8761
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/arch')
-rwxr-xr-x | src/arch/hsail/gen.py | 4 | ||||
-rwxr-xr-x | src/arch/isa_parser.py | 30 | ||||
-rw-r--r-- | src/arch/micro_asm.py | 10 | ||||
-rwxr-xr-x | src/arch/micro_asm_test.py | 4 |
4 files changed, 27 insertions, 21 deletions
diff --git a/src/arch/hsail/gen.py b/src/arch/hsail/gen.py index 515d7ed77..bb6012112 100755 --- a/src/arch/hsail/gen.py +++ b/src/arch/hsail/gen.py @@ -35,12 +35,14 @@ # Author: Steve Reinhardt # +from __future__ import print_function + import sys, re from m5.util import code_formatter if len(sys.argv) != 4: - print "Error: need 3 args (file names)" + print("Error: need 3 args (file names)") sys.exit(0) header_code = code_formatter() diff --git a/src/arch/isa_parser.py b/src/arch/isa_parser.py index fe95d06bf..681734985 100755 --- a/src/arch/isa_parser.py +++ b/src/arch/isa_parser.py @@ -39,7 +39,7 @@ # # Authors: Steve Reinhardt -from __future__ import with_statement +from __future__ import with_statement, print_function import os import sys import re @@ -1537,11 +1537,11 @@ class ISAParser(Grammar): # select the different chunks. If no 'split' directives are used, # the cpp emissions have no effect. if re.search('-ns.cc.inc$', filename): - print >>f, '#if !defined(__SPLIT) || (__SPLIT == 1)' + print('#if !defined(__SPLIT) || (__SPLIT == 1)', file=f) self.splits[f] = 1 # ensure requisite #include's elif filename == 'decoder-g.hh.inc': - print >>f, '#include "base/bitfield.hh"' + print('#include "base/bitfield.hh"', file=f) return f @@ -1596,11 +1596,11 @@ class ISAParser(Grammar): fn = 'decoder-ns.cc.inc' assert(fn in self.files) - print >>f, 'namespace %s {' % self.namespace + print('namespace %s {' % self.namespace, file=f) if splits > 1: - print >>f, '#define __SPLIT %u' % i - print >>f, '#include "%s"' % fn - print >>f, '}' + print('#define __SPLIT %u' % i, file=f) + print('#include "%s"' % fn, file=f) + print('}', file=f) # instruction execution splits = self.splits[self.get_file('exec')] @@ -1617,11 +1617,11 @@ class ISAParser(Grammar): fn = 'exec-ns.cc.inc' assert(fn in self.files) - print >>f, 'namespace %s {' % self.namespace + print('namespace %s {' % self.namespace, file=f) if splits > 1: - print >>f, '#define __SPLIT %u' % i - print >>f, '#include "%s"' % fn - print >>f, '}' + print('#define __SPLIT %u' % i, file=f) + print('#include "%s"' % fn, file=f) + print('}', file=f) # max_inst_regs.hh self.update('max_inst_regs.hh', @@ -2019,7 +2019,7 @@ del wrap def p_def_template(self, t): 'def_template : DEF TEMPLATE ID CODELIT SEMI' if t[3] in self.templateMap: - print "warning: template %s already defined" % t[3] + print("warning: template %s already defined" % t[3]) self.templateMap[t[3]] = Template(self, t[4]) # An instruction format definition looks like @@ -2604,9 +2604,9 @@ StaticInstPtr try: self._parse_isa_desc(*args, **kwargs) except ISAParserError, e: - print backtrace(self.fileNameStack) - print "At %s:" % e.lineno - print e + print(backtrace(self.fileNameStack)) + print("At %s:" % e.lineno) + print(e) sys.exit(1) # Called as script: get args from command line. diff --git a/src/arch/micro_asm.py b/src/arch/micro_asm.py index 4e5400cef..263e73afd 100644 --- a/src/arch/micro_asm.py +++ b/src/arch/micro_asm.py @@ -26,6 +26,8 @@ # # Authors: Gabe Black +from __future__ import print_function + import os import sys import re @@ -117,9 +119,9 @@ class Directive(Statement): ########################################################################## def print_error(message): - print - print "*** %s" % message - print + print() + print("*** %s" % message) + print() def handle_statement(parser, container, statement): if statement.is_microop: @@ -153,7 +155,7 @@ def handle_statement(parser, container, statement): statement.params, {}, parser.symbols) except: print_error("Error executing directive.") - print container.directives + print(container.directives) raise else: raise Exception, "Didn't recognize the type of statement", statement diff --git a/src/arch/micro_asm_test.py b/src/arch/micro_asm_test.py index b074ecb58..e5755f717 100755 --- a/src/arch/micro_asm_test.py +++ b/src/arch/micro_asm_test.py @@ -26,6 +26,8 @@ # # Authors: Gabe Black +from __future__ import print_function + from micro_asm import MicroAssembler, Combinational_Macroop, Rom_Macroop, Rom class Bah(object): @@ -58,7 +60,7 @@ class TestMacroop(Combinational_Macroop): def untweak(self): microops["bah"] = Bah def print_debug(self, message): - print message + print(message) def __init__(self, name): super(TestMacroop, self).__init__(name) |