scons: Make the sim_objects parameter of SimObject mandantory.
If there really are no c++ sim_objects in the file, then sim_objects can be set to [] which it used to default to. This way, if someone hasn't remembered to update their SConscript files for the new sim_objects and enums parameters, this will give them some indication what's wrong, rather than the build just failing later. Change-Id: Ic1933f7b9dfff7dd7e403c6c84f1f510c8ee8c72 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54203 Maintainer: Gabe Black <gabe.black@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
@@ -149,13 +149,21 @@ class SimObject(PySource):
|
||||
enums = dict()
|
||||
tags = dict()
|
||||
|
||||
def __init__(self, source, *, sim_objects=[], enums=[],
|
||||
def __init__(self, source, *, sim_objects=None, enums=None,
|
||||
tags=None, add_tags=None):
|
||||
'''Specify the source file and any tags (automatically in
|
||||
the m5.objects package)'''
|
||||
if sim_objects is None:
|
||||
if enums is None:
|
||||
error(f"SimObject({source}...) must list c++ sim_objects or "
|
||||
"enums (set either to [] if there are none).")
|
||||
sim_objects = []
|
||||
if enums is None:
|
||||
enums = []
|
||||
|
||||
super().__init__('m5.objects', source, tags, add_tags)
|
||||
if self.fixed:
|
||||
raise AttributeError("Too late to call SimObject now.")
|
||||
error("Too late to call SimObject now.")
|
||||
|
||||
SimObject.sim_objects[self.modpath] = sim_objects
|
||||
SimObject.enums[self.modpath] = enums
|
||||
|
||||
Reference in New Issue
Block a user