* src/sanity/style.test: Suggest ++i over i++ when it does not

matter, for consistency.
* src/tgbaalgos/tarjan_on_fly.cc, iface/gspn/ssp.cc,
src/tgbaalgos/reductgba_sim_del.cc, src/tgbaalgos/reductgba_sim.cc,
src/tgbaalgos/minimalce.cc, src/tgba/tgbareduc.cc: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2004-09-23 12:20:10 +00:00
parent 3780650ea0
commit 3f2cba6304
9 changed files with 38 additions and 30 deletions

View file

@ -1,5 +1,11 @@
2004-09-23 Alexandre Duret-Lutz <adl@src.lip6.fr> 2004-09-23 Alexandre Duret-Lutz <adl@src.lip6.fr>
* src/sanity/style.test: Suggest ++i over i++ when it does not
matter, for consistency.
* src/tgbaalgos/tarjan_on_fly.cc, iface/gspn/ssp.cc,
src/tgbaalgos/reductgba_sim_del.cc, src/tgbaalgos/reductgba_sim.cc,
src/tgbaalgos/minimalce.cc, src/tgba/tgbareduc.cc: Adjust.
* src/tgbaalgos/ltl2tgba_fm.hh (ltl_to_tgba_fm): New unobs argument. * src/tgbaalgos/ltl2tgba_fm.hh (ltl_to_tgba_fm): New unobs argument.
* src/tgbaalgos/ltl2tgba_fm.cc (ltl_to_tgba_fm): Handle unobs. * src/tgbaalgos/ltl2tgba_fm.cc (ltl_to_tgba_fm): Handle unobs.
* src/tgbatest/ltl2tgba.cc (syntax, main): New -U option. * src/tgbatest/ltl2tgba.cc (syntax, main): New -U option.

View file

@ -225,7 +225,7 @@ namespace spot
virtual void virtual void
next() next()
{ {
current_succ_++; ++current_succ_;
} }
virtual bool virtual bool
@ -379,13 +379,13 @@ namespace spot
bdd_array = bdd_realloc(bdd_array, size_bdd, size_bdd + 1); bdd_array = bdd_realloc(bdd_array, size_bdd, size_bdd + 1);
bdd_array[size_bdd] = i->current_acceptance_conditions(); bdd_array[size_bdd] = i->current_acceptance_conditions();
props_[nb_arc_props].arc->curr_acc_conds = size_bdd; props_[nb_arc_props].arc->curr_acc_conds = size_bdd;
size_bdd++; ++size_bdd;
state_array = (state**) realloc(state_array, state_array = (state**) realloc(state_array,
(size_states + 1) * sizeof(state*)); (size_states + 1) * sizeof(state*));
state_array[size_states] = i->current_state(); state_array[size_states] = i->current_state();
props_[nb_arc_props].arc->curr_state = size_states; props_[nb_arc_props].arc->curr_state = size_states;
size_states++; ++size_states;
while (all_conds_ != bddfalse) while (all_conds_ != bddfalse)
{ {

View file

@ -119,12 +119,15 @@ for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do
# std::list::size() can be O(n). Better use empty() whenever # std::list::size() can be O(n). Better use empty() whenever
# possible, even for other containers. # possible, even for other containers.
grep -E '(->|[.])size\(\) [=!]= 0|![a-zA-Z0-9_]*(->|[.])size\(\)|(if |while |assert)\([a-zA-Z0-9_]*(->|[.])size\(\)\)' $tmp && egrep '(->|[.])size\(\) [=!]= 0|![a-zA-Z0-9_]*(->|[.])size\(\)|(if |while |assert)\([a-zA-Z0-9_]*(->|[.])size\(\)\)' $tmp &&
diag 'Prefer empty() to check emptiness.' diag 'Prefer empty() to check emptiness.'
egrep '^[^=]*([+][+]|--);' $tmp &&
diag 'Take good habits: use ++i instead of i++ when you have the choice.'
case $file in case $file in
*.hh | *.hxx) *.hh | *.hxx)
if grep -E '(cout|cerr|clog)' $tmp >/dev/null; then if egrep '(cout|cerr|clog)' $tmp >/dev/null; then
: :
else else
grep '#.*include.*<iostream>' $tmp && grep '#.*include.*<iostream>' $tmp &&

View file

@ -940,7 +940,7 @@ namespace spot
while (all != bddfalse) while (all != bddfalse)
{ {
all -= bdd_satone(all); all -= bdd_satone(all);
count++; ++count;
} }
return count; return count;
} }
@ -958,7 +958,7 @@ namespace spot
if (((*i)->first)->compare((*i)->second) == 0) if (((*i)->first)->compare((*i)->second) == 0)
continue; continue;
n++; ++n;
os << "couple " << n os << "couple " << n
<< std::endl << std::endl
<< " " << " [label=\"" << " " << " [label=\""

View file

@ -176,7 +176,7 @@ namespace spot
assert(!cycle.empty()); assert(!cycle.empty());
is = cycle.end(); is = cycle.end();
is--; --is;
id = cycle.begin(); id = cycle.begin();
strs = automata_->format_state(is->first); strs = automata_->format_state(is->first);
strd = automata_->format_state(id->first); strd = automata_->format_state(id->first);
@ -647,7 +647,7 @@ namespace spot
iter = a->succ_iter(s); iter = a->succ_iter(s);
iter->first(); iter->first();
stack.push_front(state_pair(s, iter)); stack.push_front(state_pair(s, iter));
depth_mode++; ++depth_mode;
} }
else else
s = stack.front().first; s = stack.front().first;
@ -722,7 +722,7 @@ namespace spot
iter = a->succ_iter(s); iter = a->succ_iter(s);
iter->first(); iter->first();
stack.push_front(state_pair(s, iter)); stack.push_front(state_pair(s, iter));
depth_mode++; ++depth_mode;
goto recurse; goto recurse;
} }
@ -745,7 +745,7 @@ namespace spot
iter = a->succ_iter(s); iter = a->succ_iter(s);
iter->first(); iter->first();
stack.push_front(state_pair(s, iter)); stack.push_front(state_pair(s, iter));
depth_mode++; ++depth_mode;
goto recurse; goto recurse;
} }
@ -772,7 +772,7 @@ namespace spot
iter = a->succ_iter(s); iter = a->succ_iter(s);
iter->first(); iter->first();
stack.push_front(state_pair(s, iter)); stack.push_front(state_pair(s, iter));
depth_mode++; ++depth_mode;
goto recurse; goto recurse;
} }
else else
@ -786,7 +786,7 @@ namespace spot
delete iter; delete iter;
depth_mode--; --depth_mode;
if (depth_mode_memory == depth_mode) if (depth_mode_memory == depth_mode)
{ {
depth_mode_memory = -1; depth_mode_memory = -1;
@ -945,7 +945,7 @@ namespace spot
{ {
//std::cout << os.str() << "save counter" << std::endl; //std::cout << os.str() << "save counter" << std::endl;
nb_found++; ++nb_found;
if (min_ce->empty()) if (min_ce->empty())
delete min_ce; delete min_ce;

View file

@ -306,7 +306,7 @@ namespace spot
i1 != spoiler_vertice_.end(); ++i1) i1 != spoiler_vertice_.end(); ++i1)
{ {
os << (*i1)->to_string(automata_); os << (*i1)->to_string(automata_);
n++; ++n;
if (n > 20) if (n > 20)
{ {
n = 0; n = 0;
@ -326,7 +326,7 @@ namespace spot
i2 != duplicator_vertice_.end(); ++i2) i2 != duplicator_vertice_.end(); ++i2)
{ {
os << (*i2)->to_string(automata_); os << (*i2)->to_string(automata_);
n++; ++n;
if (n > 20) if (n > 20)
{ {
n = 0; n = 0;
@ -508,7 +508,7 @@ namespace spot
si->current_acceptance_conditions())) si->current_acceptance_conditions()))
{ {
(*j)->add_succ(*i); (*j)->add_succ(*i);
nb_ds++; ++nb_ds;
} }
delete s; delete s;
} }
@ -529,7 +529,7 @@ namespace spot
si->current_acceptance_conditions())) si->current_acceptance_conditions()))
{ {
(*i)->add_succ(*j); (*i)->add_succ(*j);
nb_sd++; ++nb_sd;
} }
delete s; delete s;
} }

View file

@ -51,10 +51,10 @@ namespace spot
: spoiler_node(d_node, s_node, num), : spoiler_node(d_node, s_node, num),
acceptance_condition_visited_(a) acceptance_condition_visited_(a)
{ {
nb_spoiler++; ++nb_spoiler;
progress_measure_ = 0; progress_measure_ = 0;
if (acceptance_condition_visited_ != bddfalse) if (acceptance_condition_visited_ != bddfalse)
nb_spoiler_loose_++; ++nb_spoiler_loose_;
lead_2_acc_all_ = false; lead_2_acc_all_ = false;
seen_ = false; seen_ = false;
@ -62,8 +62,8 @@ namespace spot
spoiler_node_delayed::~spoiler_node_delayed() spoiler_node_delayed::~spoiler_node_delayed()
{ {
if (acceptance_condition_visited_ != bddfalse) if (acceptance_condition_visited_ != bddfalse)
nb_spoiler_loose_--; --nb_spoiler_loose_;
} }
bool bool
@ -110,7 +110,7 @@ namespace spot
// then we increment the progress measure of 1. // then we increment the progress measure of 1.
if ((acceptance_condition_visited_ != bddfalse) && if ((acceptance_condition_visited_ != bddfalse) &&
(tmpmax < (nb_spoiler_loose_ + 1))) (tmpmax < (nb_spoiler_loose_ + 1)))
tmpmax++; ++tmpmax;
change = (progress_measure_ < tmpmax); change = (progress_measure_ < tmpmax);
@ -211,7 +211,7 @@ namespace spot
int num) int num)
: duplicator_node(d_node, s_node, l, a, num) : duplicator_node(d_node, s_node, l, a, num)
{ {
nb_duplicator++; ++nb_duplicator;
progress_measure_ = 0; progress_measure_ = 0;
all_acc_cond |= a; all_acc_cond |= a;
lead_2_acc_all_ = false; lead_2_acc_all_ = false;
@ -348,7 +348,7 @@ namespace spot
{ {
sub_set_acc_cond_.push_back(bdd_satone(all)); sub_set_acc_cond_.push_back(bdd_satone(all));
all -= bdd_satone(all); all -= bdd_satone(all);
count++; ++count;
} }
return count; return count;
} }
@ -369,7 +369,7 @@ namespace spot
i2 != tgba_state_.end(); ++i2) i2 != tgba_state_.end(); ++i2)
{ {
//std::cout << "add spoiler node" << std::endl; //std::cout << "add spoiler node" << std::endl;
nb_spoiler++; ++nb_spoiler;
spoiler_node_delayed* n1 spoiler_node_delayed* n1
= new spoiler_node_delayed(*i1, *i2, = new spoiler_node_delayed(*i1, *i2,
bddfalse, bddfalse,

View file

@ -109,8 +109,7 @@ namespace spot
void void
tarjan_on_fly::push(const state* s) tarjan_on_fly::push(const state* s)
{ {
h[s] = top; h[s] = top++;
top++;
struct_state ss = { s, 0, top, dftop, 0 }; struct_state ss = { s, 0, top, dftop, 0 };

View file

@ -479,12 +479,12 @@ main(int argc, char** argv)
unobservables = new spot::ltl::atomic_prop_set; unobservables = new spot::ltl::atomic_prop_set;
fm_opt = true; fm_opt = true;
// Parse -U's argument. // Parse -U's argument.
const char* tok = strtok(argv[formula_index] + 2, ",; \t"); const char* tok = strtok(argv[formula_index] + 2, ", \t;");
while (tok) while (tok)
{ {
unobservables->insert unobservables->insert
(static_cast<spot::ltl::atomic_prop*>(env.require(tok))); (static_cast<spot::ltl::atomic_prop*>(env.require(tok)));
tok = strtok(0, ",; \t"); tok = strtok(0, ", \t;");
} }
} }
else if (!strcmp(argv[formula_index], "-v")) else if (!strcmp(argv[formula_index], "-v"))