sc_report.cc (13157:ca4c4e2552f2) sc_report.cc (13313:306a97d3b040)
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

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

27 * Authors: Gabe Black
28 */
29
30#include <cstring>
31
32#include "base/logging.hh"
33#include "systemc/ext/utils/sc_report.hh"
34#include "systemc/ext/utils/sc_report_handler.hh"
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

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

27 * Authors: Gabe Black
28 */
29
30#include <cstring>
31
32#include "base/logging.hh"
33#include "systemc/ext/utils/sc_report.hh"
34#include "systemc/ext/utils/sc_report_handler.hh"
35#include "systemc/utils/report.hh"
35
36namespace sc_core
37{
38
39sc_report::sc_report(sc_severity _severity, const char *msg_type,
40 const char *msg, int _verbosity, const char *_fileName,
41 int _lineNumber, sc_time _time, const char *_processName, int _id) :
42 _severity(_severity), _msgType(msg_type), _msg(msg),

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

82sc_report::what() const throw()
83{
84 return _what.c_str();
85}
86
87const char *
88sc_report::get_message(int id)
89{
36
37namespace sc_core
38{
39
40sc_report::sc_report(sc_severity _severity, const char *msg_type,
41 const char *msg, int _verbosity, const char *_fileName,
42 int _lineNumber, sc_time _time, const char *_processName, int _id) :
43 _severity(_severity), _msgType(msg_type), _msg(msg),

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

83sc_report::what() const throw()
84{
85 return _what.c_str();
86}
87
88const char *
89sc_report::get_message(int id)
90{
90 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
91 return "";
91 auto it = sc_gem5::reportIdToMsgMap.find(id);
92 if (it == sc_gem5::reportIdToMsgMap.end())
93 return "unknown id";
94 else
95 return it->second.c_str();
92}
93
94bool
95sc_report::is_suppressed(int id)
96{
96}
97
98bool
99sc_report::is_suppressed(int id)
100{
97 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
98 return false;
101 auto it = sc_gem5::reportIdToMsgMap.find(id);
102 if (it == sc_gem5::reportIdToMsgMap.end())
103 return false;
104
105 return sc_gem5::reportMsgInfoMap[it->second].actions == SC_DO_NOTHING;
99}
100
101void
106}
107
108void
102sc_report::make_warnings_errors(bool)
109sc_report::make_warnings_errors(bool val)
103{
110{
104 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
111 sc_gem5::reportWarningsAsErrors = val;
105}
106
107void
108sc_report::register_id(int id, const char *msg)
109{
112}
113
114void
115sc_report::register_id(int id, const char *msg)
116{
110 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
117 if (id < 0) {
118 SC_REPORT_ERROR("(E800) register_id failed", "invalid report id");
119 return;
120 }
121 if (!msg) {
122 SC_REPORT_ERROR("(E800) register_id failed", "invalid report message");
123 return;
124 }
125 auto p = sc_gem5::reportIdToMsgMap.insert(
126 std::pair<int, std::string>(id, msg));
127 if (!p.second) {
128 SC_REPORT_ERROR("(E800) register_id failed",
129 "report id already exists");
130 } else {
131 sc_gem5::reportMsgInfoMap[msg].id = id;
132 }
111}
112
113void
133}
134
135void
114sc_report::suppress_id(int id, bool)
136sc_report::suppress_id(int id, bool suppress)
115{
137{
116 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
138 auto it = sc_gem5::reportIdToMsgMap.find(id);
139 if (it == sc_gem5::reportIdToMsgMap.end())
140 return;
141
142 if (suppress)
143 sc_gem5::reportMsgInfoMap[it->second].actions = SC_DO_NOTHING;
144 else
145 sc_gem5::reportMsgInfoMap[it->second].actions = SC_UNSPECIFIED;
117}
118
119void
146}
147
148void
120sc_report::suppress_infos(bool)
149sc_report::suppress_infos(bool suppress)
121{
150{
122 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
151 if (suppress)
152 sc_gem5::reportSevInfos[SC_INFO].actions = SC_DO_NOTHING;
153 else
154 sc_gem5::reportSevInfos[SC_INFO].actions = SC_DEFAULT_INFO_ACTIONS;
123}
124
125void
155}
156
157void
126sc_report::suppress_warnings(bool)
158sc_report::suppress_warnings(bool suppress)
127{
159{
128 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
160 if (suppress) {
161 sc_gem5::reportSevInfos[SC_WARNING].actions = SC_DO_NOTHING;
162 } else {
163 sc_gem5::reportSevInfos[SC_WARNING].actions =
164 SC_DEFAULT_WARNING_ACTIONS;
165 }
129}
130
131void
132sc_abort()
133{
134 panic("simulation aborted");
135}
136
137} // namespace sc_core
166}
167
168void
169sc_abort()
170{
171 panic("simulation aborted");
172}
173
174} // namespace sc_core