* src/sanity/style.test: Diagnose superfluous constructs such
as `if (x) delete x;'. * iface/gspn/gspn.cc, iface/gspn/ssp.cc, src/ltlvisit/basicreduce.cc, src/tgba/tgba.cc, src/tgba/tgbaproduct.cc, src/tgbaalgos/magic.cc, src/tgbatest/ltl2tgba.cc: Remove such constructs.
This commit is contained in:
parent
4654da9ab5
commit
55014e9dcc
9 changed files with 62 additions and 71 deletions
|
|
@ -1,5 +1,11 @@
|
||||||
2004-10-29 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
2004-10-29 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
||||||
|
|
||||||
|
* src/sanity/style.test: Diagnose superfluous constructs such
|
||||||
|
as `if (x) delete x;'.
|
||||||
|
* iface/gspn/gspn.cc, iface/gspn/ssp.cc, src/ltlvisit/basicreduce.cc,
|
||||||
|
src/tgba/tgba.cc, src/tgba/tgbaproduct.cc, src/tgbaalgos/magic.cc,
|
||||||
|
src/tgbatest/ltl2tgba.cc: Remove such constructs.
|
||||||
|
|
||||||
* src/tgbatest/ltl2tgba.cc: Replace -e, -E, -m, -M, and -n by
|
* src/tgbatest/ltl2tgba.cc: Replace -e, -E, -m, -M, and -n by
|
||||||
-eALGO and -EALGO to ease the addition of new algorithms.
|
-eALGO and -EALGO to ease the addition of new algorithms.
|
||||||
* src/tgbatest/emptchk.test, src/tgbatest/emptchke.test: Adjust.
|
* src/tgbatest/emptchk.test, src/tgbatest/emptchke.test: Adjust.
|
||||||
|
|
|
||||||
|
|
@ -175,10 +175,8 @@ namespace spot
|
||||||
tgba_gspn_private_::~tgba_gspn_private_()
|
tgba_gspn_private_::~tgba_gspn_private_()
|
||||||
{
|
{
|
||||||
dict->unregister_all_my_variables(this);
|
dict->unregister_all_my_variables(this);
|
||||||
if (last_state_conds_input)
|
delete last_state_conds_input;
|
||||||
delete last_state_conds_input;
|
delete[] all_indexes;
|
||||||
if (all_indexes)
|
|
||||||
delete[] all_indexes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bdd index_to_bdd(AtomicProp index) const
|
bdd index_to_bdd(AtomicProp index) const
|
||||||
|
|
@ -213,8 +211,7 @@ namespace spot
|
||||||
}
|
}
|
||||||
satisfy_free(cube);
|
satisfy_free(cube);
|
||||||
|
|
||||||
if (last_state_conds_input)
|
delete last_state_conds_input;
|
||||||
delete last_state_conds_input;
|
|
||||||
last_state_conds_input = s->clone();
|
last_state_conds_input = s->clone();
|
||||||
}
|
}
|
||||||
return last_state_conds_output;
|
return last_state_conds_output;
|
||||||
|
|
|
||||||
|
|
@ -162,8 +162,7 @@ namespace spot
|
||||||
tgba_gspn_ssp_private_::~tgba_gspn_ssp_private_()
|
tgba_gspn_ssp_private_::~tgba_gspn_ssp_private_()
|
||||||
{
|
{
|
||||||
dict->unregister_all_my_variables(this);
|
dict->unregister_all_my_variables(this);
|
||||||
if (all_props)
|
delete[] all_props;
|
||||||
delete[] all_props;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -509,11 +509,6 @@ namespace spot
|
||||||
destroy(*i);
|
destroy(*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
delete tmpFG;
|
|
||||||
tmpFG = 0;
|
|
||||||
*/
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -525,22 +520,21 @@ namespace spot
|
||||||
tmpOther->push_back(unop::instance(unop::X,
|
tmpOther->push_back(unop::instance(unop::X,
|
||||||
multop::instance(mo->op(),
|
multop::instance(mo->op(),
|
||||||
tmpX)));
|
tmpX)));
|
||||||
else if (tmpX)
|
else
|
||||||
delete tmpX;
|
delete tmpX;
|
||||||
|
|
||||||
|
|
||||||
if (tmpU && !tmpU->empty())
|
if (tmpU && !tmpU->empty())
|
||||||
tmpOther->push_back(multop::instance(mo->op(), tmpU));
|
tmpOther->push_back(multop::instance(mo->op(), tmpU));
|
||||||
else if (tmpU)
|
else
|
||||||
delete tmpU;
|
delete tmpU;
|
||||||
|
|
||||||
|
|
||||||
if (tmpR && !tmpR->empty())
|
if (tmpR && !tmpR->empty())
|
||||||
tmpOther->push_back(multop::instance(mo->op(), tmpR));
|
tmpOther->push_back(multop::instance(mo->op(), tmpR));
|
||||||
else if (tmpR)
|
else
|
||||||
delete tmpR;
|
delete tmpR;
|
||||||
|
|
||||||
|
|
||||||
if (tmpGF && !tmpGF->empty())
|
if (tmpGF && !tmpGF->empty())
|
||||||
{
|
{
|
||||||
formula* ftmp
|
formula* ftmp
|
||||||
|
|
@ -550,7 +544,7 @@ namespace spot
|
||||||
tmpGF)));
|
tmpGF)));
|
||||||
tmpOther->push_back(ftmp);
|
tmpOther->push_back(ftmp);
|
||||||
}
|
}
|
||||||
else if (tmpGF)
|
else
|
||||||
delete tmpGF;
|
delete tmpGF;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -569,14 +563,13 @@ namespace spot
|
||||||
multop::instance(mo->op(), tmpFG));
|
multop::instance(mo->op(), tmpFG));
|
||||||
tmpOther->push_back(ftmp);
|
tmpOther->push_back(ftmp);
|
||||||
}
|
}
|
||||||
else if (tmpFG)
|
else
|
||||||
delete tmpFG;
|
delete tmpFG;
|
||||||
|
|
||||||
|
|
||||||
result_ = multop::instance(op, tmpOther);
|
result_ = multop::instance(op, tmpOther);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do
|
||||||
sed 's,[ ]*//.*,,' < $file > $tmp
|
sed 's,[ ]*//.*,,' < $file > $tmp
|
||||||
|
|
||||||
grep '[ ]$' $tmp &&
|
grep '[ ]$' $tmp &&
|
||||||
diag 'Trailing space or tab.'
|
diag 'Trailing whitespace.'
|
||||||
|
|
||||||
grep '[ ]if(' $tmp &&
|
grep '[ ]if(' $tmp &&
|
||||||
diag 'Missing space after "if"'
|
diag 'Missing space after "if"'
|
||||||
|
|
@ -137,6 +137,14 @@ for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do
|
||||||
grep '[^a-zA-Z0-9_](\*[a-zA-Z0-9_]*)\.' $tmp &&
|
grep '[^a-zA-Z0-9_](\*[a-zA-Z0-9_]*)\.' $tmp &&
|
||||||
diag 'Use "x->y", not "(*x).y"'
|
diag 'Use "x->y", not "(*x).y"'
|
||||||
|
|
||||||
|
res=`perl -ne '$/ = undef;
|
||||||
|
print "$&\n"
|
||||||
|
while /if \((.*)(\s*==\s*0)?\)\s*delete(\[\])?\s+\1;(?!\s+else)/g' $tmp`
|
||||||
|
if test -n "$res"; then
|
||||||
|
echo "$res"
|
||||||
|
diag 'No "if (x)" required before "delete x;".'
|
||||||
|
fi
|
||||||
|
|
||||||
case $file in
|
case $file in
|
||||||
*.hh | *.hxx)
|
*.hh | *.hxx)
|
||||||
if egrep '(cout|cerr|clog)' $tmp >/dev/null; then
|
if egrep '(cout|cerr|clog)' $tmp >/dev/null; then
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,8 @@ namespace spot
|
||||||
|
|
||||||
tgba::~tgba()
|
tgba::~tgba()
|
||||||
{
|
{
|
||||||
if (last_support_conditions_input_)
|
delete last_support_conditions_input_;
|
||||||
delete last_support_conditions_input_;
|
delete last_support_variables_input_;
|
||||||
if (last_support_variables_input_)
|
|
||||||
delete last_support_variables_input_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bdd
|
bdd
|
||||||
|
|
@ -43,10 +41,8 @@ namespace spot
|
||||||
if (!last_support_conditions_input_
|
if (!last_support_conditions_input_
|
||||||
|| last_support_conditions_input_->compare(state) != 0)
|
|| last_support_conditions_input_->compare(state) != 0)
|
||||||
{
|
{
|
||||||
last_support_conditions_output_ =
|
last_support_conditions_output_ = compute_support_conditions(state);
|
||||||
compute_support_conditions(state);
|
delete last_support_conditions_input_;
|
||||||
if (last_support_conditions_input_)
|
|
||||||
delete last_support_conditions_input_;
|
|
||||||
last_support_conditions_input_ = state->clone();
|
last_support_conditions_input_ = state->clone();
|
||||||
}
|
}
|
||||||
return last_support_conditions_output_;
|
return last_support_conditions_output_;
|
||||||
|
|
@ -58,10 +54,8 @@ namespace spot
|
||||||
if (!last_support_variables_input_
|
if (!last_support_variables_input_
|
||||||
|| last_support_variables_input_->compare(state) != 0)
|
|| last_support_variables_input_->compare(state) != 0)
|
||||||
{
|
{
|
||||||
last_support_variables_output_ =
|
last_support_variables_output_ = compute_support_variables(state);
|
||||||
compute_support_variables(state);
|
delete last_support_variables_input_;
|
||||||
if (last_support_variables_input_)
|
|
||||||
delete last_support_variables_input_;
|
|
||||||
last_support_variables_input_ = state->clone();
|
last_support_variables_input_ = state->clone();
|
||||||
}
|
}
|
||||||
return last_support_variables_output_;
|
return last_support_variables_output_;
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,7 @@ namespace spot
|
||||||
tgba_succ_iterator_product::~tgba_succ_iterator_product()
|
tgba_succ_iterator_product::~tgba_succ_iterator_product()
|
||||||
{
|
{
|
||||||
delete left_;
|
delete left_;
|
||||||
if (right_)
|
delete right_;
|
||||||
delete right_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,7 @@ namespace spot
|
||||||
++s;
|
++s;
|
||||||
delete ptr;
|
delete ptr;
|
||||||
}
|
}
|
||||||
if (x)
|
delete x;
|
||||||
delete x;
|
|
||||||
// Release all iterators on the stack.
|
// Release all iterators on the stack.
|
||||||
while (!stack.empty())
|
while (!stack.empty())
|
||||||
{
|
{
|
||||||
|
|
@ -165,8 +164,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
if (!has(s, true))
|
if (!has(s, true))
|
||||||
{
|
{
|
||||||
if (x)
|
delete x;
|
||||||
delete x;
|
|
||||||
x = s->clone();
|
x = s->clone();
|
||||||
push(s, true);
|
push(s, true);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -116,8 +116,7 @@ syntax(char* prog)
|
||||||
<< " couvreur99" << std::endl
|
<< " couvreur99" << std::endl
|
||||||
<< " couvreur99_shy" << std::endl
|
<< " couvreur99_shy" << std::endl
|
||||||
<< " magic_search" << std::endl
|
<< " magic_search" << std::endl
|
||||||
<< " magic_search_repeated" << std::endl
|
<< " magic_search_repeated" << std::endl;
|
||||||
;
|
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -319,31 +318,33 @@ main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (echeck_algo == "couvreur99")
|
if (echeck_algo != "")
|
||||||
{
|
{
|
||||||
echeck = Couvreur;
|
if (echeck_algo == "couvreur99")
|
||||||
|
{
|
||||||
|
echeck = Couvreur;
|
||||||
|
}
|
||||||
|
else if (echeck_algo == "couvreur99_shy")
|
||||||
|
{
|
||||||
|
echeck = Couvreur2;
|
||||||
|
}
|
||||||
|
else if (echeck_algo == "magic_search")
|
||||||
|
{
|
||||||
|
echeck = MagicSearch;
|
||||||
|
degeneralize_opt = true;
|
||||||
|
}
|
||||||
|
else if (echeck_algo == "magic_search_repeated")
|
||||||
|
{
|
||||||
|
echeck = MagicSearch;
|
||||||
|
degeneralize_opt = true;
|
||||||
|
magic_many = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "unknown emptiness-check: " << echeck_algo << std::endl;
|
||||||
|
syntax(argv[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (echeck_algo == "couvreur99_shy")
|
|
||||||
{
|
|
||||||
echeck = Couvreur2;
|
|
||||||
}
|
|
||||||
else if (echeck_algo == "magic_search")
|
|
||||||
{
|
|
||||||
echeck = MagicSearch;
|
|
||||||
degeneralize_opt = true;
|
|
||||||
}
|
|
||||||
else if (echeck_algo == "magic_search_repeated")
|
|
||||||
{
|
|
||||||
echeck = MagicSearch;
|
|
||||||
degeneralize_opt = true;
|
|
||||||
magic_many = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cerr << "unknown emptiness-check: " << echeck_algo << std::endl;
|
|
||||||
syntax(argv[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string input;
|
std::string input;
|
||||||
|
|
||||||
|
|
@ -591,13 +592,9 @@ main(int argc, char** argv)
|
||||||
|
|
||||||
if (f)
|
if (f)
|
||||||
spot::ltl::destroy(f);
|
spot::ltl::destroy(f);
|
||||||
if (expl)
|
delete expl;
|
||||||
delete expl;
|
delete degeneralized;
|
||||||
if (degeneralize_opt)
|
delete aut_red;
|
||||||
delete degeneralized;
|
|
||||||
if (aut_red)
|
|
||||||
delete aut_red;
|
|
||||||
|
|
||||||
delete to_free;
|
delete to_free;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue