Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/54203 )

Change subject: scons: Make the sim_objects parameter of SimObject mandantory.
......................................................................

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 <[email protected]>
Tested-by: kokoro <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
---
M src/cpu/o3/SConscript
M src/systemc/SConscript
M src/SConscript
M src/dev/SConscript
4 files changed, 33 insertions(+), 5 deletions(-)

Approvals:
  Andreas Sandberg: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/SConscript b/src/SConscript
index 7eb810a..e40262a 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -149,13 +149,21 @@
     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
diff --git a/src/cpu/o3/SConscript b/src/cpu/o3/SConscript
index a20e30d..ba021a8 100755
--- a/src/cpu/o3/SConscript
+++ b/src/cpu/o3/SConscript
@@ -32,7 +32,7 @@

 if 'O3CPU' in env['CPU_MODELS']:
     SimObject('FUPool.py', sim_objects=['FUPool'])
-    SimObject('FuncUnitConfig.py')
+    SimObject('FuncUnitConfig.py', sim_objects=[])
     SimObject('O3CPU.py', sim_objects=['O3CPU'], enums=[
         'SMTFetchPolicy', 'SMTQueuePolicy', 'CommitPolicy'])

diff --git a/src/dev/SConscript b/src/dev/SConscript
index db3163e..755ddb5 100644
--- a/src/dev/SConscript
+++ b/src/dev/SConscript
@@ -35,7 +35,7 @@
 Source('dma_device.cc')
 Source('dma_virt_device.cc')

-SimObject('IntPin.py')
+SimObject('IntPin.py', sim_objects=[])
 Source('intpin.cc')

 DebugFlag('IsaFake')
diff --git a/src/systemc/SConscript b/src/systemc/SConscript
index ef7e79b..57cb1d9 100644
--- a/src/systemc/SConscript
+++ b/src/systemc/SConscript
@@ -32,4 +32,4 @@

 env.Append(CPPPATH=Dir('ext'))

-SimObject('Tlm.py')
+SimObject('Tlm.py', sim_objects=[])

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/54203
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: release-staging-v21-2
Gerrit-Change-Id: Ic1933f7b9dfff7dd7e403c6c84f1f510c8ee8c72
Gerrit-Change-Number: 54203
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby Bruce <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to