[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;
extern const char *reportSeverityNames[sc_core::SC_MAX_SEVERITY];
extern ReportSevInfo reportSevInfos[sc_core::SC_MAX_SEVERITY];
-extern std::map<std::string, ReportMsgInfo> reportMsgInfoMap;
-extern std::map<int, std::string> reportIdToMsgMap;
+
+std::map<std::string, ReportMsgInfo> &reportMsgInfoMap();
+std::map<int, std::string> &reportIdToMsgMap();
extern int reportVerbosityLevel;
const char *
sc_report::get_message(int id)
{
- auto it = sc_gem5::reportIdToMsgMap.find(id);
- if (it == sc_gem5::reportIdToMsgMap.end())
+ auto it = sc_gem5::reportIdToMsgMap().find(id);
+ if (it == sc_gem5::reportIdToMsgMap().end())
return "unknown id";
else
return it->second.c_str();
bool
sc_report::is_suppressed(int id)
{
- auto it = sc_gem5::reportIdToMsgMap.find(id);
- if (it == sc_gem5::reportIdToMsgMap.end())
+ auto it = sc_gem5::reportIdToMsgMap().find(id);
+ if (it == sc_gem5::reportIdToMsgMap().end())
return false;
- auto &msgInfo = sc_gem5::reportMsgInfoMap[it->second];
+ auto &msgInfo = sc_gem5::reportMsgInfoMap()[it->second];
return (msgInfo.actions == SC_DO_NOTHING ||
(msgInfo.sevActions[SC_INFO] == SC_DO_NOTHING &&
SC_REPORT_ERROR(SC_ID_REGISTER_ID_FAILED_, "invalid report message");
return;
}
- auto p = sc_gem5::reportIdToMsgMap.insert(
+ auto p = sc_gem5::reportIdToMsgMap().insert(
std::pair<int, std::string>(id, msg));
if (!p.second) {
SC_REPORT_ERROR(SC_ID_REGISTER_ID_FAILED_, "report id already exists");
} else {
- sc_gem5::reportMsgInfoMap[msg].id = id;
+ sc_gem5::reportMsgInfoMap()[msg].id = id;
}
}
void
sc_report::suppress_id(int id, bool suppress)
{
- auto it = sc_gem5::reportIdToMsgMap.find(id);
- if (it == sc_gem5::reportIdToMsgMap.end())
+ auto it = sc_gem5::reportIdToMsgMap().find(id);
+ if (it == sc_gem5::reportIdToMsgMap().end())
return;
if (suppress) {
- sc_gem5::reportMsgInfoMap[it->second].
+ sc_gem5::reportMsgInfoMap()[it->second].
sevActions[SC_INFO] = SC_DO_NOTHING;
- sc_gem5::reportMsgInfoMap[it->second].
+ sc_gem5::reportMsgInfoMap()[it->second].
sevActions[SC_WARNING] = SC_DO_NOTHING;
} else {
- sc_gem5::reportMsgInfoMap[it->second].
+ sc_gem5::reportMsgInfoMap()[it->second].
sevActions[SC_INFO] = SC_UNSPECIFIED;
- sc_gem5::reportMsgInfoMap[it->second].
+ sc_gem5::reportMsgInfoMap()[it->second].
sevActions[SC_WARNING] = SC_UNSPECIFIED;
}
}
return;
sc_gem5::ReportSevInfo &sevInfo = sc_gem5::reportSevInfos[severity];
- sc_gem5::ReportMsgInfo &msgInfo = sc_gem5::reportMsgInfoMap[msg_type];
+ sc_gem5::ReportMsgInfo &msgInfo = sc_gem5::reportMsgInfoMap()[msg_type];
sevInfo.count++;
msgInfo.count++;
sc_report_handler::report(sc_severity severity, int id, const char *msg,
const char *file, int line)
{
- std::string &msg_type = sc_gem5::reportIdToMsgMap[id];
+ std::string &msg_type = sc_gem5::reportIdToMsgMap()[id];
if (sc_gem5::reportWarningsAsErrors && severity == SC_WARNING)
severity = SC_ERROR;
if (!msg_type)
msg_type = SC_ID_UNKNOWN_ERROR_;
- sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type];
+ sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap()[msg_type];
sc_actions previous = info.actions;
info.actions = actions;
return previous;
if (!msg_type)
msg_type = SC_ID_UNKNOWN_ERROR_;
- sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type];
+ sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap()[msg_type];
sc_actions previous = info.sevActions[severity];
info.sevActions[severity] = actions;
return previous;
if (!msg_type)
msg_type = SC_ID_UNKNOWN_ERROR_;
- sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type];
+ sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap()[msg_type];
int previous = info.limit;
info.limit = limit;
return previous;
if (!msg_type)
msg_type = SC_ID_UNKNOWN_ERROR_;
- sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type];
+ sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap()[msg_type];
int previous = info.sevLimits[severity];
info.sevLimits[severity] = limit;
return previous;
if (!msg_type)
msg_type = SC_ID_UNKNOWN_ERROR_;
- return sc_gem5::reportMsgInfoMap[msg_type].count;
+ return sc_gem5::reportMsgInfoMap()[msg_type].count;
}
int
if (!msg_type)
msg_type = SC_ID_UNKNOWN_ERROR_;
- return sc_gem5::reportMsgInfoMap[msg_type].sevCounts[severity];
+ return sc_gem5::reportMsgInfoMap()[msg_type].sevCounts[severity];
}
int