base: Cleanup Debug::CompoundFlag

Compound flags are currently constructed using a constructor with a
finite set of arguments that default to nullptr that refer to child
flags. C++11 introduces two cleaner ways to achieve the same thing,
variadic templates and initializer_list. Use an initializer list to
pass dependent flags.

Change-Id: Iadcd04986ab20efccfae9b92b26c079b9612262e
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34115
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Andreas Sandberg
2020-09-04 15:10:53 +01:00
parent a1a2edd2a6
commit e9075be4f9
2 changed files with 9 additions and 29 deletions

View File

@@ -1071,15 +1071,12 @@ namespace Debug {
if not compound:
code('SimpleFlag $name("$name", "$desc");')
else:
comp_code('CompoundFlag $name("$name", "$desc",')
comp_code('CompoundFlag $name("$name", "$desc", {')
comp_code.indent()
last = len(compound) - 1
for i,flag in enumerate(compound):
if i != last:
comp_code('&$flag,')
else:
comp_code('&$flag);')
for flag in compound:
comp_code('&$flag,')
comp_code.dedent()
comp_code('});')
code.append(comp_code)
code()