diff options
author | Gabe Black <gabeblack@google.com> | 2018-11-06 17:48:58 -0800 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-11-09 01:25:15 +0000 |
commit | 1c110fafffdf82034e34146f90729ad92865238d (patch) | |
tree | 111b229ec0ee422f73b3a1495648c1506e8ec348 /src/systemc/utils/report.cc | |
parent | 121160d97f3d41220a26d3371a277434c3defea3 (diff) | |
download | gem5-1c110fafffdf82034e34146f90729ad92865238d.tar.xz |
systemc: Wrap some report maps in functions.
By declaring the map as a static variable in that function and then
returning it, we can guarantee that it's initialized relative to other
static initializers so that we don't try to use a data structure that
isn't constructed yet. This will let us get rid of the dependence on
python for setting up that mapping.
Change-Id: I031ce2039de8f5f79fbb9d76cf1363f15207b64b
Reviewed-on: https://gem5-review.googlesource.com/c/13975
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/systemc/utils/report.cc')
-rw-r--r-- | src/systemc/utils/report.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/systemc/utils/report.cc b/src/systemc/utils/report.cc index 87671f181..4a4521582 100644 --- a/src/systemc/utils/report.cc +++ b/src/systemc/utils/report.cc @@ -49,8 +49,19 @@ ReportSevInfo reportSevInfos[sc_core::SC_MAX_SEVERITY] = [sc_core::SC_FATAL] = ReportSevInfo(sc_core::SC_DEFAULT_FATAL_ACTIONS) }; -std::map<std::string, ReportMsgInfo> reportMsgInfoMap; -std::map<int, std::string> reportIdToMsgMap; +std::map<std::string, ReportMsgInfo> & +reportMsgInfoMap() +{ + static std::map<std::string, ReportMsgInfo> m; + return m; +} + +std::map<int, std::string> & +reportIdToMsgMap() +{ + static std::map<int, std::string> m; + return m; +} int reportVerbosityLevel = sc_core::SC_MEDIUM; |