From: Andreas Sandberg Date: Fri, 4 Sep 2020 14:14:14 +0000 (+0100) Subject: scons: Simplify arch enum generation X-Git-Tag: v20.1.0.0~124 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=133e84ff5c78021d53456053db36e8865d32d235;p=gem5.git scons: Simplify arch enum generation C++ allows a trailing comma after the last item in an enum, so there is no need for a special case. Change-Id: I6ead36b4a8562b4a7a5aec88e4f6390182eedf56 Signed-off-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34116 Reviewed-by: Jason Lowe-Power Reviewed-by: Gabe Black Maintainer: Jason Lowe-Power Maintainer: Gabe Black Tested-by: kokoro --- diff --git a/src/SConscript b/src/SConscript index 4b6db448c..9f82bdc70 100644 --- a/src/SConscript +++ b/src/SConscript @@ -645,11 +645,8 @@ def makeTheISA(source, target, env): # create an enum for any run-time determination of the ISA, we # reuse the same name as the namespaces code('enum class Arch {') - for i,isa in enumerate(isas): - if i + 1 == len(isas): - code(' $0 = $1', namespace(isa), define(isa)) - else: - code(' $0 = $1,', namespace(isa), define(isa)) + for isa in isas: + code(' $0 = $1,', namespace(isa), define(isa)) code('};') code(''' @@ -690,11 +687,8 @@ def makeTheGPUISA(source, target, env): # create an enum for any run-time determination of the ISA, we # reuse the same name as the namespaces code('enum class GPUArch {') - for i,isa in enumerate(isas): - if i + 1 == len(isas): - code(' $0 = $1', namespace(isa), define(isa)) - else: - code(' $0 = $1,', namespace(isa), define(isa)) + for isa in isas: + code(' $0 = $1,', namespace(isa), define(isa)) code('};') code('''