summaryrefslogtreecommitdiff
path: root/src/python/m5/SimObject.py
diff options
context:
space:
mode:
authorSascha Bischoff <sascha.bischoff@arm.com>2013-02-15 17:40:10 -0500
committerSascha Bischoff <sascha.bischoff@arm.com>2013-02-15 17:40:10 -0500
commit2f3b322280a742069fd8965d723a2205a4a8cc00 (patch)
tree8c40a9c9397e5ffdb2a3382fd2b4766b6ac13977 /src/python/m5/SimObject.py
parente88e7d88b9a9876ee040dad96acf3deabebe1fa7 (diff)
downloadgem5-2f3b322280a742069fd8965d723a2205a4a8cc00.tar.xz
base: Add warn() and inform() to m5.utils for use from python
This patch adds two fuctions to m5.util, warn and inform, which mirror those found in the C++ side of gem5. These are added in addition to the already existing m5.util.panic and m5.util.fatal which already mirror the C++ functionality. This ensures that warning and information messages generated by python are in the same format as those generated by C++. Occurrences of print "Warning: %s..." % name have been replaced with warn("%s...", name)
Diffstat (limited to 'src/python/m5/SimObject.py')
-rw-r--r--src/python/m5/SimObject.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index 5db33d4bc..09145f498 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -213,8 +213,7 @@ class MetaSimObject(type):
if 'cxx_header' not in cls._value_dict:
global noCxxHeader
noCxxHeader = True
- print >> sys.stderr, \
- "warning: No header file specified for SimObject: %s" % name
+ warn("No header file specified for SimObject: %s", name)
# Export methods are automatically inherited via C++, so we
# don't want the method declarations to get inherited on the
@@ -804,8 +803,8 @@ class SimObject(object):
def add_child(self, name, child):
child = coerceSimObjectOrVector(child)
if child.has_parent():
- print "warning: add_child('%s'): child '%s' already has parent" % \
- (name, child.get_name())
+ warn("add_child('%s'): child '%s' already has parent", name,
+ child.get_name())
if self._children.has_key(name):
# This code path had an undiscovered bug that would make it fail
# at runtime. It had been here for a long time and was only
@@ -828,8 +827,7 @@ class SimObject(object):
val = SimObjectVector(val)
self._values[key] = val
if isSimObjectOrVector(val) and not val.has_parent():
- print "warning: %s adopting orphan SimObject param '%s'" \
- % (self, key)
+ warn("%s adopting orphan SimObject param '%s'", self, key)
self.add_child(key, val)
def path(self):