From: Gabe Black Date: Sat, 29 Aug 2020 09:21:09 +0000 (-0700) Subject: scons: Make scons aware of changes to cxx_type in param types. X-Git-Tag: v20.1.0.0~169 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f0e63088abff8950303a2eb7a3674d07942fd56b;p=gem5.git scons: Make scons aware of changes to cxx_type in param types. If the cxx_type value changes, then the way the parameter is declared in the param struct will also change, and the header needs to be updated. scons would miss this sort of change before because it was only checking the module the SimObject's source came from. The python names and types of the parameters could stay the same, but the C++ representation might have changed because of edits somewhere else. This CL assumes that cxx_type is the only thing that will change and transparently affect the params struct. I tried making scons sensitive to the entire ptype which would capture other parameters, but that didn't work for some reason. This should be pretty safe in general, but not 100% safe Issue-on: https://gem5.atlassian.net/browse/GEM5-753 Change-Id: I06774889e60b987f727799f55d7ea2a775b6a319 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33695 Reviewed-by: Daniel Carvalho Reviewed-by: Nikos Nikoleris Maintainer: Gabe Black Tested-by: kokoro --- diff --git a/src/SConscript b/src/SConscript index 66db2f7ab..d9cde285b 100644 --- a/src/SConscript +++ b/src/SConscript @@ -922,9 +922,17 @@ def createSimObjectPyBindWrapper(target, source, env): # Generate all of the SimObject param C++ struct header files params_hh_files = [] for name,simobj in sorted(sim_objects.items()): + # If this simobject's source changes, we need to regenerate the header. py_source = PySource.modules[simobj.__module__] extra_deps = [ py_source.tnode ] + # Get the params for just this SimObject, excluding base classes. + params = simobj._params.local.values() + # Extract the parameters' c++ types. + types = sorted(map(lambda p: p.ptype.cxx_type, params)) + # If any of these types have changed, we need to regenerate the header. + extra_deps.append(Value(types)) + hh_file = File('params/%s.hh' % name) params_hh_files.append(hh_file) env.Command(hh_file, Value(name),