From 31de35c8bee8685ec920b8b151582a49bf59e4cc Mon Sep 17 00:00:00 2001 From: "Daniel R. Carvalho" Date: Mon, 31 May 2021 11:38:13 -0300 Subject: [PATCH] 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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46320 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/mem/ruby/slicc_interface/AbstractCacheEntry.hh | 14 ++++++++++---- src/mem/slicc/symbols/Type.py | 8 ++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh b/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh index aa37cc52fa..48e3b9daa1 100644 --- a/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh +++ b/src/mem/ruby/slicc_interface/AbstractCacheEntry.hh @@ -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() diff --git a/src/mem/slicc/symbols/Type.py b/src/mem/slicc/symbols/Type.py index 7ac77ac07d..a1ca20012d 100644 --- a/src/mem/slicc/symbols/Type.py +++ b/src/mem/slicc/symbols/Type.py @@ -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; } ''')