dev,cpu: Make two very generic enums ScopedEnums.

Two python Enum parameter types had some very generic elements which
both include one named "none". When headers for both are included that
creates a conflict which breaks the build. Enums which such extremely
generic names need to be scoped so that they don't invite these sorts
of collisions.

This change converts them from Enum to ScopedEnum in python, and also
makes a few small changes to where they're used in c++ to match.

Issue-on: https://gem5.atlassian.net/browse/GEM5-447

Change-Id: Ibda6e6cfcd700a618f8c68d174f33ec1e178b9ac
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27950
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2020-04-20 07:49:19 -07:00
committed by Gabe Black
parent a1c502426e
commit c80b2e3811
4 changed files with 10 additions and 9 deletions

View File

@@ -42,7 +42,7 @@ from m5.objects.ClockedObject import ClockedObject
# and are meant to initialize the stream and substream IDs for
# every memory request, regardless of how the packet has been
# generated (Random, Linear, Trace etc)
class StreamGenType(Enum): vals = [ 'none', 'fixed', 'random' ]
class StreamGenType(ScopedEnum): vals = [ 'none', 'fixed', 'random' ]
# The traffic generator is a master module that generates stimuli for
# the memory system, based on a collection of simple behaviours that

View File

@@ -43,11 +43,11 @@ StreamGen*
StreamGen::create(const BaseTrafficGenParams *p)
{
switch (p->stream_gen) {
case Enums::fixed:
case StreamGenType::fixed:
return new FixedStreamGen(p);
case Enums::random:
case StreamGenType::random:
return new RandomStreamGen(p);
case Enums::none:
case StreamGenType::none:
default:
return nullptr;
}

View File

@@ -42,7 +42,8 @@ from m5.proxy import *
from m5.objects.Serial import SerialDevice
class TerminalDump(Enum): vals = ["none", "stdoutput", "stderror", "file"]
class TerminalDump(ScopedEnum): vals = [
"none", "stdoutput", "stderror", "file"]
class Terminal(SerialDevice):
type = 'Terminal'

View File

@@ -146,13 +146,13 @@ OutputStream *
Terminal::terminalDump(const TerminalParams* p)
{
switch (p->outfile) {
case Enums::TerminalDump::none:
case TerminalDump::none:
return nullptr;
case Enums::TerminalDump::stdoutput:
case TerminalDump::stdoutput:
return simout.findOrCreate("stdout");
case Enums::TerminalDump::stderror:
case TerminalDump::stderror:
return simout.findOrCreate("stderr");
case Enums::TerminalDump::file:
case TerminalDump::file:
return simout.findOrCreate(p->name);
default:
panic("Invalid option\n");