sc_report.cc (13322:7391057615bd) sc_report.cc (13401:3bf529b4bc51)
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 75 unchanged lines hidden (view full) ---

84sc_report::what() const throw()
85{
86 return _what.c_str();
87}
88
89const char *
90sc_report::get_message(int id)
91{
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 75 unchanged lines hidden (view full) ---

84sc_report::what() const throw()
85{
86 return _what.c_str();
87}
88
89const char *
90sc_report::get_message(int id)
91{
92 auto it = sc_gem5::reportIdToMsgMap.find(id);
93 if (it == sc_gem5::reportIdToMsgMap.end())
92 auto it = sc_gem5::reportIdToMsgMap().find(id);
93 if (it == sc_gem5::reportIdToMsgMap().end())
94 return "unknown id";
95 else
96 return it->second.c_str();
97}
98
99bool
100sc_report::is_suppressed(int id)
101{
94 return "unknown id";
95 else
96 return it->second.c_str();
97}
98
99bool
100sc_report::is_suppressed(int id)
101{
102 auto it = sc_gem5::reportIdToMsgMap.find(id);
103 if (it == sc_gem5::reportIdToMsgMap.end())
102 auto it = sc_gem5::reportIdToMsgMap().find(id);
103 if (it == sc_gem5::reportIdToMsgMap().end())
104 return false;
105
104 return false;
105
106 auto &msgInfo = sc_gem5::reportMsgInfoMap[it->second];
106 auto &msgInfo = sc_gem5::reportMsgInfoMap()[it->second];
107
108 return (msgInfo.actions == SC_DO_NOTHING ||
109 (msgInfo.sevActions[SC_INFO] == SC_DO_NOTHING &&
110 msgInfo.sevActions[SC_WARNING] == SC_DO_NOTHING));
111}
112
113void
114sc_report::make_warnings_errors(bool val)

--- 7 unchanged lines hidden (view full) ---

122 if (id < 0) {
123 SC_REPORT_ERROR(SC_ID_REGISTER_ID_FAILED_, "invalid report id");
124 return;
125 }
126 if (!msg) {
127 SC_REPORT_ERROR(SC_ID_REGISTER_ID_FAILED_, "invalid report message");
128 return;
129 }
107
108 return (msgInfo.actions == SC_DO_NOTHING ||
109 (msgInfo.sevActions[SC_INFO] == SC_DO_NOTHING &&
110 msgInfo.sevActions[SC_WARNING] == SC_DO_NOTHING));
111}
112
113void
114sc_report::make_warnings_errors(bool val)

--- 7 unchanged lines hidden (view full) ---

122 if (id < 0) {
123 SC_REPORT_ERROR(SC_ID_REGISTER_ID_FAILED_, "invalid report id");
124 return;
125 }
126 if (!msg) {
127 SC_REPORT_ERROR(SC_ID_REGISTER_ID_FAILED_, "invalid report message");
128 return;
129 }
130 auto p = sc_gem5::reportIdToMsgMap.insert(
130 auto p = sc_gem5::reportIdToMsgMap().insert(
131 std::pair<int, std::string>(id, msg));
132 if (!p.second) {
133 SC_REPORT_ERROR(SC_ID_REGISTER_ID_FAILED_, "report id already exists");
134 } else {
131 std::pair<int, std::string>(id, msg));
132 if (!p.second) {
133 SC_REPORT_ERROR(SC_ID_REGISTER_ID_FAILED_, "report id already exists");
134 } else {
135 sc_gem5::reportMsgInfoMap[msg].id = id;
135 sc_gem5::reportMsgInfoMap()[msg].id = id;
136 }
137}
138
139void
140sc_report::suppress_id(int id, bool suppress)
141{
136 }
137}
138
139void
140sc_report::suppress_id(int id, bool suppress)
141{
142 auto it = sc_gem5::reportIdToMsgMap.find(id);
143 if (it == sc_gem5::reportIdToMsgMap.end())
142 auto it = sc_gem5::reportIdToMsgMap().find(id);
143 if (it == sc_gem5::reportIdToMsgMap().end())
144 return;
145
146 if (suppress) {
144 return;
145
146 if (suppress) {
147 sc_gem5::reportMsgInfoMap[it->second].
147 sc_gem5::reportMsgInfoMap()[it->second].
148 sevActions[SC_INFO] = SC_DO_NOTHING;
148 sevActions[SC_INFO] = SC_DO_NOTHING;
149 sc_gem5::reportMsgInfoMap[it->second].
149 sc_gem5::reportMsgInfoMap()[it->second].
150 sevActions[SC_WARNING] = SC_DO_NOTHING;
151 } else {
150 sevActions[SC_WARNING] = SC_DO_NOTHING;
151 } else {
152 sc_gem5::reportMsgInfoMap[it->second].
152 sc_gem5::reportMsgInfoMap()[it->second].
153 sevActions[SC_INFO] = SC_UNSPECIFIED;
153 sevActions[SC_INFO] = SC_UNSPECIFIED;
154 sc_gem5::reportMsgInfoMap[it->second].
154 sc_gem5::reportMsgInfoMap()[it->second].
155 sevActions[SC_WARNING] = SC_UNSPECIFIED;
156 }
157}
158
159void
160sc_report::suppress_infos(bool suppress)
161{
162 if (suppress)

--- 23 unchanged lines hidden ---
155 sevActions[SC_WARNING] = SC_UNSPECIFIED;
156 }
157}
158
159void
160sc_report::suppress_infos(bool suppress)
161{
162 if (suppress)

--- 23 unchanged lines hidden ---