common: introduce SPOT_UNREACHABLE and SPOT_UNIMPLEMENTED.

* src/misc/common.hh (SPOT_UNIMPLEMENTED, SPOT_UNREACHABLE,
SPOT_UNREACHABLE_BUILTIN): New macros.
* src/bin/dstar2tgba.cc, src/bin/ltlcross.cc,
src/dstarparse/dstar2tgba.cc, src/eltlparse/eltlparse.yy,
src/ltlast/binop.cc, src/ltlast/bunop.cc, src/ltlast/constant.cc,
src/ltlast/formula_tree.cc, src/ltlast/multop.cc, src/ltlast/nfa.cc,
src/ltlast/unop.cc, src/ltlvisit/dotty.cc, src/ltlvisit/lbt.cc,
src/ltlvisit/lunabbrev.cc, src/ltlvisit/mark.cc,
src/ltlvisit/randomltl.cc, src/ltlvisit/simpfg.cc,
src/ltlvisit/simplify.cc, src/ltlvisit/snf.cc, src/ltlvisit/tostring.cc,
src/misc/intvcomp.cc, src/misc/minato.cc, src/tgba/bdddict.cc,
src/tgba/formula2bdd.cc, src/tgba/tgbasafracomplement.cc,
src/tgbaalgos/eltl2tgba_lacim.cc, src/tgbaalgos/ltl2taa.cc,
src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/ltl2tgba_lacim.cc,
src/tgbaalgos/simulation.cc, src/tgbatest/ltl2tgba.cc:  Use them.
* src/sanity/style.test: Catch assert(0) and assert(!"text");
This commit is contained in:
Alexandre Duret-Lutz 2014-06-27 14:42:54 +02:00
parent c93b41a2c7
commit 2beacc3924
33 changed files with 190 additions and 227 deletions

View file

@ -285,8 +285,7 @@ namespace
int int
process_formula(const spot::ltl::formula*, const char*, int) process_formula(const spot::ltl::formula*, const char*, int)
{ {
assert(!"should not happen"); SPOT_UNREACHABLE();
return 0;
} }

View file

@ -715,7 +715,7 @@ namespace
else if (*pos == 'D') else if (*pos == 'D')
format = Dstar; format = Dstar;
else else
assert(!"BUG"); SPOT_UNREACHABLE();
if (val_) if (val_)
{ {
@ -823,7 +823,7 @@ namespace
return string_ltl_wring; return string_ltl_wring;
if (!string_ltl_lbt.val().empty()) if (!string_ltl_lbt.val().empty())
return string_ltl_lbt; return string_ltl_lbt;
assert(!"None of the translators need the input formula?"); SPOT_UNREACHABLE();
return string_ltl_spot; return string_ltl_spot;
} }
@ -997,7 +997,7 @@ namespace
break; break;
} }
case printable_result_filename::None: case printable_result_filename::None:
assert(!"unreachable code"); SPOT_UNREACHABLE();
} }
} }

View file

@ -1,5 +1,6 @@
// Copyright (C) 2013 Laboratoire de Recherche et Développement de // -*- coding: utf-8 -*-
// l'Epita (LRDE). // Copyright (C) 2013, 2014 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,6 @@ namespace spot
case spot::Streett: case spot::Streett:
return nsa_to_tgba(daut); return nsa_to_tgba(daut);
} }
assert(!"unreachable code"); SPOT_UNREACHABLE();
return 0;
} }
} }

View file

@ -138,10 +138,7 @@ namespace spot
res->rhs = realias(a->rhs, v); res->rhs = realias(a->rhs, v);
return node_ptr(res); return node_ptr(res);
} }
SPOT_UNREACHABLE();
/* Unreachable code. */
assert(0);
return node_ptr(static_cast<node_unop*>(0));
} }
} }
} }

View file

@ -300,9 +300,7 @@ namespace spot
case UConcat: case UConcat:
return "UConcat"; return "UConcat";
} }
// Unreachable code. SPOT_UNREACHABLE();
assert(0);
return 0;
} }
binop::map binop::instances; binop::map binop::instances;

View file

@ -107,9 +107,7 @@ namespace spot
case Star: case Star:
return "Star"; return "Star";
} }
// Unreachable code. SPOT_UNREACHABLE();
assert(0);
return 0;
} }
std::string std::string

View file

@ -100,9 +100,7 @@ namespace spot
case EmptyWord: case EmptyWord:
return "constant(e)"; return "constant(e)";
} }
// Unreachable code. SPOT_UNREACHABLE();
assert(0);
return "BUG";
} }
void void
@ -123,9 +121,7 @@ namespace spot
case EmptyWord: case EmptyWord:
return "[*0]"; return "[*0]";
} }
// Unreachable code. SPOT_UNREACHABLE();
assert(0);
return 0;
} }
} }
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2012, 2013 Laboratoire de Recherche et // Copyright (C) 2009, 2012, 2013, 2014 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.
@ -53,10 +53,7 @@ namespace spot
return multop::instance(n->op, return multop::instance(n->op,
instanciate(n->lhs, v), instanciate(n->lhs, v),
instanciate(n->rhs, v)); instanciate(n->rhs, v));
SPOT_UNREACHABLE();
/* Unreachable code. */
assert(0);
return 0;
} }
size_t size_t
@ -78,10 +75,7 @@ namespace spot
return std::max(arity(n->lhs), arity(n->rhs)); return std::max(arity(n->lhs), arity(n->rhs));
if (node_multop* n = dynamic_cast<node_multop*>(np.get())) if (node_multop* n = dynamic_cast<node_multop*>(np.get()))
return std::max(arity(n->lhs), arity(n->rhs)); return std::max(arity(n->lhs), arity(n->rhs));
SPOT_UNREACHABLE();
/* Unreachable code. */
assert(0);
return 0;
} }
} }
} }

View file

@ -185,9 +185,7 @@ namespace spot
case Fusion: case Fusion:
return "Fusion"; return "Fusion";
} }
// Unreachable code. SPOT_UNREACHABLE();
assert(0);
return 0;
} }
namespace namespace

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2008, 2013 Laboratoire de Recherche et Développement de // Copyright (C) 2008, 2013, 2014 Laboratoire de Recherche et
// 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.
// //
@ -106,8 +106,7 @@ namespace spot
const nfa::state* const nfa::state*
nfa::get_init_state() nfa::get_init_state()
{ {
if (!init_) assert(init_);
assert(0);
return init_; return init_;
} }

View file

@ -189,9 +189,7 @@ namespace spot
case NegClosureMarked: case NegClosureMarked:
return "NegClosureMarked"; return "NegClosureMarked";
} }
// Unreachable code. SPOT_UNREACHABLE();
assert(0);
return 0;
} }
unop::map unop::instances; unop::map unop::instances;

View file

@ -95,7 +95,7 @@ namespace spot
void void
visit(const automatop*) visit(const automatop*)
{ {
assert(0); SPOT_UNIMPLEMENTED();
} }
void void

View file

@ -94,7 +94,7 @@ namespace spot
os_ << 't'; os_ << 't';
break; break;
case constant::EmptyWord: case constant::EmptyWord:
assert(!"unsupported constant"); SPOT_UNIMPLEMENTED();
break; break;
} }
} }
@ -129,7 +129,7 @@ namespace spot
case binop::UConcat: case binop::UConcat:
case binop::EConcat: case binop::EConcat:
case binop::EConcatMarked: case binop::EConcatMarked:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
break; break;
} }
bo->first()->accept(*this); bo->first()->accept(*this);
@ -139,7 +139,7 @@ namespace spot
void void
visit(const bunop*) visit(const bunop*)
{ {
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
void void
@ -164,7 +164,7 @@ namespace spot
case unop::Closure: case unop::Closure:
case unop::NegClosure: case unop::NegClosure:
case unop::NegClosureMarked: case unop::NegClosureMarked:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
break; break;
} }
uo->child()->accept(*this); uo->child()->accept(*this);
@ -173,7 +173,7 @@ namespace spot
void void
visit(const automatop*) visit(const automatop*)
{ {
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
void void
@ -193,7 +193,7 @@ namespace spot
case multop::AndNLM: case multop::AndNLM:
case multop::Concat: case multop::Concat:
case multop::Fusion: case multop::Fusion:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
break; break;
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2012 Laboratoire de Recherche et // Copyright (C) 2009, 2010, 2012, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 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
@ -93,8 +93,7 @@ namespace spot
result_ = binop::instance(op, f1, f2); result_ = binop::instance(op, f1, f2);
return; return;
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
const formula* const formula*

View file

@ -1,5 +1,6 @@
// Copyright (C) 2010, 2012 Laboratoire de Recherche et Développement // -*- coding: utf-8 -*-
// de l'Epita (LRDE). // Copyright (C) 2010, 2012, 2014 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.
// //
@ -94,7 +95,7 @@ namespace spot
case multop::AndRat: case multop::AndRat:
case multop::Concat: case multop::Concat:
case multop::Fusion: case multop::Fusion:
assert(!"unexpected operator"); SPOT_UNIMPLEMENTED();
case multop::Or: case multop::Or:
for (unsigned i = 0; i < mos; ++i) for (unsigned i = 0; i < mos; ++i)
res->push_back(recurse(mo->nth(i))); res->push_back(recurse(mo->nth(i)));
@ -252,8 +253,7 @@ namespace spot
uo->child()->clone()); uo->child()->clone());
return; return;
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
@ -280,7 +280,7 @@ namespace spot
case binop::Xor: case binop::Xor:
case binop::Implies: case binop::Implies:
case binop::Equiv: case binop::Equiv:
assert(!"mark not defined on logic abbreviations"); SPOT_UNIMPLEMENTED();
case binop::U: case binop::U:
case binop::W: case binop::W:
case binop::M: case binop::M:
@ -297,8 +297,7 @@ namespace spot
return; return;
} }
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
const formula* const formula*

View file

@ -189,7 +189,7 @@ namespace spot
else if (proba_[i].min_n > 2) else if (proba_[i].min_n > 2)
total_2_and_more_ += proba_[i].proba; total_2_and_more_ += proba_[i].proba;
else else
assert(!"unexpected max_n"); SPOT_UNREACHABLE(); // unexpected max_n
} }
assert(total_2_and_more_ >= total_2_); assert(total_2_and_more_ >= total_2_);
} }

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2010, 2012 Laboratoire de Recherche et Développement de // Copyright (C) 2010, 2012, 2014 Laboratoire de Recherche et
// l'Epita (LRDE). // 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.
@ -84,8 +84,7 @@ namespace spot
result_ = binop::instance(binop::M, f1, f2); result_ = binop::instance(binop::M, f1, f2);
return; return;
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
const formula* const formula*

View file

@ -185,7 +185,7 @@ namespace spot
else if (f == constant::false_instance()) else if (f == constant::false_instance())
result = bddfalse; result = bddfalse;
else else
assert(!"Unsupported operator"); SPOT_UNIMPLEMENTED();
break; break;
case formula::AtomicProp: case formula::AtomicProp:
result = bdd_ithvar(dict->register_proposition(f, this)); result = bdd_ithvar(dict->register_proposition(f, this));
@ -213,7 +213,7 @@ namespace spot
op = bddop_biimp; op = bddop_biimp;
break; break;
default: default:
assert(!"Unsupported operator"); SPOT_UNIMPLEMENTED();
} }
result = bdd_apply(as_bdd(bo->first()), as_bdd(bo->second()), op); result = bdd_apply(as_bdd(bo->first()), as_bdd(bo->second()), op);
break; break;
@ -244,14 +244,14 @@ namespace spot
case multop::OrRat: case multop::OrRat:
case multop::Concat: case multop::Concat:
case multop::Fusion: case multop::Fusion:
assert(!"Unsupported operator"); SPOT_UNIMPLEMENTED();
break; break;
} }
break; break;
} }
case formula::BUnOp: case formula::BUnOp:
case formula::AutomatOp: case formula::AutomatOp:
assert(!"Unsupported operator"); SPOT_UNIMPLEMENTED();
break; break;
} }
@ -490,9 +490,7 @@ namespace spot
{ {
case unop::Not: case unop::Not:
// "Not"s should be caught by nenoform_recursively(). // "Not"s should be caught by nenoform_recursively().
assert(!"Not should not occur"); SPOT_UNREACHABLE();
//result_ = recurse_(f, negated_ ^ true);
return;
case unop::X: case unop::X:
/* !Xa == X!a */ /* !Xa == X!a */
result_ = unop::instance(unop::X, recurse(f)); result_ = unop::instance(unop::X, recurse(f));
@ -525,8 +523,7 @@ namespace spot
result_ = unop::instance(unop::Not, result_); result_ = unop::instance(unop::Not, result_);
return; return;
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
@ -630,8 +627,7 @@ namespace spot
recurse_(f1, false), recurse(f2)); recurse_(f1, false), recurse(f2));
return; return;
} }
// Unreachable code. SPOT_UNREACHABLE();
assert(0);
} }
void void
@ -2182,7 +2178,7 @@ namespace spot
case binop::Xor: case binop::Xor:
case binop::Equiv: case binop::Equiv:
case binop::Implies: case binop::Implies:
assert(!"operator not supported for implication rules"); SPOT_UNIMPLEMENTED();
return; return;
case binop::UConcat: case binop::UConcat:
case binop::EConcat: case binop::EConcat:

View file

@ -49,7 +49,7 @@ namespace spot
void void
visit(const atomic_prop*) visit(const atomic_prop*)
{ {
assert(!"unexpected operator"); SPOT_UNIMPLEMENTED();
} }
void void
@ -76,19 +76,19 @@ namespace spot
void void
visit(const unop*) visit(const unop*)
{ {
assert(!"unexpected operator"); SPOT_UNIMPLEMENTED();
} }
void void
visit(const binop*) visit(const binop*)
{ {
assert(!"unexpected operator"); SPOT_UNIMPLEMENTED();
} }
void void
visit(const automatop*) visit(const automatop*)
{ {
assert(!"unexpected operator"); SPOT_UNIMPLEMENTED();
} }
void void
@ -100,7 +100,7 @@ namespace spot
case multop::And: case multop::And:
case multop::Or: case multop::Or:
case multop::Fusion: case multop::Fusion:
assert(!"unexpected operator"); SPOT_UNIMPLEMENTED();
break; break;
case multop::Concat: case multop::Concat:
case multop::AndNLM: case multop::AndNLM:

View file

@ -847,7 +847,7 @@ namespace spot
break; break;
case multop::Concat: case multop::Concat:
// Handled by resugar_concat. // Handled by resugar_concat.
assert(0); SPOT_UNREACHABLE();
break; break;
case multop::Fusion: case multop::Fusion:
k = KFusion; k = KFusion;

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Développement // Copyright (C) 2013, 2014 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.
@ -17,6 +17,9 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cstdlib>
#include <stdexcept>
#ifndef SPOT_MISC_COMMON_HH #ifndef SPOT_MISC_COMMON_HH
# define SPOT_MISC_COMMON_HH # define SPOT_MISC_COMMON_HH
@ -73,4 +76,23 @@
#define SPOT_DELETED = delete #define SPOT_DELETED = delete
#endif #endif
// Do not use those in code, prefer SPOT_UNREACHABLE() instead.
#if defined __clang__ || defined __GNU__
# define SPOT_UNREACHABLE_BUILTIN() __builtin_unreachable()
# elif defined _MSC_VER
# define SPOT_UNREACHABLE_BUILTIN() __assume(0)
# else
# define SPOT_UNREACHABLE_BUILTIN() abort()
#endif
// The extra parentheses in assert() is so that this
// pattern is not caught by the style checker.
#define SPOT_UNREACHABLE() do { \
assert(!("unreachable code reached")); \
SPOT_UNREACHABLE_BUILTIN(); \
} while (0)
#define SPOT_UNIMPLEMENTED() throw std::runtime_error("unimplemented");
#endif // SPOT_MISC_COMMON_HH #endif // SPOT_MISC_COMMON_HH

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Développement // Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
// 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.
// //
@ -506,7 +506,7 @@ namespace spot
self().push_data(get_32_bits()); self().push_data(get_32_bits());
break; break;
default: default:
assert(0); SPOT_UNREACHABLE();
} }
} }
} }

View file

@ -157,8 +157,7 @@ namespace spot
todo_.pop(); todo_.pop();
continue; continue;
} }
// Unreachable code. SPOT_UNREACHABLE();
assert(0);
} }
return bddfalse; return bddfalse;
} }

View file

@ -240,6 +240,9 @@ for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do
egrep '(->|[.])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 'assert\((0|!".*")\)' $tmp &&
diag 'Prefer SPOT_UNREACHABLE or SPOT_UNIMPLEMENTED.'
egrep '^[^=*<]*([+][+]|--);' $tmp && egrep '^[^=*<]*([+][+]|--);' $tmp &&
diag 'Take good habits: use ++i instead of i++ when you have the choice.' diag 'Take good habits: use ++i instead of i++ when you have the choice.'

View file

@ -529,7 +529,7 @@ namespace spot
std::cerr << "some maps are not empty" << std::endl; std::cerr << "some maps are not empty" << std::endl;
} }
dump(std::cerr); dump(std::cerr);
assert(0); abort();
} }

View file

@ -1,8 +1,9 @@
// Copyright (C) 2009, 2010, 2012 Laboratoire de Recherche et // -*- coding: utf-8 -*-
// Développement de l'Epita (LRDE). // Copyright (C) 2009, 2010, 2012, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris // Copyright (C) 2003, 2004 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.
// //
@ -62,17 +63,15 @@ namespace spot
res_ = bddfalse; res_ = bddfalse;
return; return;
case constant::EmptyWord: case constant::EmptyWord:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
virtual void virtual void
visit(const bunop*) visit(const bunop*)
{ {
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
return;
} }
virtual void virtual void
@ -87,15 +86,14 @@ namespace spot
case unop::Closure: case unop::Closure:
case unop::NegClosure: case unop::NegClosure:
case unop::NegClosureMarked: case unop::NegClosureMarked:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
case unop::Not: case unop::Not:
{ {
res_ = bdd_not(recurse(node->child())); res_ = bdd_not(recurse(node->child()));
return; return;
} }
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
virtual void virtual void
@ -122,16 +120,15 @@ namespace spot
case binop::UConcat: case binop::UConcat:
case binop::EConcat: case binop::EConcat:
case binop::EConcatMarked: case binop::EConcatMarked:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
virtual void virtual void
visit(const automatop*) visit(const automatop*)
{ {
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
virtual void virtual void
@ -153,7 +150,7 @@ namespace spot
case multop::AndNLM: case multop::AndNLM:
case multop::OrRat: case multop::OrRat:
case multop::AndRat: case multop::AndRat:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
assert(op != -1); assert(op != -1);
unsigned s = node->size(); unsigned s = node->size();

View file

@ -1169,26 +1169,26 @@ namespace spot
safra_tree_automaton::automaton_t::const_iterator tr = safra_tree_automaton::automaton_t::const_iterator tr =
a->automaton.find(const_cast<safra_tree*>(s->get_safra())); a->automaton.find(const_cast<safra_tree*>(s->get_safra()));
if (tr != a->automaton.end()) assert(tr != a->automaton.end());
{
bdd condition = bddfalse;
tgba_safra_complement_succ_iterator::succ_list_t succ_list;
int nb_acceptance_pairs = a->get_nb_acceptance_pairs();
bitvect* e = make_bitvect(nb_acceptance_pairs);
if (!s->get_use_bitset()) // if \delta'(q, a) bdd condition = bddfalse;
tgba_safra_complement_succ_iterator::succ_list_t succ_list;
int nb_acceptance_pairs = a->get_nb_acceptance_pairs();
bitvect* e = make_bitvect(nb_acceptance_pairs);
if (!s->get_use_bitset()) // if \delta'(q, a)
{ {
for (auto& p: tr->second) for (auto& p: tr->second)
{ {
state_complement* s1 = new state_complement(e->clone(), e->clone(), state_complement* s1 = new state_complement(e->clone(), e->clone(),
p.second, false); p.second, false);
state_complement* s2 = new state_complement(e->clone(), e->clone(), state_complement* s2 = new state_complement(e->clone(), e->clone(),
p.second, true); p.second, true);
succ_list.insert(std::make_pair(p.first, s1)); succ_list.insert(std::make_pair(p.first, s1));
succ_list.insert(std::make_pair(p.first, s2)); succ_list.insert(std::make_pair(p.first, s2));
} }
} }
else else
{ {
bitvect* l = make_bitvect(nb_acceptance_pairs); bitvect* l = make_bitvect(nb_acceptance_pairs);
bitvect* u = make_bitvect(nb_acceptance_pairs); bitvect* u = make_bitvect(nb_acceptance_pairs);
@ -1205,22 +1205,23 @@ namespace spot
// \delta'((q, I, J), a) if I'\subseteq J' // \delta'((q, I, J), a) if I'\subseteq J'
if (newI->is_subset_of(*newJ)) if (newI->is_subset_of(*newJ))
{ {
for (auto& p: tr->second) for (auto& p: tr->second)
{ {
st = new state_complement(e->clone(), e->clone(), p.second, true); st = new state_complement(e->clone(), e->clone(),
succ_list.insert(std::make_pair(p.first, st)); p.second, true);
} succ_list.insert(std::make_pair(p.first, st));
condition = the_acceptance_cond_; }
} condition = the_acceptance_cond_;
}
else // \delta'((q, I, J), a) else // \delta'((q, I, J), a)
{ {
for (auto& p: tr->second) for (auto& p: tr->second)
{ {
st = new state_complement(newI, newJ, p.second, true); st = new state_complement(newI, newJ, p.second, true);
succ_list.insert(std::make_pair(p.first, st)); succ_list.insert(std::make_pair(p.first, st));
} }
} }
delete newI; delete newI;
delete newJ; delete newJ;
#else #else
@ -1230,11 +1231,11 @@ namespace spot
*pending |= *l; *pending |= *l;
*pending -= *u; *pending -= *u;
for (auto& p: tr->second) for (auto& p: tr->second)
{ {
st = new state_complement(pending->clone(), e->clone(), st = new state_complement(pending->clone(), e->clone(),
p.second, true); p.second, true);
succ_list.insert(std::make_pair(p.first, st)); succ_list.insert(std::make_pair(p.first, st));
} }
delete pending; delete pending;
for (unsigned i = 0; i < l->size(); ++i) for (unsigned i = 0; i < l->size(); ++i)
@ -1244,11 +1245,8 @@ namespace spot
delete u; delete u;
delete l; delete l;
} }
delete e; delete e;
return new tgba_safra_complement_succ_iterator(succ_list, condition); return new tgba_safra_complement_succ_iterator(succ_list, condition);
}
assert(!"Safra automaton does not find this node");
return 0;
} }
bdd_dict* bdd_dict*

View file

@ -71,10 +71,9 @@ namespace spot
res_ = bddfalse; res_ = bddfalse;
return; return;
case constant::EmptyWord: case constant::EmptyWord:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
@ -103,16 +102,15 @@ namespace spot
case unop::Closure: case unop::Closure:
case unop::NegClosure: case unop::NegClosure:
case unop::NegClosureMarked: case unop::NegClosureMarked:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
visit(const bunop*) visit(const bunop*)
{ {
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
void void
@ -139,10 +137,9 @@ namespace spot
case binop::UConcat: case binop::UConcat:
case binop::EConcat: case binop::EConcat:
case binop::EConcatMarked: case binop::EConcatMarked:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
@ -170,7 +167,7 @@ namespace spot
case multop::AndNLM: case multop::AndNLM:
case multop::AndRat: case multop::AndRat:
case multop::OrRat: case multop::OrRat:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
assert(op != -1); assert(op != -1);
unsigned s = node->size(); unsigned s = node->size();

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2012, 2013 Laboratoire de Recherche et // Copyright (C) 2009, 2010, 2012, 2013, 2014 Laboratoire de Recherche
// Développement de l'Epita (LRDE). // 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.
// //
@ -103,11 +103,9 @@ namespace spot
case constant::False: case constant::False:
return; return;
case constant::EmptyWord: case constant::EmptyWord:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
return;
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
@ -134,7 +132,7 @@ namespace spot
} }
case unop::F: case unop::F:
case unop::G: case unop::G:
assert(0); // TBD SPOT_UNIMPLEMENTED(); // TBD
return; return;
case unop::Not: case unop::Not:
// Done in recurse // Done in recurse
@ -144,17 +142,15 @@ namespace spot
case unop::Closure: case unop::Closure:
case unop::NegClosure: case unop::NegClosure:
case unop::NegClosureMarked: case unop::NegClosureMarked:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
return;
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
visit(const bunop*) visit(const bunop*)
{ {
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
void void
@ -254,14 +250,12 @@ namespace spot
case binop::Xor: case binop::Xor:
case binop::Implies: case binop::Implies:
case binop::Equiv: case binop::Equiv:
assert(0); // TBD
case binop::UConcat: case binop::UConcat:
case binop::EConcat: case binop::EConcat:
case binop::EConcatMarked: case binop::EConcatMarked:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
@ -335,18 +329,15 @@ namespace spot
case multop::AndNLM: case multop::AndNLM:
case multop::AndRat: case multop::AndRat:
case multop::OrRat: case multop::OrRat:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
return;
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
visit(const automatop* node) visit(const automatop*)
{ {
(void) node; SPOT_UNIMPLEMENTED();
assert(!"unsupported operator");
} }
ltl2taa_visitor ltl2taa_visitor

View file

@ -615,8 +615,7 @@ namespace spot
res_ = now_to_concat(); res_ = now_to_concat();
return; return;
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
@ -631,8 +630,7 @@ namespace spot
case unop::Closure: case unop::Closure:
case unop::NegClosure: case unop::NegClosure:
case unop::NegClosureMarked: case unop::NegClosureMarked:
assert(!"not a rational operator"); SPOT_UNREACHABLE(); // Because not rational operator
return;
case unop::Not: case unop::Not:
{ {
// Not can only appear in front of Boolean // Not can only appear in front of Boolean
@ -644,8 +642,7 @@ namespace spot
return; return;
} }
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
@ -726,20 +723,19 @@ namespace spot
} }
return; return;
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
visit(const binop*) visit(const binop*)
{ {
assert(!"not a rational operator"); SPOT_UNREACHABLE(); // Not a rational operator
} }
void void
visit(const automatop*) visit(const automatop*)
{ {
assert(!"not a rational operator"); SPOT_UNREACHABLE(); // Not a rational operator
} }
void void
@ -938,7 +934,7 @@ namespace spot
} }
case multop::And: case multop::And:
case multop::Or: case multop::Or:
assert(!"not a rational operator"); SPOT_UNREACHABLE(); // Not a rational operator
} }
} }
@ -1238,11 +1234,9 @@ namespace spot
res_ = bddfalse; res_ = bddfalse;
return; return;
case constant::EmptyWord: case constant::EmptyWord:
assert(!"Not an LTL operator"); SPOT_UNIMPLEMENTED();
return;
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
@ -1443,15 +1437,14 @@ namespace spot
break; break;
case unop::Finish: case unop::Finish:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
break;
} }
} }
void void
visit(const bunop*) visit(const bunop*)
{ {
assert(!"Not an LTL operator"); SPOT_UNREACHABLE(); // Not an LTL operator
} }
void void
@ -1468,8 +1461,7 @@ namespace spot
// These operators should only appear in Boolean formulas, // These operators should only appear in Boolean formulas,
// which must have been dealt with earlier (in // which must have been dealt with earlier (in
// translate_dict::ltl_to_bdd()). // translate_dict::ltl_to_bdd()).
assert(!"unexpected operator"); SPOT_UNREACHABLE();
break;
case binop::U: case binop::U:
{ {
bdd f1 = recurse(node->first()); bdd f1 = recurse(node->first());
@ -1651,7 +1643,7 @@ namespace spot
void void
visit(const automatop*) visit(const automatop*)
{ {
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
void void
@ -1712,8 +1704,7 @@ namespace spot
case multop::AndNLM: case multop::AndNLM:
case multop::AndRat: case multop::AndRat:
case multop::OrRat: case multop::OrRat:
assert(!"Not an LTL operator"); SPOT_UNREACHABLE(); // Not an LTL operator
break;
} }
} }
@ -1839,20 +1830,19 @@ namespace spot
// FIXME: we might need to add Acc[1] // FIXME: we might need to add Acc[1]
return; return;
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
visit(const automatop*) visit(const automatop*)
{ {
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
void void
visit(const bunop*) visit(const bunop*)
{ {
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
void void

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2012 Laboratoire de Recherche et // Copyright (C) 2009, 2010, 2012, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 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
@ -76,10 +76,9 @@ namespace spot
res_ = bddfalse; res_ = bddfalse;
return; return;
case constant::EmptyWord: case constant::EmptyWord:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
@ -152,16 +151,15 @@ namespace spot
case unop::Closure: case unop::Closure:
case unop::NegClosure: case unop::NegClosure:
case unop::NegClosureMarked: case unop::NegClosureMarked:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
visit(const bunop*) visit(const bunop*)
{ {
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
void void
@ -230,17 +228,15 @@ namespace spot
case binop::UConcat: case binop::UConcat:
case binop::EConcat: case binop::EConcat:
case binop::EConcatMarked: case binop::EConcatMarked:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
break;
} }
/* Unreachable code. */ SPOT_UNREACHABLE();
assert(0);
} }
void void
visit(const automatop*) visit(const automatop*)
{ {
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
void void
@ -268,7 +264,7 @@ namespace spot
case multop::AndNLM: case multop::AndNLM:
case multop::AndRat: case multop::AndRat:
case multop::OrRat: case multop::OrRat:
assert(!"unsupported operator"); SPOT_UNIMPLEMENTED();
} }
assert(op != -1); assert(op != -1);
unsigned s = node->size(); unsigned s = node->size();

View file

@ -1026,7 +1026,7 @@ namespace spot
} }
else else
assert(0); SPOT_UNREACHABLE();
} }

View file

@ -1901,7 +1901,7 @@ main(int argc, char** argv)
} }
default: default:
assert(!"unknown output option"); SPOT_UNREACHABLE();
} }
tm.stop("producing output"); tm.stop("producing output");
} }