use more override and final keywords

This patch is mostly focused on tagging most virtual methods that
override as such.  I found a few methods that where not meant to be
virtual this way, and tagged a few classes "final" along the way.

* bin/common_output.cc, spot/kripke/fairkripke.hh,
spot/kripke/kripke.hh, spot/kripke/kripkegraph.hh,
spot/ltsmin/ltsmin.cc, spot/misc/formater.hh, spot/priv/bddalloc.hh,
spot/ta/ta.hh, spot/ta/taexplicit.hh, spot/ta/taproduct.hh,
spot/ta/tgta.hh, spot/ta/tgtaexplicit.cc, spot/ta/tgtaexplicit.hh,
spot/ta/tgtaproduct.hh, spot/taalgos/emptinessta.hh, spot/tl/declenv.hh,
spot/tl/defaultenv.hh, spot/tl/randomltl.hh, spot/tl/relabel.cc,
spot/twa/bdddict.cc, spot/twa/taatgba.hh, spot/twa/twagraph.hh,
spot/twa/twaproduct.hh, spot/twaalgos/gtec/ce.cc,
spot/twaalgos/gtec/ce.hh, spot/twaalgos/gtec/gtec.hh,
spot/twaalgos/gv04.cc, spot/twaalgos/ltl2taa.cc, spot/twaalgos/magic.cc,
spot/twaalgos/minimize.cc, spot/twaalgos/ndfs_result.hxx,
spot/twaalgos/reachiter.hh, spot/twaalgos/se05.cc,
spot/twaalgos/stutter.cc, spot/twaalgos/tau03.cc: Add more override and
final keywords.
This commit is contained in:
Alexandre Duret-Lutz 2016-02-15 22:43:23 +01:00
parent 1ae0600cae
commit 5d272fd256
35 changed files with 249 additions and 291 deletions

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2011, 2013, 2014, 2015 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2010, 2011, 2013, 2014, 2015, 2016 Laboratoire de
// Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
@ -170,7 +170,7 @@ namespace spot
const state* substart = ecs_->cycle_seed;
do
{
struct scc_bfs: bfs_steps
struct scc_bfs final: bfs_steps
{
const couvreur99_check_status* ecs;
couvreur99_check_result* r;
@ -186,7 +186,7 @@ namespace spot
}
virtual const state*
filter(const state* s)
filter(const state* s) override
{
auto i = ecs->h.find(s);
s->destroy();
@ -201,7 +201,7 @@ namespace spot
}
virtual bool
match(twa_run::step& st, const state* s)
match(twa_run::step& st, const state* s) override
{
acc_cond::mark_t less_acc =
acc_to_traverse - st.acc;

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement de
// Copyright (C) 2013, 2014, 2016 Laboratoire de Recherche et Développement de
// l'Epita (LRDE).
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -29,7 +29,7 @@
namespace spot
{
/// Compute a counter example from a spot::couvreur99_check_status
class SPOT_API couvreur99_check_result:
class SPOT_API couvreur99_check_result final:
public emptiness_check_result,
public acss_statistics
{
@ -38,11 +38,11 @@ namespace spot
std::shared_ptr<const couvreur99_check_status>& ecs,
option_map o = option_map());
virtual twa_run_ptr accepting_run();
virtual twa_run_ptr accepting_run() override;
void print_stats(std::ostream& os) const;
virtual unsigned acss_states() const;
virtual unsigned acss_states() const override;
protected:
/// Called by accepting_run() to find a cycle which traverses all

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2013, 2014, 2015 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2008, 2013, 2014, 2015, 2016 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
@ -146,12 +146,13 @@ namespace spot
{
public:
couvreur99_check(const const_twa_ptr& a, option_map o = option_map());
virtual ~couvreur99_check();
/// Check whether the automaton's language is empty.
virtual emptiness_check_result_ptr check();
virtual emptiness_check_result_ptr check() override;
virtual std::ostream& print_stats(std::ostream& os) const;
virtual std::ostream& print_stats(std::ostream& os) const override;
/// \brief Return the status of the emptiness-check.
///
@ -190,7 +191,7 @@ namespace spot
couvreur99_check_shy(const const_twa_ptr& a, option_map o = option_map());
virtual ~couvreur99_check_shy();
virtual emptiness_check_result_ptr check();
virtual emptiness_check_result_ptr check() override;
protected:
struct successor {

View file

@ -85,7 +85,7 @@ namespace spot
}
virtual emptiness_check_result_ptr
check()
check() override
{
top = dftop = -1;
violation = false;
@ -226,7 +226,7 @@ namespace spot
}
virtual std::ostream&
print_stats(std::ostream& os) const
print_stats(std::ostream& os) const override
{
os << h.size() << " unique states visited\n";
os << transitions() << " transitions explored\n";
@ -264,7 +264,7 @@ namespace spot
}
virtual unsigned
acss_states() const
acss_states() const override
{
// Gross!
const_cast<result*>(this)->update_lowlinks();
@ -282,7 +282,7 @@ namespace spot
}
virtual twa_run_ptr
accepting_run()
accepting_run() override
{
auto res = std::make_shared<twa_run>(automaton());
@ -335,7 +335,7 @@ namespace spot
}
virtual const state*
filter(const state* s)
filter(const state* s) override
{
// Do not escape the SCC
auto j = data.h.find(s);
@ -357,13 +357,13 @@ namespace spot
}
virtual bool
match(twa_run::step& step, const state*)
match(twa_run::step& step, const state*) override
{
return step.acc != 0U;
}
};
struct second_bfs: first_bfs
struct second_bfs final: first_bfs
{
const state* target;
second_bfs(result* r, int scc_root, const state* target)
@ -372,7 +372,7 @@ namespace spot
}
virtual bool
match(twa_run::step&, const state* s)
match(twa_run::step&, const state* s) override
{
return s == target;
}

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2012, 2013, 2014, 2015 Laboratoire de
// Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2009, 2010, 2012, 2013, 2014, 2015, 2016 Laboratoire
// de Recherche et Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -29,7 +29,7 @@ namespace spot
namespace
{
/// \brief Recursively translate a formula into a TAA.
class ltl2taa_visitor
class ltl2taa_visitor final
{
public:
ltl2taa_visitor(const taa_tgba_formula_ptr& res,
@ -40,7 +40,6 @@ namespace spot
{
}
virtual
~ltl2taa_visitor()
{
}

View file

@ -87,7 +87,7 @@ namespace spot
/// check() can be called several times (until it returns a null
/// pointer) to enumerate all the visited accepting paths. The method
/// visits only a finite set of accepting paths.
virtual emptiness_check_result_ptr check()
virtual emptiness_check_result_ptr check() override
{
auto t = std::static_pointer_cast<magic_search_>
(this->emptiness_check::shared_from_this());
@ -114,7 +114,7 @@ namespace spot
return nullptr;
}
virtual std::ostream& print_stats(std::ostream &os) const
virtual std::ostream& print_stats(std::ostream &os) const override
{
os << states() << " distinct nodes visited" << std::endl;
os << transitions() << " transitions explored" << std::endl;
@ -128,7 +128,7 @@ namespace spot
return os;
}
virtual bool safe() const
virtual bool safe() const override
{
return heap::Safe;
}
@ -319,7 +319,7 @@ namespace spot
return false;
}
class result_from_stack: public emptiness_check_result,
class result_from_stack final: public emptiness_check_result,
public acss_statistics
{
public:
@ -328,7 +328,7 @@ namespace spot
{
}
virtual twa_run_ptr accepting_run()
virtual twa_run_ptr accepting_run() override
{
assert(!ms_->st_blue.empty());
assert(!ms_->st_red.empty());
@ -366,7 +366,7 @@ namespace spot
return run;
}
unsigned acss_states() const
virtual unsigned acss_states() const override
{
return 0;
}
@ -376,7 +376,7 @@ namespace spot
# define FROM_STACK "ar:from_stack"
class magic_search_result: public emptiness_check_result
class magic_search_result final: public emptiness_check_result
{
public:
magic_search_result(const std::shared_ptr<magic_search_>& m,
@ -389,7 +389,7 @@ namespace spot
computer = new ndfs_result<magic_search_<heap>, heap>(ms);
}
virtual void options_updated(const option_map& old)
virtual void options_updated(const option_map& old) override
{
if (old[FROM_STACK] && !options()[FROM_STACK])
{
@ -408,12 +408,12 @@ namespace spot
delete computer;
}
virtual twa_run_ptr accepting_run()
virtual twa_run_ptr accepting_run() override
{
return computer->accepting_run();
}
virtual const unsigned_statistics* statistics() const
virtual const unsigned_statistics* statistics() const override
{
return computer->statistics();
}

View file

@ -174,7 +174,7 @@ namespace spot
return res;
}
struct wdba_search_acc_loop : public bfs_steps
struct wdba_search_acc_loop final : public bfs_steps
{
wdba_search_acc_loop(const const_twa_ptr& det_a,
unsigned scc_n, scc_info& sm,
@ -185,7 +185,7 @@ namespace spot
}
virtual const state*
filter(const state* s)
filter(const state* s) override
{
s = seen(s);
if (sm.scc_of(std::static_pointer_cast<const twa_graph>(a_)
@ -195,7 +195,7 @@ namespace spot
}
virtual bool
match(twa_run::step&, const state* to)
match(twa_run::step&, const state* to) override
{
return to == dest;
}

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013, 2014, 2015 Laboratoire de recherche et
// développement de l'Epita (LRDE).
// Copyright (C) 2011, 2013, 2014, 2015, 2016 Laboratoire de recherche
// et développement de l'Epita (LRDE).
// Copyright (C) 2004, 2005, 2006 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
@ -76,8 +76,8 @@ namespace spot
struct stats_interface<T, 1>
: public acss_statistics
{
unsigned
acss_states() const
virtual unsigned
acss_states() const override
{
// all visited states are in the state space search
return static_cast<const T*>(this)->h_.size();
@ -88,7 +88,7 @@ namespace spot
template <typename ndfs_search, typename heap>
class ndfs_result:
class ndfs_result final:
public emptiness_check_result,
// Conditionally inherit from acss_statistics or ars_statistics.
public stats_interface<ndfs_result<ndfs_search, heap>, heap::Has_Size>
@ -104,7 +104,7 @@ namespace spot
{
}
virtual twa_run_ptr accepting_run()
virtual twa_run_ptr accepting_run() override
{
const stack_type& stb = ms_->get_st_blue();
const stack_type& str = ms_->get_st_red();

View file

@ -102,8 +102,8 @@ namespace spot
public:
tgba_reachable_iterator_breadth_first(const const_twa_ptr& a);
virtual void add_state(const state* s);
virtual const state* next_state();
virtual void add_state(const state* s) override;
virtual const state* next_state() override;
protected:
std::deque<const state*> todo; ///< A queue of states yet to explore.
@ -189,8 +189,8 @@ namespace spot
/// the stack after process_link() has been called.
bool on_stack(int sn) const;
protected:
virtual void push(const state* s, int sn);
virtual void pop();
virtual void push(const state* s, int sn) override;
virtual void pop() override;
std::unordered_set<int> stack_;
};

View file

@ -47,7 +47,7 @@ namespace spot
/// \brief Emptiness checker on spot::tgba automata having at most one
/// acceptance condition (i.e. a TBA).
template <typename heap>
class se05_search : public emptiness_check, public ec_statistics
class se05_search final : public emptiness_check, public ec_statistics
{
public:
/// \brief Initialize the Magic Search algorithm on the automaton \a a
@ -87,7 +87,7 @@ namespace spot
/// check() can be called several times (until it returns a null
/// pointer) to enumerate all the visited accepting paths. The method
/// visits only a finite set of accepting paths.
virtual emptiness_check_result_ptr check()
virtual emptiness_check_result_ptr check() override
{
auto t = std::static_pointer_cast<se05_search>
(this->emptiness_check::shared_from_this());
@ -114,7 +114,7 @@ namespace spot
return nullptr;
}
virtual std::ostream& print_stats(std::ostream &os) const
virtual std::ostream& print_stats(std::ostream &os) const override
{
os << states() << " distinct nodes visited" << std::endl;
os << transitions() << " transitions explored" << std::endl;
@ -128,7 +128,7 @@ namespace spot
return os;
}
virtual bool safe() const
virtual bool safe() const override
{
return heap::Safe;
}
@ -334,7 +334,7 @@ namespace spot
{
}
virtual twa_run_ptr accepting_run()
virtual twa_run_ptr accepting_run() override
{
assert(!ms_->st_blue.empty());
assert(!ms_->st_red.empty());
@ -378,7 +378,7 @@ namespace spot
return run;
}
unsigned acss_states() const
virtual unsigned acss_states() const override
{
return 0;
}
@ -388,7 +388,7 @@ namespace spot
# define FROM_STACK "ar:from_stack"
class se05_result: public emptiness_check_result
class se05_result final: public emptiness_check_result
{
public:
se05_result(const std::shared_ptr<se05_search>& m,
@ -401,7 +401,7 @@ namespace spot
computer = new ndfs_result<se05_search<heap>, heap>(ms);
}
virtual void options_updated(const option_map& old)
virtual void options_updated(const option_map& old) override
{
if (old[FROM_STACK] && !options()[FROM_STACK])
{
@ -420,12 +420,12 @@ namespace spot
delete computer;
}
virtual twa_run_ptr accepting_run()
virtual twa_run_ptr accepting_run() override
{
return computer->accepting_run();
}
virtual const unsigned_statistics* statistics() const
virtual const unsigned_statistics* statistics() const override
{
return computer->statistics();
}

View file

@ -40,7 +40,7 @@ namespace spot
{
namespace
{
class state_tgbasl: public state
class state_tgbasl final: public state
{
public:
state_tgbasl(const state* s, bdd cond) : s_(s), cond_(cond)
@ -54,7 +54,7 @@ namespace spot
}
virtual int
compare(const state* other) const
compare(const state* other) const override
{
const state_tgbasl* o =
down_cast<const state_tgbasl*>(other);
@ -66,13 +66,13 @@ namespace spot
}
virtual size_t
hash() const
hash() const override
{
return wang32_hash(s_->hash()) ^ wang32_hash(cond_.id());
}
virtual
state_tgbasl* clone() const
state_tgbasl* clone() const override
{
return new state_tgbasl(*this);
}
@ -94,7 +94,7 @@ namespace spot
bdd cond_;
};
class twasl_succ_iterator : public twa_succ_iterator
class twasl_succ_iterator final : public twa_succ_iterator
{
public:
twasl_succ_iterator(twa_succ_iterator* it, const state_tgbasl* state,
@ -111,8 +111,8 @@ namespace spot
// iteration
bool
first()
virtual bool
first() override
{
loop_ = false;
done_ = false;
@ -125,8 +125,8 @@ namespace spot
return true;
}
bool
next()
virtual bool
next() override
{
if (cond_ != bddfalse)
{
@ -148,32 +148,32 @@ namespace spot
}
}
bool
done() const
virtual bool
done() const override
{
return it_->done() && done_;
}
// inspection
state_tgbasl*
dst() const
virtual state_tgbasl*
dst() const override
{
if (loop_)
return new state_tgbasl(state_->real_state(), state_->cond());
return new state_tgbasl(it_->dst(), one_);
}
bdd
cond() const
virtual bdd
cond() const override
{
if (loop_)
return state_->cond();
return one_;
}
acc_cond::mark_t
acc() const
virtual acc_cond::mark_t
acc() const override
{
if (loop_)
return 0U;

View file

@ -50,7 +50,7 @@ namespace spot
/// \brief Emptiness checker on spot::tgba automata having at most one
/// acceptance condition (i.e. a TBA).
template <typename heap>
class tau03_search : public emptiness_check, public ec_statistics
class tau03_search final : public emptiness_check, public ec_statistics
{
public:
/// \brief Initialize the search algorithm on the automaton \a a
@ -82,7 +82,7 @@ namespace spot
///
/// \return non null pointer iff the algorithm has found an
/// accepting path.
virtual emptiness_check_result_ptr check()
virtual emptiness_check_result_ptr check() override
{
if (!st_blue.empty())
return nullptr;
@ -98,7 +98,7 @@ namespace spot
return nullptr;
}
virtual std::ostream& print_stats(std::ostream &os) const
virtual std::ostream& print_stats(std::ostream &os) const override
{
os << states() << " distinct nodes visited" << std::endl;
os << transitions() << " transitions explored" << std::endl;