Address several issues reported by cppcheck all over the place.

* src/bin/common_finput.cc, src/tgbaalgos/lbtt.cc: Use !empty() instead
of size() > 0.
* src/bin/ltl2tgta.cc, src/kripke/kripkeexplicit.cc,
src/tgbatest/complementation.cc: Avoid useless assignments.
* src/bin/ltlcross.cc: Correct mistaken assignment inside assert().
* src/evtgba/symbol.hh, src/tgba/tgbabddcoredata.cc,
src/tgba/tgbabddcoredata.hh,
src/tgba/tgbasafracomplement.cc (operator=): Do not return a const
reference.
* src/evtgbatest/ltl2evtgba.cc, src/evtgbatest/product.cc,
src/evtgbatest/product.cc: Check indices before using them, not after.
* src/kripke/kripkeexplicit.cc, src/kripke/kripkeexplicit.hh,
src/tgbatest/randtgba.cc: Pass constant strings by reference.
* src/kripke/kripkeprint.cc, src/tgbaalgos/simulation.cc:
Remove a useless operation.
* src/ltlvisit/simplify.cc: Remove a duplicate condition.
* src/misc/formater.hh: Remove unused attribute.
* src/misc/modgray.cc: Initialize done_ in the constructor.
* src/saba/explicitstateconjunction.cc,
src/saba/explicitstateconjunction.hh (operator=): Fix prototype.
* src/saba/sabacomplementtgba.cc: Remove unused default constructor.
* src/ta/taexplicit.cc, src/ta/taproduct.cc, src/ta/tgtaproduct.cc,
src/ta/tgtaproduct.hh, src/taalgos/emptinessta.cc,
src/taalgos/minimize.cc, src/taalgos/reachiter.cc,
src/taalgos/tgba2ta.cc, src/tgbaalgos/cutscc.cc: Use C++ casts, and
++it instead of it++.
* src/taalgos/dotty.cc, src/tgbatest/ltl2tgba.cc: Refine the scope of
variables.
* src/tgba/tgbakvcomplement.hh (bdd_order): Always initialize bdd_.
* src/tgba/tgbasgba.cc, src/tgba/wdbacomp.cc: Use the initialization
line to initialize all members.
This commit is contained in:
Alexandre Duret-Lutz 2012-12-20 17:18:56 +01:00
parent a3b49f1108
commit a577850eb3
36 changed files with 117 additions and 123 deletions

View file

@ -94,7 +94,7 @@ job_processor::process_string(const std::string& input,
spot::ltl::parse_error_list pel; spot::ltl::parse_error_list pel;
const spot::ltl::formula* f = parse_formula(input, pel); const spot::ltl::formula* f = parse_formula(input, pel);
if (!f || pel.size() > 0) if (!f || !pel.empty())
{ {
if (filename) if (filename)
error_at_line(0, 0, filename, linenum, "parse error:"); error_at_line(0, 0, filename, linenum, "parse error:");

View file

@ -199,12 +199,11 @@ namespace
if (ta_type != TGTA) if (ta_type != TGTA)
{ {
spot::ta* testing_automaton = 0; spot::ta* testing_automaton =
testing_automaton = tgba_to_ta(aut, ap_set, tgba_to_ta(aut, ap_set, type == spot::postprocessor::BA,
type == spot::postprocessor::BA, opt_with_artificial_initial_state,
opt_with_artificial_initial_state, opt_single_pass_emptiness_check,
opt_single_pass_emptiness_check, opt_with_artificial_livelock);
opt_with_artificial_livelock);
if (level != spot::postprocessor::Low) if (level != spot::postprocessor::Low)
{ {
spot::ta* testing_automaton_nm = testing_automaton; spot::ta* testing_automaton_nm = testing_automaton;

View file

@ -744,7 +744,7 @@ namespace
states_in_acc(neg, sspace, s); states_in_acc(neg, sspace, s);
bool res = s.size() == states; bool res = s.size() == states;
state_set::iterator it; state_set::iterator it;
for (it = s.begin(); it != s.end(); it++) for (it = s.begin(); it != s.end(); ++it)
(*it)->destroy(); (*it)->destroy();
return res; return res;
} }
@ -1001,7 +1001,7 @@ print_stats_csv(const char* filename)
unsigned ntrans = translators.size(); unsigned ntrans = translators.size();
unsigned rounds = vstats.size(); unsigned rounds = vstats.size();
assert(rounds = formulas.size()); assert(rounds == formulas.size());
*out << "\"formula\", \"tool\", "; *out << "\"formula\", \"tool\", ";
statistics::fields(*out); statistics::fields(*out);
@ -1039,7 +1039,7 @@ print_stats_json(const char* filename)
unsigned ntrans = translators.size(); unsigned ntrans = translators.size();
unsigned rounds = vstats.size(); unsigned rounds = vstats.size();
assert(rounds = formulas.size()); assert(rounds == formulas.size());
*out << "{\n \"tools\": [\n \""; *out << "{\n \"tools\": [\n \"";
spot::escape_str(*out, translators[0]); spot::escape_str(*out, translators[0]);

View file

@ -83,7 +83,7 @@ namespace spot
return s_; return s_;
} }
const rsymbol& rsymbol&
operator=(const rsymbol& rs) operator=(const rsymbol& rs)
{ {
if (this != &rs) if (this != &rs)

View file

@ -58,7 +58,7 @@ main(int argc, char** argv)
spot::ltl::environment& env(spot::ltl::default_environment::instance()); spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::ltl::atomic_prop_set* unobservables = new spot::ltl::atomic_prop_set; spot::ltl::atomic_prop_set* unobservables = new spot::ltl::atomic_prop_set;
while (argv[formula_index][0] == '-' && formula_index < argc) while (formula_index < argc && argv[formula_index][0] == '-')
{ {
if (!strcmp(argv[formula_index], "-d")) if (!strcmp(argv[formula_index], "-d"))
{ {

View file

@ -1,8 +1,9 @@
// Copyright (C) 2008 Laboratoire de Recherche et Développement // -*- coding: utf-8 -*-
// Copyright (C) 2008, 2012 Laboratoire de Recherche et Développement
// de l'Epita (LRDE). // de l'Epita (LRDE).
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris // Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), // 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie. // Université Pierre et Marie Curie.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -47,7 +48,7 @@ main(int argc, char** argv)
bool dotty = false; bool dotty = false;
int filename_index = 1; int filename_index = 1;
while (argv[filename_index][0] == '-' && filename_index < argc) while (filename_index < argc && argv[filename_index][0] == '-')
{ {
if (!strcmp(argv[filename_index], "-d")) if (!strcmp(argv[filename_index], "-d"))
debug = true; debug = true;

View file

@ -1,4 +1,4 @@
// Copyright (C) 2011 Laboratoire de Recherche et Developpement // Copyright (C) 2011, 2012 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE) // de l'Epita (LRDE)
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -153,7 +153,7 @@ namespace spot
{ {
dict_->unregister_all_my_variables(this); dict_->unregister_all_my_variables(this);
std::map<const std::string, state_kripke*>::iterator it; std::map<const std::string, state_kripke*>::iterator it;
for (it = ns_nodes_.begin(); it != ns_nodes_.end(); it++) for (it = ns_nodes_.begin(); it != ns_nodes_.end(); ++it)
{ {
state_kripke* del_me = it->second; state_kripke* del_me = it->second;
delete del_me; delete del_me;
@ -195,7 +195,7 @@ namespace spot
} }
bdd bdd
kripke_explicit::state_condition(const std::string name) const kripke_explicit::state_condition(const std::string& name) const
{ {
std::map<const std::string, state_kripke*>::const_iterator it; std::map<const std::string, state_kripke*>::const_iterator it;
it = ns_nodes_.find(name); it = ns_nodes_.find(name);
@ -247,13 +247,12 @@ namespace spot
void kripke_explicit::add_transition(std::string source, void kripke_explicit::add_transition(std::string source,
std::string dest) std::string dest)
{ {
state_kripke* neo = 0;
std::map<std::string, state_kripke*>::iterator destination std::map<std::string, state_kripke*>::iterator destination
= ns_nodes_.find(dest); = ns_nodes_.find(dest);
if (ns_nodes_.find(dest) == ns_nodes_.end()) if (ns_nodes_.find(dest) == ns_nodes_.end())
{ {
neo = new state_kripke; state_kripke* neo = new state_kripke;
add_state(dest, neo); add_state(dest, neo);
add_transition(source, neo); add_transition(source, neo);
} }

View file

@ -131,7 +131,7 @@ namespace spot
/// \brief Get the condition on the state /// \brief Get the condition on the state
bdd state_condition(const state* s) const; bdd state_condition(const state* s) const;
/// \brief Get the condition on the state /// \brief Get the condition on the state
bdd state_condition(const std::string) const; bdd state_condition(const std::string&) const;
/// \brief Return the name of the state. /// \brief Return the name of the state.
std::string format_state(const state*) const; std::string format_state(const state*) const;

View file

@ -1,3 +1,4 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012 Laboratoire de Recherche et Developpement // Copyright (C) 2011, 2012 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE) // de l'Epita (LRDE)
// //
@ -88,7 +89,6 @@ namespace spot
notfirst = true; notfirst = true;
const bdd_dict* d = aut_->get_dict(); const bdd_dict* d = aut_->get_dict();
std::string cur = aut_->format_state(s);
os_ << "S" << in_s << ", \""; os_ << "S" << in_s << ", \"";
const kripke* automata = down_cast<const kripke*>(aut_); const kripke* automata = down_cast<const kripke*>(aut_);
assert(automata); assert(automata);

View file

@ -2388,7 +2388,6 @@ namespace spot
&& (op != multop::AndNLM) && (op != multop::AndNLM)
&& (op != multop::OrRat) && (op != multop::OrRat)
&& (op != multop::Concat) && (op != multop::Concat)
&& (op != multop::Concat)
&& (op != multop::Fusion)) && (op != multop::Fusion))
{ {
bool is_and = op == multop::And; bool is_and = op == multop::And;
@ -2442,7 +2441,7 @@ namespace spot
else if (c_->implication_neg(*f1, *f2, is_and)) else if (c_->implication_neg(*f1, *f2, is_and))
{ {
for (multop::vec::iterator j = res->begin(); for (multop::vec::iterator j = res->begin();
j != res->end(); j++) j != res->end(); ++j)
if (*j) if (*j)
(*j)->destroy(); (*j)->destroy();
delete res; delete res;

View file

@ -180,7 +180,6 @@ namespace spot
std::vector<const printable*> call_; std::vector<const printable*> call_;
protected: protected:
std::ostream* output_; std::ostream* output_;
const char* pos_;
}; };
} }

View file

@ -1,5 +1,8 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012 Laboratoire de Recherche et Développement de
// l'Epita (LRDE).
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre // département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie. // et Marie Curie.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -24,7 +27,7 @@ namespace spot
loopless_modular_mixed_radix_gray_code:: loopless_modular_mixed_radix_gray_code::
loopless_modular_mixed_radix_gray_code(int n) loopless_modular_mixed_radix_gray_code(int n)
: n_(n), a_(0), f_(0), m_(0), s_(0), non_one_radixes_(0) : n_(n), done_(false), a_(0), f_(0), m_(0), s_(0), non_one_radixes_(0)
{ {
} }

View file

@ -1,4 +1,5 @@
// Copyright (C) 2009 Laboratoire de Recherche et Développement // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2012 Laboratoire de Recherche et Développement
// de l'Epita (LRDE). // de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -34,7 +35,7 @@ namespace spot
{ {
} }
explicit_state_conjunction* explicit_state_conjunction&
explicit_state_conjunction::operator=(const explicit_state_conjunction& o) explicit_state_conjunction::operator=(const explicit_state_conjunction& o)
{ {
if (this != &o) if (this != &o)
@ -42,7 +43,7 @@ namespace spot
this->~explicit_state_conjunction(); this->~explicit_state_conjunction();
new (this) explicit_state_conjunction(&o); new (this) explicit_state_conjunction(&o);
} }
return this; return *this;
} }
explicit_state_conjunction::~explicit_state_conjunction() explicit_state_conjunction::~explicit_state_conjunction()

View file

@ -1,4 +1,5 @@
// Copyright (C) 2009 Laboratoire de Recherche et Développement // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2012 Laboratoire de Recherche et Développement
// de l'Epita (LRDE). // de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -37,7 +38,7 @@ namespace spot
explicit_state_conjunction(const explicit_state_conjunction* other); explicit_state_conjunction(const explicit_state_conjunction* other);
virtual ~explicit_state_conjunction(); virtual ~explicit_state_conjunction();
explicit_state_conjunction* operator=(const explicit_state_conjunction& o); explicit_state_conjunction& operator=(const explicit_state_conjunction& o);
/// \name Iteration /// \name Iteration
//@{ //@{

View file

@ -1,5 +1,6 @@
// Copyright (C) 2009, 2010, 2011 Laboratoire de Recherche et Développement // -*- coding: utf-8 -*-
// de l'Epita (LRDE). // Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -68,10 +69,6 @@ namespace spot
bdd condition_; bdd condition_;
}; };
saba_state_complement_tgba::saba_state_complement_tgba()
{
}
saba_state_complement_tgba::saba_state_complement_tgba(shared_state state, saba_state_complement_tgba::saba_state_complement_tgba(shared_state state,
rank_t rank, rank_t rank,
bdd condition) bdd condition)

View file

@ -151,7 +151,7 @@ namespace spot
bool transition_found = false; bool transition_found = false;
for (it_trans = trans_by_condition->begin(); (it_trans for (it_trans = trans_by_condition->begin(); (it_trans
!= trans_by_condition->end() && !transition_found); it_trans++) != trans_by_condition->end() && !transition_found); ++it_trans)
{ {
transition_found = ((*it_trans)->dest == t->dest); transition_found = ((*it_trans)->dest == t->dest);
if (transition_found) if (transition_found)
@ -240,7 +240,7 @@ namespace spot
int int
state_ta_explicit::compare(const spot::state* other) const state_ta_explicit::compare(const spot::state* other) const
{ {
const state_ta_explicit* o = down_cast<const state_ta_explicit*> (other); const state_ta_explicit* o = down_cast<const state_ta_explicit*>(other);
assert(o); assert(o);
int compare_value = tgba_state_->compare(o->tgba_state_); int compare_value = tgba_state_->compare(o->tgba_state_);
@ -286,7 +286,8 @@ namespace spot
state_ta_explicit* dest = (*it_trans)->dest; state_ta_explicit* dest = (*it_trans)->dest;
bool is_stuttering_transition = (get_tgba_condition() bool is_stuttering_transition = (get_tgba_condition()
== (dest)->get_tgba_condition()); == (dest)->get_tgba_condition());
bool dest_is_livelock_accepting = dest->is_livelock_accepting_state(); bool dest_is_livelock_accepting =
dest->is_livelock_accepting_state();
//Before deleting stuttering transitions, propaged back livelock //Before deleting stuttering transitions, propaged back livelock
//and initial state's properties //and initial state's properties
@ -329,7 +330,7 @@ namespace spot
// We don't destroy the transitions in the state's destructor because // We don't destroy the transitions in the state's destructor because
// they are not cloned. // they are not cloned.
if (trans != 0) if (trans != 0)
for (it_trans = trans->begin(); it_trans != trans->end(); it_trans++) for (it_trans = trans->begin(); it_trans != trans->end(); ++it_trans)
{ {
delete *it_trans; delete *it_trans;
} }
@ -369,9 +370,9 @@ namespace spot
ta_explicit::~ta_explicit() ta_explicit::~ta_explicit()
{ {
ta::states_set_t::iterator it; ta::states_set_t::iterator it;
for (it = states_set_.begin(); it != states_set_.end(); it++) for (it = states_set_.begin(); it != states_set_.end(); ++it)
{ {
state_ta_explicit* s = down_cast<state_ta_explicit*> (*it); state_ta_explicit* s = down_cast<state_ta_explicit*>(*it);
s->free_transitions(); s->free_transitions();
s->get_tgba_state()->destroy(); s->get_tgba_state()->destroy();
@ -388,14 +389,13 @@ namespace spot
std::pair<ta::states_set_t::iterator, bool> add_state_to_ta = std::pair<ta::states_set_t::iterator, bool> add_state_to_ta =
states_set_.insert(s); states_set_.insert(s);
return static_cast<state_ta_explicit*> (*add_state_to_ta.first); return static_cast<state_ta_explicit*>(*add_state_to_ta.first);
} }
void void
ta_explicit::add_to_initial_states_set(state* state, bdd condition) ta_explicit::add_to_initial_states_set(state* state, bdd condition)
{ {
state_ta_explicit * s = down_cast<state_ta_explicit*> (state); state_ta_explicit* s = down_cast<state_ta_explicit*>(state);
assert(s);
s->set_initial_state(true); s->set_initial_state(true);
if (condition == bddfalse) if (condition == bddfalse)
condition = get_state_condition(s); condition = get_state_condition(s);
@ -403,15 +403,17 @@ namespace spot
initial_states_set_.insert(s); initial_states_set_.insert(s);
if (get_artificial_initial_state() != 0) if (get_artificial_initial_state() != 0)
if (add_state.second) if (add_state.second)
create_transition((state_ta_explicit*) get_artificial_initial_state(), {
condition, bddfalse, s); state_ta_explicit* i =
down_cast<state_ta_explicit*>(get_artificial_initial_state());
create_transition(i, condition, bddfalse, s);
}
} }
void void
ta_explicit::delete_stuttering_and_hole_successors(spot::state* s) ta_explicit::delete_stuttering_and_hole_successors(spot::state* s)
{ {
state_ta_explicit * state = down_cast<state_ta_explicit*> (s); state_ta_explicit * state = down_cast<state_ta_explicit*>(s);
assert(state); assert(state);
state->delete_stuttering_and_hole_successors(); state->delete_stuttering_and_hole_successors();
if (state->is_initial_state()) if (state->is_initial_state())
@ -421,7 +423,8 @@ namespace spot
void void
ta_explicit::create_transition(state_ta_explicit* source, bdd condition, ta_explicit::create_transition(state_ta_explicit* source, bdd condition,
bdd acceptance_conditions, state_ta_explicit* dest, bool add_at_beginning) bdd acceptance_conditions,
state_ta_explicit* dest, bool add_at_beginning)
{ {
state_ta_explicit::transition* t = new state_ta_explicit::transition; state_ta_explicit::transition* t = new state_ta_explicit::transition;
t->dest = dest; t->dest = dest;
@ -442,7 +445,7 @@ namespace spot
ta_explicit::get_state_condition(const spot::state* initial_state) const ta_explicit::get_state_condition(const spot::state* initial_state) const
{ {
const state_ta_explicit* sta = const state_ta_explicit* sta =
down_cast<const state_ta_explicit*> (initial_state); down_cast<const state_ta_explicit*>(initial_state);
assert(sta); assert(sta);
return sta->get_tgba_condition(); return sta->get_tgba_condition();
} }
@ -450,7 +453,7 @@ namespace spot
bool bool
ta_explicit::is_accepting_state(const spot::state* s) const ta_explicit::is_accepting_state(const spot::state* s) const
{ {
const state_ta_explicit* sta = down_cast<const state_ta_explicit*> (s); const state_ta_explicit* sta = down_cast<const state_ta_explicit*>(s);
assert(sta); assert(sta);
return sta->is_accepting_state(); return sta->is_accepting_state();
} }
@ -458,7 +461,7 @@ namespace spot
bool bool
ta_explicit::is_initial_state(const spot::state* s) const ta_explicit::is_initial_state(const spot::state* s) const
{ {
const state_ta_explicit* sta = down_cast<const state_ta_explicit*> (s); const state_ta_explicit* sta = down_cast<const state_ta_explicit*>(s);
assert(sta); assert(sta);
return sta->is_initial_state(); return sta->is_initial_state();
} }
@ -466,7 +469,7 @@ namespace spot
bool bool
ta_explicit::is_livelock_accepting_state(const spot::state* s) const ta_explicit::is_livelock_accepting_state(const spot::state* s) const
{ {
const state_ta_explicit* sta = down_cast<const state_ta_explicit*> (s); const state_ta_explicit* sta = down_cast<const state_ta_explicit*>(s);
assert(sta); assert(sta);
return sta->is_livelock_accepting_state(); return sta->is_livelock_accepting_state();
} }
@ -474,7 +477,7 @@ namespace spot
ta_succ_iterator* ta_succ_iterator*
ta_explicit::succ_iter(const spot::state* state) const ta_explicit::succ_iter(const spot::state* state) const
{ {
const state_ta_explicit* s = down_cast<const state_ta_explicit*> (state); const state_ta_explicit* s = down_cast<const state_ta_explicit*>(state);
assert(s); assert(s);
return new ta_explicit_succ_iterator(s); return new ta_explicit_succ_iterator(s);
} }
@ -482,7 +485,7 @@ namespace spot
ta_succ_iterator* ta_succ_iterator*
ta_explicit::succ_iter(const spot::state* state, bdd condition) const ta_explicit::succ_iter(const spot::state* state, bdd condition) const
{ {
const state_ta_explicit* s = down_cast<const state_ta_explicit*> (state); const state_ta_explicit* s = down_cast<const state_ta_explicit*>(state);
assert(s); assert(s);
return new ta_explicit_succ_iterator(s, condition); return new ta_explicit_succ_iterator(s, condition);
} }
@ -502,7 +505,7 @@ namespace spot
std::string std::string
ta_explicit::format_state(const spot::state* s) const ta_explicit::format_state(const spot::state* s) const
{ {
const state_ta_explicit* sta = down_cast<const state_ta_explicit*> (s); const state_ta_explicit* sta = down_cast<const state_ta_explicit*>(s);
assert(sta); assert(sta);
if (sta->get_tgba_condition() == bddtrue) if (sta->get_tgba_condition() == bddtrue)
@ -517,11 +520,11 @@ namespace spot
ta_explicit::delete_stuttering_transitions() ta_explicit::delete_stuttering_transitions()
{ {
ta::states_set_t::iterator it; ta::states_set_t::iterator it;
for (it = states_set_.begin(); it != states_set_.end(); it++) for (it = states_set_.begin(); it != states_set_.end(); ++it)
{ {
const state_ta_explicit* source = const state_ta_explicit* source =
static_cast<const state_ta_explicit*> (*it); static_cast<const state_ta_explicit*>(*it);
state_ta_explicit::transitions* trans = source->get_transitions(); state_ta_explicit::transitions* trans = source->get_transitions();
state_ta_explicit::transitions::iterator it_trans; state_ta_explicit::transitions::iterator it_trans;

View file

@ -288,7 +288,7 @@ namespace spot
ta_init_states_set = ta_->get_initial_states_set(); ta_init_states_set = ta_->get_initial_states_set();
} }
for (it = ta_init_states_set.begin(); it != ta_init_states_set.end(); it++) for (it = ta_init_states_set.begin(); it != ta_init_states_set.end(); ++it)
{ {
if ((artificial_initial_state != 0) || (kripke_init_state_condition if ((artificial_initial_state != 0) || (kripke_init_state_condition

View file

@ -1,3 +1,4 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012 Laboratoire de Recherche et Developpement // Copyright (C) 2012 Laboratoire de Recherche et Developpement
// de l Epita (LRDE). // de l Epita (LRDE).
// //
@ -64,8 +65,9 @@ namespace spot
fixed_size_pool* p = const_cast<fixed_size_pool*> (&pool_); fixed_size_pool* p = const_cast<fixed_size_pool*> (&pool_);
return new tgta_succ_iterator_product(s, (const kripke*) left_, return new tgta_succ_iterator_product(s,
(const tgta *) right_, p); down_cast<const kripke*>(left_),
down_cast<const tgta*>(right_), p);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View file

@ -36,7 +36,6 @@ namespace spot
class tgta_product : public tgba_product class tgta_product : public tgba_product
{ {
public: public:
tgta_product(const kripke* left, const tgta* right); tgta_product(const kripke* left, const tgta* right);
virtual state* virtual state*
@ -45,8 +44,6 @@ namespace spot
virtual tgba_succ_iterator* virtual tgba_succ_iterator*
succ_iter(const state* local_state, const state* global_state = 0, succ_iter(const state* local_state, const state* global_state = 0,
const tgba* global_automaton = 0) const; const tgba* global_automaton = 0) const;
}; };
/// \brief Iterate over the successors of a product computed on the fly. /// \brief Iterate over the successors of a product computed on the fly.
@ -100,9 +97,7 @@ namespace spot
bdd current_condition_; bdd current_condition_;
bdd current_acceptance_conditions_; bdd current_acceptance_conditions_;
bdd kripke_source_condition; bdd kripke_source_condition;
state * kripke_current_dest_state; state* kripke_current_dest_state;
}; };
} }

View file

@ -1,3 +1,4 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2012 Laboratoire de Recherche et Developpement // Copyright (C) 2010, 2012 Laboratoire de Recherche et Developpement
// de l Epita (LRDE). // de l Epita (LRDE).
// //
@ -40,8 +41,6 @@ namespace spot
{ {
os_ << "digraph G {" << std::endl; os_ << "digraph G {" << std::endl;
int n = 0;
artificial_initial_state_ = t_automata_->get_artificial_initial_state(); artificial_initial_state_ = t_automata_->get_artificial_initial_state();
ta::states_set_t init_states_set; ta::states_set_t init_states_set;
@ -55,10 +54,10 @@ namespace spot
} }
else else
{ {
int n = 0;
init_states_set = t_automata_->get_initial_states_set(); init_states_set = t_automata_->get_initial_states_set();
for (it = init_states_set.begin(); for (it = init_states_set.begin();
it != init_states_set.end(); it++) it != init_states_set.end(); ++it)
{ {
bdd init_condition = t_automata_->get_state_condition(*it); bdd init_condition = t_automata_->get_state_condition(*it);
std::string label = bdd_format_formula(t_automata_->get_dict(), std::string label = bdd_format_formula(t_automata_->get_dict(),

View file

@ -1,5 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2011, 2012 Laboratoire de Recherche et // Copyright (C) 2010, 2011, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -360,7 +361,7 @@ namespace spot
} }
std::set<const state*, state_ptr_less_than>::const_iterator it; std::set<const state*, state_ptr_less_than>::const_iterator it;
for (it = liveset_dest.begin(); it != liveset_dest.end(); it++) for (it = liveset_dest.begin(); it != liveset_dest.end(); ++it)
{ {
const state* succ = (*it); const state* succ = (*it);
if (heuristic_livelock_detection(succ, h, h_livelock_root, if (heuristic_livelock_detection(succ, h, h_livelock_root,
@ -442,7 +443,7 @@ namespace spot
const ta::states_set_t init_states_set = a_->get_initial_states_set(); const ta::states_set_t init_states_set = a_->get_initial_states_set();
ta::states_set_t::const_iterator it; ta::states_set_t::const_iterator it;
for (it = init_states_set.begin(); it != init_states_set.end(); it++) for (it = init_states_set.begin(); it != init_states_set.end(); ++it)
{ {
state* init_state = (*it); state* init_state = (*it);
ta_init_it_.push(init_state); ta_init_it_.push(init_state);

View file

@ -205,7 +205,7 @@ namespace spot
spot::state* artificial_initial_state = ta_->get_artificial_initial_state(); spot::state* artificial_initial_state = ta_->get_artificial_initial_state();
for (it = states_set.begin(); it != states_set.end(); it++) for (it = states_set.begin(); it != states_set.end(); ++it)
{ {
const state* s = (*it); const state* s = (*it);

View file

@ -1,4 +1,5 @@
// Copyright (C) 2010 Laboratoire de Recherche et Developpement // -*- coding: utf-8 -*-
// Copyright (C) 2010, 2012 Laboratoire de Recherche et Développement
// de l Epita (LRDE). // de l Epita (LRDE).
// //
// //
@ -66,7 +67,7 @@ namespace spot
init_states_set = t_automata_->get_initial_states_set(); init_states_set = t_automata_->get_initial_states_set();
} }
for (it = init_states_set.begin(); it != init_states_set.end(); it++) for (it = init_states_set.begin(); it != init_states_set.end(); ++it)
{ {
state* init_state = (*it); state* init_state = (*it);
if (want_state(init_state)) if (want_state(init_state))

View file

@ -76,7 +76,7 @@ namespace spot
state_ta_explicit::transitions* transitions_to_livelock_states = state_ta_explicit::transitions* transitions_to_livelock_states =
new state_ta_explicit::transitions; new state_ta_explicit::transitions;
for (it = states_set.begin(); it != states_set.end(); it++) for (it = states_set.begin(); it != states_set.end(); ++it)
{ {
state_ta_explicit* source = static_cast<state_ta_explicit*> (*it); state_ta_explicit* source = static_cast<state_ta_explicit*> (*it);
@ -122,8 +122,8 @@ namespace spot
{ {
state_ta_explicit::transitions::iterator it_trans; state_ta_explicit::transitions::iterator it_trans;
for (it_trans = transitions_to_livelock_states->begin(); it_trans for (it_trans = transitions_to_livelock_states->begin();
!= transitions_to_livelock_states->end(); it_trans++) it_trans != transitions_to_livelock_states->end(); ++it_trans)
{ {
if (artificial_livelock_accepting_state != 0) if (artificial_livelock_accepting_state != 0)
{ {
@ -147,7 +147,7 @@ namespace spot
} }
delete transitions_to_livelock_states; delete transitions_to_livelock_states;
for (it = states_set.begin(); it != states_set.end(); it++) for (it = states_set.begin(); it != states_set.end(); ++it)
{ {
state_ta_explicit* state = static_cast<state_ta_explicit*> (*it); state_ta_explicit* state = static_cast<state_ta_explicit*> (*it);
@ -196,7 +196,7 @@ compute_livelock_acceptance_states(ta_explicit* testing_automata,
ta::states_set_t::const_iterator it; ta::states_set_t::const_iterator it;
ta::states_set_t init_states = testing_automata->get_initial_states_set(); ta::states_set_t init_states = testing_automata->get_initial_states_set();
for (it = init_states.begin(); it != init_states.end(); it++) for (it = init_states.begin(); it != init_states.end(); ++it)
{ {
state* init_state = (*it); state* init_state = (*it);
init_set.push(init_state); init_set.push(init_state);
@ -610,7 +610,7 @@ compute_livelock_acceptance_states(ta_explicit* testing_automata,
// adapt a GTA to remove acceptance conditions from states // adapt a GTA to remove acceptance conditions from states
ta::states_set_t states_set = ta->get_states_set(); ta::states_set_t states_set = ta->get_states_set();
ta::states_set_t::iterator it; ta::states_set_t::iterator it;
for (it = states_set.begin(); it != states_set.end(); it++) for (it = states_set.begin(); it != states_set.end(); ++it)
{ {
state_ta_explicit* state = static_cast<state_ta_explicit*> (*it); state_ta_explicit* state = static_cast<state_ta_explicit*> (*it);
@ -621,7 +621,7 @@ compute_livelock_acceptance_states(ta_explicit* testing_automata,
state_ta_explicit::transitions::iterator it_trans; state_ta_explicit::transitions::iterator it_trans;
for (it_trans = trans->begin(); it_trans != trans->end(); for (it_trans = trans->begin(); it_trans != trans->end();
it_trans++) ++it_trans)
{ {
(*it_trans)->acceptance_conditions (*it_trans)->acceptance_conditions
= ta->all_acceptance_conditions(); = ta->all_acceptance_conditions();
@ -674,7 +674,7 @@ compute_livelock_acceptance_states(ta_explicit* testing_automata,
bdd bdd_stutering_transition = bdd_setxor(first_state_condition, bdd bdd_stutering_transition = bdd_setxor(first_state_condition,
first_state_condition); first_state_condition);
for (it = states_set.begin(); it != states_set.end(); it++) for (it = states_set.begin(); it != states_set.end(); ++it)
{ {
state_ta_explicit* state = static_cast<state_ta_explicit*> (*it); state_ta_explicit* state = static_cast<state_ta_explicit*> (*it);

View file

@ -90,7 +90,7 @@ namespace spot
assert(dict == right.dict); assert(dict == right.dict);
} }
const tgba_bdd_core_data& tgba_bdd_core_data&
tgba_bdd_core_data::operator=(const tgba_bdd_core_data& copy) tgba_bdd_core_data::operator=(const tgba_bdd_core_data& copy)
{ {
if (this != &copy) if (this != &copy)

View file

@ -134,7 +134,7 @@ namespace spot
tgba_bdd_core_data(const tgba_bdd_core_data& left, tgba_bdd_core_data(const tgba_bdd_core_data& left,
const tgba_bdd_core_data& right); const tgba_bdd_core_data& right);
const tgba_bdd_core_data& operator=(const tgba_bdd_core_data& copy); tgba_bdd_core_data& operator=(const tgba_bdd_core_data& copy);
/// \brief Update the variable sets to take a new pair of variables into /// \brief Update the variable sets to take a new pair of variables into
/// account. /// account.

View file

@ -1,5 +1,6 @@
// Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement // -*- coding: utf-8 -*-
// de l'Epita (LRDE). // Copyright (C) 2009, 2010, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -30,7 +31,7 @@ namespace spot
{ {
public: public:
bdd_ordered() bdd_ordered()
: order_(0) : bdd_(0), order_(0)
{}; {};
bdd_ordered(int bdd_, unsigned order_) bdd_ordered(int bdd_, unsigned order_)
@ -77,7 +78,7 @@ namespace spot
/// \endverbatim /// \endverbatim
/// ///
/// The original automaton is used as a States-based Generalized /// The original automaton is used as a States-based Generalized
/// Büchi Automaton. /// Büchi Automaton.
/// ///
/// The construction is done on-the-fly, by the /// The construction is done on-the-fly, by the
/// \c tgba_kv_complement_succ_iterator class. /// \c tgba_kv_complement_succ_iterator class.

View file

@ -1,3 +1,4 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et // Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// //
@ -104,7 +105,7 @@ namespace spot
safra_tree(const subset_t& nodes, safra_tree* p, int n); safra_tree(const subset_t& nodes, safra_tree* p, int n);
~safra_tree(); ~safra_tree();
const safra_tree& operator=(const safra_tree& other); safra_tree& operator=(const safra_tree& other);
int compare(const safra_tree* other) const; int compare(const safra_tree* other) const;
size_t hash() const; size_t hash() const;
@ -177,7 +178,7 @@ namespace spot
(*i)->destroy(); (*i)->destroy();
} }
const safra_tree& safra_tree&
safra_tree::operator=(const safra_tree& other) safra_tree::operator=(const safra_tree& other)
{ {
if (this != &other) if (this != &other)
@ -816,7 +817,6 @@ namespace spot
void print_safra_automaton(safra_tree_automaton* a) void print_safra_automaton(safra_tree_automaton* a)
{ {
safra_tree_automaton::automaton_t node_list = a->automaton;
typedef safra_tree_automaton::automaton_t::reverse_iterator typedef safra_tree_automaton::automaton_t::reverse_iterator
automaton_cit; automaton_cit;
typedef safra_tree_automaton::transition_list::const_iterator typedef safra_tree_automaton::transition_list::const_iterator

View file

@ -1,4 +1,4 @@
// Copyright (C) 2009, 2011 Laboratoire de Recherche et Développement // Copyright (C) 2009, 2011, 2012 Laboratoire de Recherche et Développement
// de l'Epita (LRDE). // de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -101,9 +101,8 @@ namespace spot
} }
tgba_sgba_proxy_succ_iterator(tgba_succ_iterator* it, bdd acc) tgba_sgba_proxy_succ_iterator(tgba_succ_iterator* it, bdd acc)
: it_(it), emulate_acc_cond_(true) : it_(it), emulate_acc_cond_(true), acceptance_condition_(acc)
{ {
acceptance_condition_ = acc;
} }
virtual virtual

View file

@ -166,9 +166,8 @@ namespace spot
{ {
public: public:
tgba_wdba_comp_proxy(const tgba* a) tgba_wdba_comp_proxy(const tgba* a)
: a_(a) : a_(a), the_acceptance_cond_(a->all_acceptance_conditions())
{ {
the_acceptance_cond_ = a->all_acceptance_conditions();
if (the_acceptance_cond_ == bddfalse) if (the_acceptance_cond_ == bddfalse)
{ {
int v = get_dict() int v = get_dict()

View file

@ -1,5 +1,6 @@
// Copyright (C) 2009, 2011 Laboratoire de Recherche et Developpement // -*- coding: utf-8 -*-
// de l'Epita (LRDE). // Copyright (C) 2009, 2011, 2012 Laboratoire de Recherche et
// Developpement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -38,7 +39,7 @@ namespace spot
std::string cur_format = a->format_state(cur); std::string cur_format = a->format_state(cur);
std::set<unsigned>::iterator it; std::set<unsigned>::iterator it;
// Check if we have at least one accepting SCC. // Check if we have at least one accepting SCC.
for (it = s.begin(); it != s.end() && !m.accepting(*it); it++) for (it = s.begin(); it != s.end() && !m.accepting(*it); ++it)
continue; continue;
assert(it != s.end()); assert(it != s.end());
tovisit.push(cur); tovisit.push(cur);
@ -89,10 +90,8 @@ namespace spot
hash_type::iterator it2; hash_type::iterator it2;
// Free visited states. // Free visited states.
for (it2 = seen.begin(); it2 != seen.end(); it2++) for (it2 = seen.begin(); it2 != seen.end(); ++it2)
{
(*it2)->destroy(); (*it2)->destroy();
}
return sub_a; return sub_a;
} }

View file

@ -218,7 +218,7 @@ namespace spot
std::getline(is, guard); std::getline(is, guard);
ltl::parse_error_list pel; ltl::parse_error_list pel;
const ltl::formula* f = parse_lbt(guard, pel, env); const ltl::formula* f = parse_lbt(guard, pel, env);
if (!f || pel.size() > 0) if (!f || !pel.empty())
{ {
error += "failed to parse guard: " + guard; error += "failed to parse guard: " + guard;
if (f) if (f)
@ -301,7 +301,7 @@ namespace spot
std::getline(is, guard); std::getline(is, guard);
ltl::parse_error_list pel; ltl::parse_error_list pel;
const ltl::formula* f = parse_lbt(guard, pel, env); const ltl::formula* f = parse_lbt(guard, pel, env);
if (!f || pel.size() > 0) if (!f || !pel.empty())
{ {
error += "failed to parse guard: " + guard; error += "failed to parse guard: " + guard;
if (f) if (f)

View file

@ -286,7 +286,6 @@ namespace spot
// We run through the map bdd/list<state>, and we update // We run through the map bdd/list<state>, and we update
// the previous_class_ with the new data. // the previous_class_ with the new data.
it_bdd = used_var_.begin();
for (map_bdd_lstate::iterator it = bdd_lstate_.begin(); for (map_bdd_lstate::iterator it = bdd_lstate_.begin();
it != bdd_lstate_.end(); it != bdd_lstate_.end();
++it) ++it)

View file

@ -160,10 +160,9 @@ int main(int argc, char* argv[])
else if (print_formula) else if (print_formula)
{ {
spot::tgba* a; spot::tgba* a;
const spot::ltl::formula* f1 = 0;
spot::ltl::parse_error_list p1; spot::ltl::parse_error_list p1;
f1 = spot::ltl::parse(file, p1); const spot::ltl::formula* f1 = spot::ltl::parse(file, p1);
if (spot::ltl::format_parse_errors(std::cerr, file, p1)) if (spot::ltl::format_parse_errors(std::cerr, file, p1))
return 2; return 2;

View file

@ -360,12 +360,10 @@ main(int argc, char** argv)
spot::ltl::environment& env(spot::ltl::default_environment::instance()); spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::ltl::atomic_prop_set* unobservables = 0; spot::ltl::atomic_prop_set* unobservables = 0;
spot::tgba* system = 0; spot::tgba* system = 0;
const spot::tgba* product = 0;
const spot::tgba* product_to_free = 0; const spot::tgba* product_to_free = 0;
spot::bdd_dict* dict = new spot::bdd_dict(); spot::bdd_dict* dict = new spot::bdd_dict();
spot::timer_map tm; spot::timer_map tm;
bool use_timer = false; bool use_timer = false;
bool assume_sba = false;
bool reduction_dir_sim = false; bool reduction_dir_sim = false;
bool reduction_rev_sim = false; bool reduction_rev_sim = false;
bool reduction_iterated_sim = false; bool reduction_iterated_sim = false;
@ -892,6 +890,7 @@ main(int argc, char** argv)
const spot::tgba* to_free = 0; const spot::tgba* to_free = 0;
const spot::tgba* to_free2 = 0; const spot::tgba* to_free2 = 0;
spot::tgba* a = 0; spot::tgba* a = 0;
bool assume_sba = false;
if (from_file) if (from_file)
{ {
@ -1198,10 +1197,8 @@ main(int argc, char** argv)
if (ta_opt) if (ta_opt)
{ {
spot::ta* testing_automaton = 0;
tm.start("conversion to TA"); tm.start("conversion to TA");
testing_automaton spot::ta* testing_automaton
= tgba_to_ta(a, atomic_props_set_bdd, degeneralize_opt = tgba_to_ta(a, atomic_props_set_bdd, degeneralize_opt
== DegenSBA, opt_with_artificial_initial_state, == DegenSBA, opt_with_artificial_initial_state,
opt_single_pass_emptiness_check, opt_single_pass_emptiness_check,
@ -1286,7 +1283,8 @@ main(int argc, char** argv)
if (system) if (system)
{ {
product = product_to_free = a = new spot::tgba_product(system, a); const spot::tgba* product = product_to_free = a =
new spot::tgba_product(system, a);
assume_sba = false; assume_sba = false;

View file

@ -311,7 +311,7 @@ struct stat_collector
std::ostream& std::ostream&
display(std::ostream& os, display(std::ostream& os,
const alg_1stat_map& m, const std::string title, const alg_1stat_map& m, const std::string& title,
bool total = true) const bool total = true) const
{ {
std::ios::fmtflags old = os.flags(); std::ios::fmtflags old = os.flags();
@ -418,7 +418,7 @@ ar_stats_type mar_stats; // ... about minimized accepting runs.
void void
print_ar_stats(ar_stats_type& ar_stats, const std::string s) print_ar_stats(ar_stats_type& ar_stats, const std::string& s)
{ {
std::ios::fmtflags old = std::cout.flags(); std::ios::fmtflags old = std::cout.flags();
std::cout << std::endl << s << std::endl; std::cout << std::endl << s << std::endl;
@ -818,7 +818,7 @@ main(int argc, char** argv)
const char** i = default_algos; const char** i = default_algos;
while (*i) while (*i)
{ {
ec_algo a = { *i++, 0 }; ec_algo a = { *(i++), 0 };
ec_algos.push_back(a); ec_algos.push_back(a);
} }
} }