systemc: Add a mechanism for pre-registering message type ids.
authorGabe Black <gabeblack@google.com>
Sun, 7 Oct 2018 07:34:35 +0000 (00:34 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 16 Oct 2018 01:08:32 +0000 (01:08 +0000)
These ids are the ones the Accellera implementation/tests use. Some of
the tests expect them to be available and usable.

Change-Id: I4e4dc3470c28d4113330a44ccd06ffe7724e75b1
Reviewed-on: https://gem5-review.googlesource.com/c/13322
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

src/systemc/utils/report.cc
src/systemc/utils/report.hh

index 9c26edea372e1beb1a4f330c5f83c34e08fab54a..755542fd63ef854620a66fd4ec8816d19fa13c59 100644 (file)
@@ -63,4 +63,11 @@ std::unique_ptr<sc_core::sc_report> globalReportCache;
 
 bool reportWarningsAsErrors = false;
 
+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);
+}
+
 } // namespace sc_gem5
index e0b2e2598dcc83e6d24f9104277f52f37f09711d..ddbf62fa50da967797c1c75896463d443b948a39 100644 (file)
 #ifndef __SYSTEMC_UTILS_REPORT_HH__
 #define __SYSTEMC_UTILS_REPORT_HH__
 
+#include <initializer_list>
 #include <map>
 #include <memory>
 #include <string>
+#include <utility>
 
 #include "systemc/ext/utils/sc_report.hh"
 #include "systemc/ext/utils/sc_report_handler.hh"
@@ -106,6 +108,12 @@ extern std::unique_ptr<sc_core::sc_report> globalReportCache;
 
 extern bool reportWarningsAsErrors;
 
+struct DefaultReportMessages
+{
+  public:
+    DefaultReportMessages(std::initializer_list<std::pair<int, const char *>>);
+};
+
 } // namespace sc_gem5
 
 #endif // __SYSTEMC_UTILS_REPORT_HH__