sc_report_handler.cc (13335:299a16ef8e3c) | sc_report_handler.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 --- 56 unchanged lines hidden (view full) --- 65{ 66 if (!msg_type) 67 msg_type = SC_ID_UNKNOWN_ERROR_; 68 69 if (severity == SC_INFO && verbosity > sc_gem5::reportVerbosityLevel) 70 return; 71 72 sc_gem5::ReportSevInfo &sevInfo = sc_gem5::reportSevInfos[severity]; | 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 --- 56 unchanged lines hidden (view full) --- 65{ 66 if (!msg_type) 67 msg_type = SC_ID_UNKNOWN_ERROR_; 68 69 if (severity == SC_INFO && verbosity > sc_gem5::reportVerbosityLevel) 70 return; 71 72 sc_gem5::ReportSevInfo &sevInfo = sc_gem5::reportSevInfos[severity]; |
73 sc_gem5::ReportMsgInfo &msgInfo = sc_gem5::reportMsgInfoMap[msg_type]; | 73 sc_gem5::ReportMsgInfo &msgInfo = sc_gem5::reportMsgInfoMap()[msg_type]; |
74 75 sevInfo.count++; 76 msgInfo.count++; 77 msgInfo.sevCounts[severity]++; 78 79 sc_actions actions = SC_UNSPECIFIED; 80 if (msgInfo.sevActions[severity] != SC_UNSPECIFIED) 81 actions = msgInfo.sevActions[severity]; --- 24 unchanged lines hidden (view full) --- 106 107 sc_gem5::reportHandlerProc(report, actions); 108} 109 110void 111sc_report_handler::report(sc_severity severity, int id, const char *msg, 112 const char *file, int line) 113{ | 74 75 sevInfo.count++; 76 msgInfo.count++; 77 msgInfo.sevCounts[severity]++; 78 79 sc_actions actions = SC_UNSPECIFIED; 80 if (msgInfo.sevActions[severity] != SC_UNSPECIFIED) 81 actions = msgInfo.sevActions[severity]; --- 24 unchanged lines hidden (view full) --- 106 107 sc_gem5::reportHandlerProc(report, actions); 108} 109 110void 111sc_report_handler::report(sc_severity severity, int id, const char *msg, 112 const char *file, int line) 113{ |
114 std::string &msg_type = sc_gem5::reportIdToMsgMap[id]; | 114 std::string &msg_type = sc_gem5::reportIdToMsgMap()[id]; |
115 116 if (sc_gem5::reportWarningsAsErrors && severity == SC_WARNING) 117 severity = SC_ERROR; 118 119 report(severity, msg_type.c_str(), msg, file, line); 120} 121 122sc_actions --- 6 unchanged lines hidden (view full) --- 129} 130 131sc_actions 132sc_report_handler::set_actions(const char *msg_type, sc_actions actions) 133{ 134 if (!msg_type) 135 msg_type = SC_ID_UNKNOWN_ERROR_; 136 | 115 116 if (sc_gem5::reportWarningsAsErrors && severity == SC_WARNING) 117 severity = SC_ERROR; 118 119 report(severity, msg_type.c_str(), msg, file, line); 120} 121 122sc_actions --- 6 unchanged lines hidden (view full) --- 129} 130 131sc_actions 132sc_report_handler::set_actions(const char *msg_type, sc_actions actions) 133{ 134 if (!msg_type) 135 msg_type = SC_ID_UNKNOWN_ERROR_; 136 |
137 sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type]; | 137 sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap()[msg_type]; |
138 sc_actions previous = info.actions; 139 info.actions = actions; 140 return previous; 141} 142 143sc_actions 144sc_report_handler::set_actions( 145 const char *msg_type, sc_severity severity, sc_actions actions) 146{ 147 if (!msg_type) 148 msg_type = SC_ID_UNKNOWN_ERROR_; 149 | 138 sc_actions previous = info.actions; 139 info.actions = actions; 140 return previous; 141} 142 143sc_actions 144sc_report_handler::set_actions( 145 const char *msg_type, sc_severity severity, sc_actions actions) 146{ 147 if (!msg_type) 148 msg_type = SC_ID_UNKNOWN_ERROR_; 149 |
150 sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type]; | 150 sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap()[msg_type]; |
151 sc_actions previous = info.sevActions[severity]; 152 info.sevActions[severity] = actions; 153 return previous; 154} 155 156int 157sc_report_handler::stop_after(sc_severity severity, int limit) 158{ --- 4 unchanged lines hidden (view full) --- 163} 164 165int 166sc_report_handler::stop_after(const char *msg_type, int limit) 167{ 168 if (!msg_type) 169 msg_type = SC_ID_UNKNOWN_ERROR_; 170 | 151 sc_actions previous = info.sevActions[severity]; 152 info.sevActions[severity] = actions; 153 return previous; 154} 155 156int 157sc_report_handler::stop_after(sc_severity severity, int limit) 158{ --- 4 unchanged lines hidden (view full) --- 163} 164 165int 166sc_report_handler::stop_after(const char *msg_type, int limit) 167{ 168 if (!msg_type) 169 msg_type = SC_ID_UNKNOWN_ERROR_; 170 |
171 sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type]; | 171 sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap()[msg_type]; |
172 int previous = info.limit; 173 info.limit = limit; 174 return previous; 175} 176 177int 178sc_report_handler::stop_after( 179 const char *msg_type, sc_severity severity, int limit) 180{ 181 if (!msg_type) 182 msg_type = SC_ID_UNKNOWN_ERROR_; 183 | 172 int previous = info.limit; 173 info.limit = limit; 174 return previous; 175} 176 177int 178sc_report_handler::stop_after( 179 const char *msg_type, sc_severity severity, int limit) 180{ 181 if (!msg_type) 182 msg_type = SC_ID_UNKNOWN_ERROR_; 183 |
184 sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type]; | 184 sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap()[msg_type]; |
185 int previous = info.sevLimits[severity]; 186 info.sevLimits[severity] = limit; 187 return previous; 188} 189 190int 191sc_report_handler::get_count(sc_severity severity) 192{ 193 return sc_gem5::reportSevInfos[severity].count; 194} 195 196int 197sc_report_handler::get_count(const char *msg_type) 198{ 199 if (!msg_type) 200 msg_type = SC_ID_UNKNOWN_ERROR_; 201 | 185 int previous = info.sevLimits[severity]; 186 info.sevLimits[severity] = limit; 187 return previous; 188} 189 190int 191sc_report_handler::get_count(sc_severity severity) 192{ 193 return sc_gem5::reportSevInfos[severity].count; 194} 195 196int 197sc_report_handler::get_count(const char *msg_type) 198{ 199 if (!msg_type) 200 msg_type = SC_ID_UNKNOWN_ERROR_; 201 |
202 return sc_gem5::reportMsgInfoMap[msg_type].count; | 202 return sc_gem5::reportMsgInfoMap()[msg_type].count; |
203} 204 205int 206sc_report_handler::get_count(const char *msg_type, sc_severity severity) 207{ 208 if (!msg_type) 209 msg_type = SC_ID_UNKNOWN_ERROR_; 210 | 203} 204 205int 206sc_report_handler::get_count(const char *msg_type, sc_severity severity) 207{ 208 if (!msg_type) 209 msg_type = SC_ID_UNKNOWN_ERROR_; 210 |
211 return sc_gem5::reportMsgInfoMap[msg_type].sevCounts[severity]; | 211 return sc_gem5::reportMsgInfoMap()[msg_type].sevCounts[severity]; |
212} 213 214int 215sc_report_handler::set_verbosity_level(int vl) 216{ 217 int previous = sc_gem5::reportVerbosityLevel; 218 sc_gem5::reportVerbosityLevel = vl; 219 return previous; --- 196 unchanged lines hidden --- | 212} 213 214int 215sc_report_handler::set_verbosity_level(int vl) 216{ 217 int previous = sc_gem5::reportVerbosityLevel; 218 sc_gem5::reportVerbosityLevel = vl; 219 return previous; --- 196 unchanged lines hidden --- |