systemc: Stop using python init to set up predefined message ids.
We can now be sure register_id will work even mid static initializers, so we don't have to use python initialization as a hook to install these predefined message ids. Change-Id: I2e4d0c678ddda0a9ce5b114bdf1710f36e955f23 Reviewed-on: https://gem5-review.googlesource.com/c/13976 Maintainer: Gabe Black <gabeblack@google.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
This commit is contained in:
@@ -29,8 +29,6 @@
|
||||
|
||||
#include "systemc/utils/report.hh"
|
||||
|
||||
#include "systemc/core/python.hh"
|
||||
|
||||
namespace sc_gem5
|
||||
{
|
||||
|
||||
@@ -76,42 +74,11 @@ std::unique_ptr<sc_core::sc_report> globalReportCache;
|
||||
|
||||
bool reportWarningsAsErrors = false;
|
||||
|
||||
DefaultReportMessages *&
|
||||
DefaultReportMessages::top()
|
||||
{
|
||||
static DefaultReportMessages *top_ptr = nullptr;
|
||||
return top_ptr;
|
||||
}
|
||||
|
||||
void
|
||||
DefaultReportMessages::install()
|
||||
DefaultReportMessages::DefaultReportMessages(
|
||||
std::initializer_list<std::pair<int, const char *>> msgs)
|
||||
{
|
||||
for (auto &p: msgs)
|
||||
sc_core::sc_report::register_id(p.first, p.second);
|
||||
}
|
||||
|
||||
DefaultReportMessages::DefaultReportMessages(
|
||||
std::initializer_list<std::pair<int, const char *>> msgs) :
|
||||
next(top()), msgs(msgs)
|
||||
{
|
||||
top() = this;
|
||||
}
|
||||
|
||||
void
|
||||
DefaultReportMessages::installAll()
|
||||
{
|
||||
for (DefaultReportMessages *ptr = top(); ptr; ptr = ptr->next)
|
||||
ptr->install();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct InstallDefaultReportMessages : public PythonReadyFunc
|
||||
{
|
||||
void run() override { DefaultReportMessages::installAll(); }
|
||||
} messageInstaller;
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
} // namespace sc_gem5
|
||||
|
||||
@@ -111,17 +111,8 @@ extern bool reportWarningsAsErrors;
|
||||
|
||||
struct DefaultReportMessages
|
||||
{
|
||||
protected:
|
||||
static DefaultReportMessages *&top();
|
||||
DefaultReportMessages *next;
|
||||
|
||||
std::initializer_list<std::pair<int, const char *>> msgs;
|
||||
void install();
|
||||
|
||||
public:
|
||||
DefaultReportMessages(std::initializer_list<std::pair<int, const char *>>);
|
||||
|
||||
static void installAll();
|
||||
};
|
||||
|
||||
} // namespace sc_gem5
|
||||
|
||||
Reference in New Issue
Block a user