Skip to content

Commit bcb7c76

Browse files
author
Daniel Kroening
authored
Merge pull request diffblue#2747 from diffblue/cleanup-message-handler
Cleanup message handler
2 parents 85a81ea + 0d8ea2c commit bcb7c76

File tree

6 files changed

+11
-29
lines changed

6 files changed

+11
-29
lines changed

src/util/cout_message.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ void console_message_handlert::flush(unsigned level)
100100
void gcc_message_handlert::print(
101101
unsigned level,
102102
const std::string &message,
103-
int,
104103
const source_locationt &location)
105104
{
106105
const irep_idt file=location.get_file();

src/util/cout_message.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ class gcc_message_handlert:public ui_message_handlert
6060
virtual void print(
6161
unsigned level,
6262
const std::string &message,
63-
int sequence_number,
6463
const source_locationt &location) override;
6564
};
6665

src/util/message.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Author: Daniel Kroening, [email protected]
1414
void message_handlert::print(
1515
unsigned level,
1616
const std::string &message,
17-
int,
1817
const source_locationt &location)
1918
{
2019
std::string dest;
@@ -92,7 +91,6 @@ unsigned messaget::eval_verbosity(
9291
messaget::M_WARNING,
9392
"verbosity value " + user_input + " out of range, using debug-level (" +
9493
std::to_string(messaget::M_DEBUG) + ") verbosity",
95-
-1,
9694
source_locationt());
9795

9896
v = messaget::M_DEBUG;

src/util/message.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class message_handlert
5050
virtual void print(
5151
unsigned level,
5252
const std::string &message,
53-
int sequence_number,
5453
const source_locationt &location);
5554

5655
virtual void flush(unsigned level)
@@ -65,7 +64,7 @@ class message_handlert
6564
void set_verbosity(unsigned _verbosity) { verbosity=_verbosity; }
6665
unsigned get_verbosity() const { return verbosity; }
6766

68-
unsigned get_message_count(unsigned level) const
67+
std::size_t get_message_count(unsigned level) const
6968
{
7069
if(level>=message_count.size())
7170
return 0;
@@ -75,7 +74,7 @@ class message_handlert
7574

7675
protected:
7776
unsigned verbosity;
78-
std::vector<unsigned> message_count;
77+
std::vector<std::size_t> message_count;
7978
};
8079

8180
class null_message_handlert:public message_handlert
@@ -89,7 +88,6 @@ class null_message_handlert:public message_handlert
8988
virtual void print(
9089
unsigned level,
9190
const std::string &message,
92-
int,
9391
const source_locationt &)
9492
{
9593
print(level, message);
@@ -276,7 +274,6 @@ class messaget
276274
m.message.message_handler->print(
277275
m.message_level,
278276
m.str(),
279-
-1,
280277
m.source_location);
281278
m.message.message_handler->flush(m.message_level);
282279
}

src/util/ui_message.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void ui_message_handlert::print(
149149
{
150150
source_locationt location;
151151
location.make_nil();
152-
print(level, message, -1, location);
152+
print(level, message, location);
153153
if(always_flush)
154154
flush(level);
155155
}
@@ -206,7 +206,6 @@ void ui_message_handlert::print(
206206
void ui_message_handlert::print(
207207
unsigned level,
208208
const std::string &message,
209-
int sequence_number,
210209
const source_locationt &location)
211210
{
212211
message_handlert::print(level, message);
@@ -217,7 +216,7 @@ void ui_message_handlert::print(
217216
{
218217
case uit::PLAIN:
219218
message_handlert::print(
220-
level, message, sequence_number, location);
219+
level, message, location);
221220
break;
222221

223222
case uit::XML_UI:
@@ -230,10 +229,7 @@ void ui_message_handlert::print(
230229

231230
const char *type=level_string(level);
232231

233-
std::string sequence_number_str=
234-
sequence_number>=0?std::to_string(sequence_number):"";
235-
236-
ui_msg(type, tmp_message, sequence_number_str, location);
232+
ui_msg(type, tmp_message, location);
237233
}
238234
break;
239235
}
@@ -242,8 +238,7 @@ void ui_message_handlert::print(
242238

243239
void ui_message_handlert::ui_msg(
244240
const std::string &type,
245-
const std::string &msg1,
246-
const std::string &msg2,
241+
const std::string &msg,
247242
const source_locationt &location)
248243
{
249244
switch(get_ui())
@@ -252,19 +247,18 @@ void ui_message_handlert::ui_msg(
252247
break;
253248

254249
case uit::XML_UI:
255-
xml_ui_msg(type, msg1, msg2, location);
250+
xml_ui_msg(type, msg, location);
256251
break;
257252

258253
case uit::JSON_UI:
259-
json_ui_msg(type, msg1, msg2, location);
254+
json_ui_msg(type, msg, location);
260255
break;
261256
}
262257
}
263258

264259
void ui_message_handlert::xml_ui_msg(
265260
const std::string &type,
266261
const std::string &msg1,
267-
const std::string &,
268262
const source_locationt &location)
269263
{
270264
xmlt result;
@@ -287,7 +281,6 @@ void ui_message_handlert::xml_ui_msg(
287281
void ui_message_handlert::json_ui_msg(
288282
const std::string &type,
289283
const std::string &msg1,
290-
const std::string &,
291284
const source_locationt &location)
292285
{
293286
INVARIANT(json_stream, "JSON stream must be initialized before use");

src/util/ui_message.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class ui_message_handlert : public message_handlert
7171
virtual void print(
7272
unsigned level,
7373
const std::string &message,
74-
int sequence_number,
7574
const source_locationt &location) override;
7675

7776
virtual void print(
@@ -84,20 +83,17 @@ class ui_message_handlert : public message_handlert
8483

8584
virtual void xml_ui_msg(
8685
const std::string &type,
87-
const std::string &msg1,
88-
const std::string &msg2,
86+
const std::string &msg,
8987
const source_locationt &location);
9088

9189
virtual void json_ui_msg(
9290
const std::string &type,
93-
const std::string &msg1,
94-
const std::string &msg2,
91+
const std::string &msg,
9592
const source_locationt &location);
9693

9794
virtual void ui_msg(
9895
const std::string &type,
99-
const std::string &msg1,
100-
const std::string &msg2,
96+
const std::string &msg,
10197
const source_locationt &location);
10298

10399
const char *level_string(unsigned level);

0 commit comments

Comments
 (0)