Skip to content

Commit 942f55b

Browse files
authored
Merge pull request #5622 from tautschnig/messaget-smt2_dec
smt2_dect isn't a messaget
2 parents 46b3f01 + 2d4bd5a commit 942f55b

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

src/goto-checker/solver_factory.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,12 @@ solver_factoryt::get_smt2(smt2_dect::solvert solver)
343343
"cbmc",
344344
std::string("Generated by CBMC ") + CBMC_VERSION,
345345
"QF_AUFBV",
346-
solver);
347-
smt2_dec->set_message_handler(message_handler);
346+
solver,
347+
message_handler);
348348

349349
if(options.get_bool_option("fpa"))
350350
smt2_dec->use_FPA_theory = true;
351351

352-
smt2_dec->set_message_handler(message_handler);
353-
354352
set_decision_procedure_time_limit(*smt2_dec);
355353
return util_make_unique<solvert>(std::move(smt2_dec));
356354
}

src/goto-instrument/accelerate/scratch_program.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class scratch_programt:public goto_programt
5050
symex(mh, symbol_table, equation, options, path_storage, guard_manager),
5151
satcheck(util_make_unique<satcheckt>(mh)),
5252
satchecker(ns, *satcheck, mh),
53-
z3(ns, "accelerate", "", "", smt2_dect::solvert::Z3),
53+
z3(ns, "accelerate", "", "", smt2_dect::solvert::Z3, mh),
5454
checker(&z3) // checker(&satchecker)
5555
{
5656
}

src/solvers/smt2/smt2_dec.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Author: Daniel Kroening, [email protected]
1111
#include <util/arith_tools.h>
1212
#include <util/ieee_float.h>
1313
#include <util/invariant.h>
14+
#include <util/message.h>
1415
#include <util/run.h>
1516
#include <util/std_expr.h>
1617
#include <util/std_types.h>
@@ -122,7 +123,8 @@ decision_proceduret::resultt smt2_dect::dec_solve()
122123

123124
if(res<0)
124125
{
125-
error() << "error running SMT2 solver" << eom;
126+
messaget log{message_handler};
127+
log.error() << "error running SMT2 solver" << messaget::eom;
126128
return decision_proceduret::resultt::D_ERROR;
127129
}
128130

@@ -143,7 +145,7 @@ decision_proceduret::resultt smt2_dect::read_result(std::istream &in)
143145

144146
while(in)
145147
{
146-
auto parsed_opt = smt2irep(in, get_message_handler());
148+
auto parsed_opt = smt2irep(in, message_handler);
147149

148150
if(!parsed_opt.has_value())
149151
break;
@@ -177,8 +179,10 @@ decision_proceduret::resultt smt2_dect::read_result(std::istream &in)
177179
// returns unsat will give an error.
178180
if(res!=resultt::D_UNSATISFIABLE)
179181
{
180-
error() << "SMT2 solver returned error message:\n"
181-
<< "\t\"" << parsed.get_sub()[1].id() <<"\"" << eom;
182+
messaget log{message_handler};
183+
log.error() << "SMT2 solver returned error message:\n"
184+
<< "\t\"" << parsed.get_sub()[1].id() << "\""
185+
<< messaget::eom;
182186
return decision_proceduret::resultt::D_ERROR;
183187
}
184188
}

src/solvers/smt2/smt2_dec.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Author: Daniel Kroening, [email protected]
1212

1313
#include "smt2_conv.h"
1414

15-
#include <util/message.h>
16-
1715
#include <fstream>
1816

17+
class message_handlert;
18+
1919
class smt2_stringstreamt
2020
{
2121
protected:
@@ -24,25 +24,27 @@ class smt2_stringstreamt
2424

2525
/*! \brief Decision procedure interface for various SMT 2.x solvers
2626
*/
27-
class smt2_dect : protected smt2_stringstreamt,
28-
public smt2_convt,
29-
public messaget
27+
class smt2_dect : protected smt2_stringstreamt, public smt2_convt
3028
{
3129
public:
3230
smt2_dect(
3331
const namespacet &_ns,
3432
const std::string &_benchmark,
3533
const std::string &_notes,
3634
const std::string &_logic,
37-
solvert _solver):
38-
smt2_convt(_ns, _benchmark, _notes, _logic, _solver, stringstream)
35+
solvert _solver,
36+
message_handlert &_message_handler)
37+
: smt2_convt(_ns, _benchmark, _notes, _logic, _solver, stringstream),
38+
message_handler(_message_handler)
3939
{
4040
}
4141

4242
resultt dec_solve() override;
4343
std::string decision_procedure_text() const override;
4444

4545
protected:
46+
message_handlert &message_handler;
47+
4648
resultt read_result(std::istream &in);
4749
};
4850

0 commit comments

Comments
 (0)