From 133e84ff5c78021d53456053db36e8865d32d235 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg <andreas.sandberg@arm.com> Date: Fri, 4 Sep 2020 15:14:14 +0100 Subject: [PATCH] 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 <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34116 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com> --- src/SConscript | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) 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(''' -- 2.30.2