Commit 1fa1621a authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

Hide the safra_tree_automaton type from the public interface.

We do that because the declaration of this type, which is local to
src/tgba/tgbasafracomplement.cc has a member in an anonymous
namespace, and some versions of g++-4.2 issue a very annoying
warning about this legitimate code.  See Bug 29365 on GCC's
Bugzilla.  Report by Silien Hong <silien.hong@lip6.fr>.

* src/tgba/tgbasafracomplement.hh (safra_tree_automaton): Do not
forward declare.
(tgba_safra_complement): Use void* instead of
safra_tree_automaton*.
* src/tgba/tgbasafracomplement.cc: static_cast void* to
safra_tree_automaton* anywhere needed.
parent 498b44f7
2010-10-07 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Hide the safra_tree_automaton type from the public interface.
We do that because the declaration of this type, which is local to
src/tgba/tgbasafracomplement.cc has a member in an anonymous
namespace, and some versions of g++-4.2 issue a very annoying
warning about this legitimate code. See Bug 29365 on GCC's
Bugzilla. Report by Silien Hong <silien.hong@lip6.fr>.
* src/tgba/tgbasafracomplement.hh (safra_tree_automaton): Do not
forward declare.
(tgba_safra_complement): Use void* instead of
safra_tree_automaton*.
* src/tgba/tgbasafracomplement.cc: static_cast void* to
safra_tree_automaton* anywhere needed.
2010-05-20 Alexandre Duret-Lutz <adl@lrde.epita.fr> 2010-05-20 Alexandre Duret-Lutz <adl@lrde.epita.fr>
Fix the --enable-optimizations check. Fix the --enable-optimizations check.
......
...@@ -6,4 +6,5 @@ Jean-Michel Couvreur ...@@ -6,4 +6,5 @@ Jean-Michel Couvreur
Jean-Michel Ili Jean-Michel Ili
Kristin Y. Rozier Kristin Y. Rozier
Rdiger Ehlers Rdiger Ehlers
Silien Hong
Yann Thierry-Mieg Yann Thierry-Mieg
// Copyright (C) 2009 Laboratoire de Recherche et Développement // Copyright (C) 2009, 2010 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.
...@@ -50,32 +50,29 @@ namespace spot ...@@ -50,32 +50,29 @@ namespace spot
operator()(const safra_tree* left, operator()(const safra_tree* left,
const safra_tree* right) const; const safra_tree* right) const;
}; };
} // anonymous.
/// \brief Automaton with Safra's tree as states. /// \brief Automaton with Safra's tree as states.
struct safra_tree_automaton struct safra_tree_automaton
{ {
safra_tree_automaton(const tgba* sba); safra_tree_automaton(const tgba* sba);
~safra_tree_automaton(); ~safra_tree_automaton();
typedef std::map<bdd, const safra_tree*, bdd_less_than> transition_list; typedef std::map<bdd, const safra_tree*, bdd_less_than> transition_list;
typedef typedef
std::map<safra_tree*, transition_list, safra_tree_ptr_less_than> std::map<safra_tree*, transition_list, safra_tree_ptr_less_than>
automaton_t; automaton_t;
automaton_t automaton; automaton_t automaton;
/// \brief The number of acceptance pairs of this Rabin (Streett) /// \brief The number of acceptance pairs of this Rabin (Streett)
/// automaton. /// automaton.
int get_nb_acceptance_pairs() const; int get_nb_acceptance_pairs() const;
safra_tree* get_initial_state() const; safra_tree* get_initial_state() const;
void set_initial_state(safra_tree* s); void set_initial_state(safra_tree* s);
private: private:
mutable int max_nb_pairs_; mutable int max_nb_pairs_;
safra_tree* initial_state; safra_tree* initial_state;
const tgba* a_; const tgba* a_;
}; };
namespace
{
/// \brief A Safra tree, used as state during the determinization /// \brief A Safra tree, used as state during the determinization
/// of a Büchi automaton /// of a Büchi automaton
/// ///
...@@ -1120,7 +1117,8 @@ namespace spot ...@@ -1120,7 +1117,8 @@ namespace spot
#endif #endif
#if TRANSFORM_TO_TGBA #if TRANSFORM_TO_TGBA
unsigned nb_acc = safra_->get_nb_acceptance_pairs(); unsigned nb_acc =
static_cast<safra_tree_automaton*>(safra_)->get_nb_acceptance_pairs();
all_acceptance_cond_ = bddfalse; all_acceptance_cond_ = bddfalse;
neg_acceptance_cond_ = bddtrue; neg_acceptance_cond_ = bddtrue;
acceptance_cond_vec_.reserve(nb_acc); acceptance_cond_vec_.reserve(nb_acc);
...@@ -1138,15 +1136,15 @@ namespace spot ...@@ -1138,15 +1136,15 @@ namespace spot
tgba_safra_complement::~tgba_safra_complement() tgba_safra_complement::~tgba_safra_complement()
{ {
get_dict()->unregister_all_my_variables(safra_); get_dict()->unregister_all_my_variables(safra_);
delete safra_; delete static_cast<safra_tree_automaton*>(safra_);
} }
state* state*
tgba_safra_complement::get_init_state() const tgba_safra_complement::get_init_state() const
{ {
bitset_t empty(safra_->get_nb_acceptance_pairs()); safra_tree_automaton* a = static_cast<safra_tree_automaton*>(safra_);
return new state_complement(empty, empty, safra_->get_initial_state(), bitset_t empty(a->get_nb_acceptance_pairs());
false); return new state_complement(empty, empty, a->get_initial_state(), false);
} }
...@@ -1189,19 +1187,20 @@ namespace spot ...@@ -1189,19 +1187,20 @@ namespace spot
const state* /* = 0 */, const state* /* = 0 */,
const tgba* /* = 0 */) const const tgba* /* = 0 */) const
{ {
const safra_tree_automaton* a = static_cast<safra_tree_automaton*>(safra_);
const state_complement* s = const state_complement* s =
dynamic_cast<const state_complement*>(local_state); dynamic_cast<const state_complement*>(local_state);
assert(s); assert(s);
safra_tree_automaton::automaton_t::const_iterator tr = safra_tree_automaton::automaton_t::const_iterator tr =
safra_->automaton.find(const_cast<safra_tree*>(s->get_safra())); a->automaton.find(const_cast<safra_tree*>(s->get_safra()));
typedef safra_tree_automaton::transition_list::const_iterator trans_iter; typedef safra_tree_automaton::transition_list::const_iterator trans_iter;
if (tr != safra_->automaton.end()) if (tr != a->automaton.end())
{ {
bdd condition = bddfalse; bdd condition = bddfalse;
tgba_safra_complement_succ_iterator::succ_list_t succ_list; tgba_safra_complement_succ_iterator::succ_list_t succ_list;
int nb_acceptance_pairs = safra_->get_nb_acceptance_pairs(); int nb_acceptance_pairs = a->get_nb_acceptance_pairs();
bitset_t e(nb_acceptance_pairs); bitset_t e(nb_acceptance_pairs);
if (!s->get_use_bitset()) // if \delta'(q, a) if (!s->get_use_bitset()) // if \delta'(q, a)
...@@ -1311,14 +1310,14 @@ namespace spot ...@@ -1311,14 +1310,14 @@ namespace spot
bdd bdd
tgba_safra_complement::compute_support_conditions(const state* state) const tgba_safra_complement::compute_support_conditions(const state* state) const
{ {
const safra_tree_automaton* a = static_cast<safra_tree_automaton*>(safra_);
const state_complement* s = dynamic_cast<const state_complement*>(state); const state_complement* s = dynamic_cast<const state_complement*>(state);
assert(s); assert(s);
typedef safra_tree_automaton::automaton_t::const_iterator auto_it; typedef safra_tree_automaton::automaton_t::const_iterator auto_it;
typedef safra_tree_automaton::transition_list::const_iterator trans_it; typedef safra_tree_automaton::transition_list::const_iterator trans_it;
auto_it node(safra_-> auto_it node(a->automaton.find(const_cast<safra_tree*>(s->get_safra())));
automaton.find(const_cast<safra_tree*>(s->get_safra())));
if (node == safra_->automaton.end()) if (node == a->automaton.end())
return bddtrue; return bddtrue;
bdd res = bddtrue; bdd res = bddtrue;
...@@ -1331,14 +1330,14 @@ namespace spot ...@@ -1331,14 +1330,14 @@ namespace spot
bdd bdd
tgba_safra_complement::compute_support_variables(const state* state) const tgba_safra_complement::compute_support_variables(const state* state) const
{ {
const safra_tree_automaton* a = static_cast<safra_tree_automaton*>(safra_);
const state_complement* s = dynamic_cast<const state_complement*>(state); const state_complement* s = dynamic_cast<const state_complement*>(state);
assert(s); assert(s);
typedef safra_tree_automaton::automaton_t::const_iterator auto_it; typedef safra_tree_automaton::automaton_t::const_iterator auto_it;
typedef safra_tree_automaton::transition_list::const_iterator trans_it; typedef safra_tree_automaton::transition_list::const_iterator trans_it;
auto_it node(safra_-> auto_it node(a->automaton.find(const_cast<safra_tree*>(s->get_safra())));
automaton.find(const_cast<safra_tree*>(s->get_safra())));
if (node == safra_->automaton.end()) if (node == a->automaton.end())
return bddtrue; return bddtrue;
bdd res = bddtrue; bdd res = bddtrue;
...@@ -1352,6 +1351,7 @@ namespace spot ...@@ -1352,6 +1351,7 @@ namespace spot
////////////////////////////// //////////////////////////////
void display_safra(const tgba_safra_complement* a) void display_safra(const tgba_safra_complement* a)
{ {
test::print_safra_automaton(a->get_safra()); test::print_safra_automaton(static_cast<safra_tree_automaton*>
(a->get_safra()));
} }
} }
...@@ -31,8 +31,6 @@ ...@@ -31,8 +31,6 @@
namespace spot namespace spot
{ {
struct safra_tree_automaton;
/// \brief Build a complemented automaton. /// \brief Build a complemented automaton.
/// \ingroup tgba_on_the_fly_algorithms /// \ingroup tgba_on_the_fly_algorithms
/// ///
...@@ -56,11 +54,6 @@ namespace spot ...@@ -56,11 +54,6 @@ namespace spot
tgba_safra_complement(const tgba* a); tgba_safra_complement(const tgba* a);
virtual ~tgba_safra_complement(); virtual ~tgba_safra_complement();
safra_tree_automaton* get_safra() const
{
return safra_;
}
// tgba interface. // tgba interface.
virtual state* get_init_state() const; virtual state* get_init_state() const;
virtual tgba_succ_iterator* virtual tgba_succ_iterator*
...@@ -73,12 +66,17 @@ namespace spot ...@@ -73,12 +66,17 @@ namespace spot
virtual bdd all_acceptance_conditions() const; virtual bdd all_acceptance_conditions() const;
virtual bdd neg_acceptance_conditions() const; virtual bdd neg_acceptance_conditions() const;
void* get_safra() const
{
return safra_;
}
protected: protected:
virtual bdd compute_support_conditions(const state* state) const; virtual bdd compute_support_conditions(const state* state) const;
virtual bdd compute_support_variables(const state* state) const; virtual bdd compute_support_variables(const state* state) const;
private: private:
const tgba* automaton_; const tgba* automaton_;
safra_tree_automaton* safra_; void* safra_;
#if TRANSFORM_TO_TBA #if TRANSFORM_TO_TBA
bdd the_acceptance_cond_; bdd the_acceptance_cond_;
#endif #endif
...@@ -88,7 +86,6 @@ namespace spot ...@@ -88,7 +86,6 @@ namespace spot
// Map to i the i-th acceptance condition of the final automaton. // Map to i the i-th acceptance condition of the final automaton.
std::vector<int> acceptance_cond_vec_; std::vector<int> acceptance_cond_vec_;
#endif #endif
}; };
/// \brief Produce a dot output of the Safra automaton associated /// \brief Produce a dot output of the Safra automaton associated
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment