Skip to content

Commit 90b04e3

Browse files
author
Daniel Kroening
committed
messaget formatting manipulators are now static data members
1 parent 5095eab commit 90b04e3

File tree

5 files changed

+23
-35
lines changed

5 files changed

+23
-35
lines changed

src/cbmc/all_properties.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,11 @@ void bmc_all_propertiest::report(const cover_goalst &cover_goals)
164164
<< goal_pair.second.description << ": ";
165165

166166
if(goal_pair.second.status == goalt::statust::SUCCESS)
167-
result() << green();
167+
result() << green;
168168
else
169-
result() << red();
169+
result() << red;
170170

171-
result() << goal_pair.second.status_string() << reset() << eom;
171+
result() << goal_pair.second.status_string() << reset << eom;
172172
}
173173

174174
if(bmc.options.get_bool_option("trace"))

src/cbmc/bmc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ bmct::run_decision_procedure(prop_convt &prop_conv)
153153

154154
void bmct::report_success()
155155
{
156-
result() << bold() << "VERIFICATION SUCCESSFUL" << reset() << eom;
156+
result() << bold << "VERIFICATION SUCCESSFUL" << reset << eom;
157157

158158
switch(ui_message_handler.get_ui())
159159
{
@@ -180,7 +180,7 @@ void bmct::report_success()
180180

181181
void bmct::report_failure()
182182
{
183-
result() << bold() << "VERIFICATION FAILED" << reset() << eom;
183+
result() << bold << "VERIFICATION FAILED" << reset << eom;
184184

185185
switch(ui_message_handler.get_ui())
186186
{

src/goto-analyzer/static_verifier.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,22 +232,22 @@ bool static_verifier(
232232

233233
if(e.is_true())
234234
{
235-
m.result() << m.green() << "Success" << m.reset();
235+
m.result() << m.green << "Success" << m.reset;
236236
pass++;
237237
}
238238
else if(e.is_false())
239239
{
240-
m.result() << m.red() << "Failure" << m.reset() << " (if reachable)";
240+
m.result() << m.red << "Failure" << m.reset << " (if reachable)";
241241
fail++;
242242
}
243243
else if(domain.is_bottom())
244244
{
245-
m.result() << m.green() << "Success" << m.reset() << " (unreachable)";
245+
m.result() << m.green << "Success" << m.reset << " (unreachable)";
246246
pass++;
247247
}
248248
else
249249
{
250-
m.result() << m.yellow() << "Unknown" << m.reset();
250+
m.result() << m.yellow << "Unknown" << m.reset;
251251
unknown++;
252252
}
253253

@@ -258,11 +258,11 @@ bool static_verifier(
258258
}
259259
}
260260

261-
m.status() << m.bold() << "Summary: "
261+
m.status() << m.bold << "Summary: "
262262
<< pass << " pass, "
263263
<< fail << " fail if reachable, "
264264
<< unknown << " unknown"
265-
<< m.reset() << messaget::eom;
265+
<< m.reset << messaget::eom;
266266

267267
return false;
268268
}

src/util/message.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,15 @@ messaget::~messaget()
7171
// Visual studio requires this (empty) static object
7272
messaget::eomt messaget::eom;
7373

74+
const messaget::commandt messaget::reset(0);
75+
const messaget::commandt messaget::bold(1);
7476
const messaget::commandt messaget::faint(2);
7577
const messaget::commandt messaget::italic(3);
7678
const messaget::commandt messaget::underline(4);
79+
const messaget::commandt messaget::red(31);
80+
const messaget::commandt messaget::green(32);
81+
const messaget::commandt messaget::yellow(33);
82+
const messaget::commandt messaget::blue(34);
7783

7884
/// Parse a (user-)provided string as a verbosity level and set it as the
7985
/// verbosity of dest.

src/util/message.h

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -303,40 +303,22 @@ class messaget
303303

304304
/// return to default formatting,
305305
/// as defined by the terminal
306-
static commandt reset()
307-
{
308-
return command(0);
309-
}
306+
static const commandt reset;
310307

311308
/// render text with red foreground color
312-
static commandt red()
313-
{
314-
return command(31);
315-
}
309+
static const commandt red;
316310

317311
/// render text with green foreground color
318-
static commandt green()
319-
{
320-
return command(32);
321-
}
312+
static const commandt green;
322313

323314
/// render text with yellow foreground color
324-
static commandt yellow()
325-
{
326-
return command(33);
327-
}
315+
static const commandt yellow;
328316

329317
/// render text with blue foreground color
330-
static commandt blue()
331-
{
332-
return command(34);
333-
}
318+
static const commandt blue;
334319

335320
/// render text with bold font
336-
static commandt bold()
337-
{
338-
return command(1);
339-
}
321+
static const commandt bold;
340322

341323
/// render text with faint font
342324
static const commandt faint;

0 commit comments

Comments
 (0)