Deprecate ltl::destroy(f) in favor of f->destroy()

* src/ltlast/formula.cc, src/ltlast/formula.hh (formula::clone):
Transform this static function into a member function.
* src/ltlvisit/destroy.hh (destroy): Document and declare as
deprecated.
* bench/split-product/cutscc.cc, iface/gspn/ltlgspn.cc,
src/eltlparse/eltlparse.yy, src/eltltest/acc.cc,
src/evtgbaalgos/tgba2evtgba.cc, src/evtgbatest/ltl2evtgba.cc,
src/ltlast/automatop.cc, src/ltlast/binop.cc,
src/ltlast/multop.cc, src/ltlast/unop.cc, src/ltlenv/declenv.cc,
src/ltlenv/declenv.hh, src/ltlparse/ltlparse.yy,
src/ltltest/equals.cc, src/ltltest/randltl.cc,
src/ltltest/readltl.cc, src/ltltest/reduc.cc,
src/ltltest/syntimpl.cc, src/ltltest/tostring.cc,
src/ltlvisit/destroy.cc src/ltlvisit/basicreduce.cc,
src/ltlvisit/contain.cc, src/ltlvisit/reduce.cc,
src/ltlvisit/syntimpl.cc, src/tgba/bdddict.cc,
src/tgba/bddprint.cc, src/tgba/taa.cc,
src/tgba/tgbabddconcretefactory.cc, src/tgba/tgbaexplicit.cc,
src/tgba/tgbafromfile.cc, src/tgbaalgos/eltl2tgba_lacim.cc,
src/tgbaalgos/ltl2taa.cc, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbaalgos/ltl2tgba_lacim.cc, src/tgbaalgos/neverclaim.cc,
src/tgbaalgos/randomgraph.cc, src/tgbaparse/tgbaparse.yy,
src/tgbatest/complementation.cc, src/tgbatest/eltl2tgba.cc,
src/tgbatest/ltl2tgba.cc, src/tgbatest/ltlprod.cc,
src/tgbatest/mixprod.cc, src/tgbatest/randtgba.cc,
src/tgbatest/reductgba.cc, wrap/python/cgi/ltl2tgba.in,
wrap/python/tests/ltl2tgba.py, wrap/python/tests/ltlparse.py,
wrap/python/tests/ltlsimple.py: Adjust destroy() usage, and remove
the #include "destroy.hh" when appropriate.
This commit is contained in:
Alexandre Duret-Lutz 2009-11-09 06:54:52 +01:00
parent 48fb19ea44
commit 77df39b4dd
53 changed files with 260 additions and 259 deletions

View file

@ -1,6 +1,6 @@
// Copyright (C) 2004, 2007, 2008, 2009 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
// Copyright (C) 2004, 2007, 2008, 2009 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
@ -24,8 +24,6 @@
#include "ltlast/allnodes.hh"
#include <cassert>
#include "destroy.hh"
namespace spot
{
namespace ltl
@ -97,7 +95,7 @@ namespace spot
resGF->push_back(mo->nth(i)->clone());
else
res1->push_back(mo->nth(i)->clone());
destroy(mo);
mo->destroy();
multop::vec* res3 = new multop::vec;
if (!res1->empty())
res3->push_back(unop::instance(op,
@ -162,10 +160,10 @@ namespace spot
unop::instance(unop::X,
unop::instance(unop::F,
basic_reduce(u->child())));
destroy(u);
u->destroy();
// FXX(a) = XXF(a) ...
result_ = basic_reduce(res);
destroy(res);
res->destroy();
return;
}
@ -192,7 +190,7 @@ namespace spot
{
result_ = unop::instance(unop::G,
basic_reduce(bo->second()));
destroy(bo);
bo->destroy();
return;
}
@ -204,11 +202,11 @@ namespace spot
unop::instance(unop::X,
unop::instance(unop::G,
basic_reduce(u->child())));
destroy(u);
u->destroy();
// GXX(a) = XXG(a) ...
// GXF(a) = XGF(a) = GF(a) ...
result_ = basic_reduce(res);
destroy(res);
res->destroy();
return;
}
@ -275,9 +273,9 @@ namespace spot
basic_reduce(fu1->child()),
basic_reduce(fu2->child()));
result_ = unop::instance(unop::X, basic_reduce(ftmp));
destroy(f1);
destroy(f2);
destroy(ftmp);
f1->destroy();
f2->destroy();
ftmp->destroy();
return;
}
@ -362,7 +360,7 @@ namespace spot
->push_back(bo2->first()->clone());
if (j != i)
{
destroy(*j);
(*j)->destroy();
*j = 0;
}
}
@ -393,7 +391,7 @@ namespace spot
->push_back(bo2->second()->clone());
if (j != i)
{
destroy(*j);
(*j)->destroy();
*j = 0;
}
}
@ -414,7 +412,7 @@ namespace spot
{
tmpOther->push_back((*i)->clone());
}
destroy(*i);
(*i)->destroy();
}
delete tmpGF;
@ -473,7 +471,7 @@ namespace spot
->push_back(bo2->second()->clone());
if (j != i)
{
destroy(*j);
(*j)->destroy();
*j = 0;
}
}
@ -502,7 +500,7 @@ namespace spot
->push_back(bo2->first()->clone());
if (j != i)
{
destroy(*j);
(*j)->destroy();
*j = 0;
}
}
@ -523,7 +521,7 @@ namespace spot
{
tmpOther->push_back((*i)->clone());
}
destroy(*i);
(*i)->destroy();
}
break;

View file

@ -20,7 +20,6 @@
// 02111-1307, USA.
#include "contain.hh"
#include "destroy.hh"
#include "tunabbrev.hh"
#include "ltlast/unop.hh"
#include "ltlast/binop.hh"
@ -51,7 +50,7 @@ namespace spot
delete i->second.translation;
const formula* f = i->first;
translated_.erase(i);
destroy(f);
f->destroy();
}
}
@ -89,7 +88,7 @@ namespace spot
record_* rl = register_formula_(l);
const formula* ng = unop::instance(unop::Not, g->clone());
record_* rng = register_formula_(ng);
destroy(ng);
ng->destroy();
return incompatible_(rl, rng);
}
@ -102,8 +101,8 @@ namespace spot
record_* rnl = register_formula_(nl);
const formula* ng = unop::instance(unop::Not, g->clone());
record_* rng = register_formula_(ng);
destroy(nl);
destroy(ng);
nl->destroy();
ng->destroy();
return incompatible_(rnl, rng);
}
@ -181,19 +180,19 @@ namespace spot
// if (a U b) => b, then keep b !
if (stronger && lcc->contained(bo, b))
{
destroy(a);
a->destroy();
result_ = b;
}
// if a => b, then a U b = b.
else if ((!stronger) && lcc->contained(a, b))
{
destroy(a);
a->destroy();
result_ = b;
}
// if !a => b, then a U b = Fb
else if (lcc->neg_contained(a, b))
{
destroy(a);
a->destroy();
result_ = unop::instance(unop::F, b);
}
else
@ -205,19 +204,19 @@ namespace spot
// if (a R b) => b, then keep b !
if (stronger && lcc->contained(b, bo))
{
destroy(a);
a->destroy();
result_ = b;
}
// if b => a, then a R b = b.
else if ((!stronger) && lcc->contained(b, a))
{
destroy(a);
a->destroy();
result_ = b;
}
// if a => !b, then a R b = Gb
else if (lcc->contained_neg(a, b))
{
destroy(a);
a->destroy();
result_ = unop::instance(unop::G, b);
}
else
@ -266,7 +265,7 @@ namespace spot
// if i => j, then i|j = j
else if (lcc->contained((*res)[i], (*res)[j]))
{
destroy((*res)[i]);
(*res)[i]->destroy();
(*res)[i] = 0;
changed = true;
break;
@ -274,7 +273,7 @@ namespace spot
// if j => i, then i|j = i
else if (lcc->contained((*res)[j], (*res)[i]))
{
destroy((*res)[j]);
(*res)[j]->destroy();
(*res)[j] = 0;
changed = true;
}
@ -299,14 +298,14 @@ namespace spot
// if i => j, then i&j = i
else if (lcc->contained((*res)[i], (*res)[j]))
{
destroy((*res)[j]);
(*res)[j]->destroy();
(*res)[j] = 0;
changed = true;
}
// if j => i, then i&j = j
else if (lcc->contained((*res)[j], (*res)[i]))
{
destroy((*res)[i]);
(*res)[i]->destroy();
(*res)[i] = 0;
changed = true;
break;
@ -329,7 +328,7 @@ namespace spot
constant_:
for (unsigned i = 0; i < mos; ++i)
if ((*res)[i])
destroy((*res)[i]);
(*res)[i]->destroy();
delete res;
}
@ -354,7 +353,7 @@ namespace spot
// reduce_tau03_visitor does not handle Xor, Implies, and Equiv.
f = unabbreviate_ltl(f);
const_cast<formula*>(f)->accept(v);
destroy(f);
f->destroy();
delete v.lcc;
return v.result();
}

View file

@ -28,7 +28,7 @@ namespace spot
void
destroy(const formula* f)
{
formula::destroy(const_cast<formula*>(f));
f->destroy();
}
}
}

View file

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// Copyright (C) 2003, 2004, 2009 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
@ -28,9 +28,17 @@ namespace spot
{
namespace ltl
{
#if __GNUC__
/// \brief Destroys a formula
/// \ingroup ltl_essential
/// \deprecated Use f->destroy() instead.
void destroy(const formula *f) __attribute__ ((deprecated));
#else
/// \brief Destroys a formula
/// \ingroup ltl_essential
/// \deprecated Use f->destroy() instead.
void destroy(const formula *f);
#endif
}
}

View file

@ -28,7 +28,6 @@
#include "lunabbrev.hh"
#include "simpfg.hh"
#include "nenoform.hh"
#include "ltlvisit/destroy.hh"
#include "contain.hh"
namespace spot
@ -137,14 +136,14 @@ namespace spot
if (syntactic_implication(f1, f2))
{
result_ = f2;
destroy(f1);
f1->destroy();
return;
}
/* !b < a => a U b = Fb */
if (syntactic_implication_neg(f2, f1, false))
{
result_ = unop::instance(unop::F, f2);
destroy(f1);
f1->destroy();
return;
}
/* a < b => a U (b U c) = (b U c) */
@ -154,7 +153,7 @@ namespace spot
&& syntactic_implication(f1, bo->first()))
{
result_ = f2;
destroy(f1);
f1->destroy();
return;
}
}
@ -165,14 +164,14 @@ namespace spot
if (syntactic_implication(f2, f1))
{
result_ = f2;
destroy(f1);
f1->destroy();
return;
}
/* b < !a => a R b = Gb */
if (syntactic_implication_neg(f2, f1, true))
{
result_ = unop::instance(unop::G, f2);
destroy(f1);
f1->destroy();
return;
}
/* b < a => a R (b R c) = b R c */
@ -182,7 +181,7 @@ namespace spot
&& syntactic_implication(bo->first(), f1))
{
result_ = f2;
destroy(f1);
f1->destroy();
return;
}
}
@ -230,7 +229,7 @@ namespace spot
(mo->op() == multop::And)))
{
// We keep f2
destroy(*f1);
(*f1)->destroy();
res->erase(f1);
removed = true;
break;
@ -241,7 +240,7 @@ namespace spot
(mo->op() == multop::And)))
{
// We keep f1
destroy(*f2);
(*f2)->destroy();
res->erase(f2);
removed = true;
break;
@ -261,7 +260,7 @@ namespace spot
{
for (multop::vec::iterator j = res->begin();
j != res->end(); j++)
destroy(*j);
(*j)->destroy();
res->clear();
delete res;
if (mo->op() == multop::Or)
@ -309,7 +308,7 @@ namespace spot
assert(n < 100);
if (prev)
{
destroy(prev);
prev->destroy();
prev = const_cast<formula*>(f);
}
else
@ -318,15 +317,15 @@ namespace spot
}
f1 = unabbreviate_logic(f);
f2 = simplify_f_g(f1);
destroy(f1);
f1->destroy();
f1 = negative_normal_form(f2);
destroy(f2);
f2->destroy();
f2 = f1;
if (opt & Reduce_Basics)
{
f1 = basic_reduce(f2);
destroy(f2);
f2->destroy();
f2 = f1;
}
@ -336,7 +335,7 @@ namespace spot
reduce_visitor v(opt);
f2->accept(v);
f1 = v.result();
destroy(f2);
f2->destroy();
f2 = f1;
}
@ -347,12 +346,12 @@ namespace spot
formula* f1 =
reduce_tau03(f2,
opt & Reduce_Containment_Checks_Stronger);
destroy(f2);
f2->destroy();
f2 = f1;
}
f = f2;
}
destroy(prev);
prev->destroy();
return const_cast<formula*>(f);
}
}

View file

@ -26,7 +26,6 @@
#include "lunabbrev.hh"
#include "simpfg.hh"
#include "nenoform.hh"
#include "ltlvisit/destroy.hh"
namespace spot
{
@ -408,12 +407,12 @@ namespace spot
if (special_case(tmp))
{
result_ = true;
destroy(tmp);
tmp->destroy();
return;
}
if (syntactic_implication(tmp, f))
result_ = true;
destroy(tmp);
tmp->destroy();
return;
}
case unop::G:
@ -425,12 +424,12 @@ namespace spot
if (special_case(tmp))
{
result_ = true;
destroy(tmp);
tmp->destroy();
return;
}
if (syntactic_implication(tmp, f))
result_ = true;
destroy(tmp);
tmp->destroy();
return;
}
case unop::Finish:
@ -581,24 +580,24 @@ namespace spot
l = unop::instance(unop::Not, l);
formula* tmp = unabbreviate_logic(l);
destroy(l);
l->destroy();
l = simplify_f_g(tmp);
destroy(tmp);
tmp->destroy();
tmp = negative_normal_form(l);
destroy(l);
l->destroy();
l = tmp;
tmp = unabbreviate_logic(r);
destroy(r);
r->destroy();
r = simplify_f_g(tmp);
destroy(tmp);
tmp->destroy();
tmp = negative_normal_form(r);
destroy(r);
r->destroy();
r = tmp;
bool result = syntactic_implication(l, r);
destroy(l);
destroy(r);
l->destroy();
r->destroy();
return result;
}
}