mem-ruby: Appease compiler with return values

Add default values for the cases where gem5 panics to
appease the compiler.

Change-Id: Ib15a63abfb6f1ffed6ce628f52a57388d2173c44
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46320
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Daniel R. Carvalho
2021-05-31 11:38:13 -03:00
committed by Daniel Carvalho
parent 9ccd814418
commit 31de35c8be
2 changed files with 18 additions and 4 deletions

View File

@@ -50,10 +50,9 @@
#include "base/logging.hh"
#include "mem/cache/replacement_policies/replaceable_entry.hh"
#include "mem/ruby/common/Address.hh"
#include "mem/ruby/common/DataBlock.hh"
#include "mem/ruby/protocol/AccessPermission.hh"
class DataBlock;
class AbstractCacheEntry : public ReplaceableEntry
{
private:
@@ -73,8 +72,15 @@ class AbstractCacheEntry : public ReplaceableEntry
// The methods below are those called by ruby runtime, add when it
// is absolutely necessary and should all be virtual function.
virtual DataBlock& getDataBlk()
{ panic("getDataBlk() not implemented!"); }
virtual DataBlock&
getDataBlk()
{
panic("getDataBlk() not implemented!");
// Dummy return to appease the compiler
static DataBlock b;
return b;
}
int validBlocks;
virtual int& getNumValidBlocks()

View File

@@ -586,6 +586,8 @@ AccessPermission ${{self.c_ident}}_to_permission(const ${{self.c_ident}}& obj)
default:
panic("Unknown state access permission converstion for ${{self.c_ident}}");
}
// Appease the compiler since this function has a return value
return AccessPermission_Invalid;
}
''')
@@ -626,6 +628,8 @@ ${{self.c_ident}}_to_string(const ${{self.c_ident}}& obj)
default:
panic("Invalid range for type ${{self.c_ident}}");
}
// Appease the compiler since this function has a return value
return "";
}
// Code to convert from a string to the enumeration
@@ -689,6 +693,8 @@ ${{self.c_ident}}_base_level(const ${{self.c_ident}}& obj)
default:
panic("Invalid range for type ${{self.c_ident}}");
}
// Appease the compiler since this function has a return value
return -1;
}
/** \\brief returns the machine type for each base vector index used by NetDest
@@ -772,6 +778,8 @@ ${{self.c_ident}}_base_count(const ${{self.c_ident}}& obj)
default:
panic("Invalid range for type ${{self.c_ident}}");
}
// Appease the compiler since this function has a return value
return -1;
}
''')