Commit 5d272fd2 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

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.
parent 1ae0600c
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2012, 2013, 2014, 2015 Laboratoire de Recherche et // Copyright (C) 2012, 2013, 2014, 2015, 2016 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.
...@@ -165,7 +165,7 @@ namespace ...@@ -165,7 +165,7 @@ namespace
} }
virtual void virtual void
print(std::ostream& os, const char*) const print(std::ostream& os, const char*) const override
{ {
stream_escapable_formula(os, val_->f, val_->filename, val_->line); stream_escapable_formula(os, val_->f, val_->filename, val_->line);
} }
......
...@@ -54,8 +54,8 @@ namespace spot ...@@ -54,8 +54,8 @@ namespace spot
fair_kripke_succ_iterator(const bdd& cond, acc_cond::mark_t acc_cond); fair_kripke_succ_iterator(const bdd& cond, acc_cond::mark_t acc_cond);
virtual ~fair_kripke_succ_iterator(); virtual ~fair_kripke_succ_iterator();
virtual bdd cond() const; virtual bdd cond() const override;
virtual acc_cond::mark_t acc() const; virtual acc_cond::mark_t acc() const override;
protected: protected:
bdd cond_; bdd cond_;
acc_cond::mark_t acc_cond_; acc_cond::mark_t acc_cond_;
......
...@@ -59,8 +59,8 @@ namespace spot ...@@ -59,8 +59,8 @@ namespace spot
virtual ~kripke_succ_iterator(); virtual ~kripke_succ_iterator();
virtual bdd cond() const; virtual bdd cond() const override;
virtual acc_cond::mark_t acc() const; virtual acc_cond::mark_t acc() const override;
protected: protected:
bdd cond_; bdd cond_;
}; };
......
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012, 2013, 2014, 2015 Laboratoire de Recherche // Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016 Laboratoire de
// et Développement de l'Epita (LRDE) // 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.
// //
...@@ -39,7 +39,7 @@ namespace spot ...@@ -39,7 +39,7 @@ namespace spot
{ {
} }
virtual int compare(const spot::state* other) const virtual int compare(const spot::state* other) const override
{ {
auto o = down_cast<const kripke_graph_state*>(other); auto o = down_cast<const kripke_graph_state*>(other);
assert(o); assert(o);
...@@ -52,19 +52,19 @@ namespace spot ...@@ -52,19 +52,19 @@ namespace spot
return 0; return 0;
} }
virtual size_t hash() const virtual size_t hash() const override
{ {
return return
reinterpret_cast<const char*>(this) - static_cast<const char*>(nullptr); reinterpret_cast<const char*>(this) - static_cast<const char*>(nullptr);
} }
virtual kripke_graph_state* virtual kripke_graph_state*
clone() const clone() const override
{ {
return const_cast<kripke_graph_state*>(this); return const_cast<kripke_graph_state*>(this);
} }
virtual void destroy() const virtual void destroy() const override
{ {
} }
...@@ -104,30 +104,30 @@ namespace spot ...@@ -104,30 +104,30 @@ namespace spot
{ {
} }
virtual void recycle(const typename Graph::state_storage_t* s) void recycle(const typename Graph::state_storage_t* s)
{ {
cond_ = s->cond(); cond_ = s->cond();
t_ = s->succ; t_ = s->succ;
} }
virtual bool first() virtual bool first() override
{ {
p_ = t_; p_ = t_;
return p_; return p_;
} }
virtual bool next() virtual bool next() override
{ {
p_ = g_->edge_storage(p_).next_succ; p_ = g_->edge_storage(p_).next_succ;
return p_; return p_;
} }
virtual bool done() const virtual bool done() const override
{ {
return !p_; return !p_;
} }
virtual kripke_graph_state* dst() const virtual kripke_graph_state* dst() const override
{ {
assert(!done()); assert(!done());
return const_cast<kripke_graph_state*> return const_cast<kripke_graph_state*>
...@@ -138,7 +138,7 @@ namespace spot ...@@ -138,7 +138,7 @@ namespace spot
/// \class kripke_graph /// \class kripke_graph
/// \brief Kripke Structure. /// \brief Kripke Structure.
class SPOT_API kripke_graph : public kripke class SPOT_API kripke_graph final : public kripke
{ {
public: public:
typedef digraph<kripke_graph_state, void> graph_t; typedef digraph<kripke_graph_state, void> graph_t;
...@@ -180,7 +180,7 @@ namespace spot ...@@ -180,7 +180,7 @@ namespace spot
return init_number_; return init_number_;
} }
virtual const kripke_graph_state* get_init_state() const virtual const kripke_graph_state* get_init_state() const override
{ {
if (num_states() == 0) if (num_states() == 0)
const_cast<graph_t&>(g_).new_state(); const_cast<graph_t&>(g_).new_state();
...@@ -190,7 +190,7 @@ namespace spot ...@@ -190,7 +190,7 @@ namespace spot
/// \brief Allow to get an iterator on the state we passed in /// \brief Allow to get an iterator on the state we passed in
/// parameter. /// parameter.
virtual kripke_graph_succ_iterator<graph_t>* virtual kripke_graph_succ_iterator<graph_t>*
succ_iter(const spot::state* st) const succ_iter(const spot::state* st) const override
{ {
auto s = down_cast<const typename graph_t::state_storage_t*>(st); auto s = down_cast<const typename graph_t::state_storage_t*>(st);
assert(s); assert(s);
...@@ -235,13 +235,13 @@ namespace spot ...@@ -235,13 +235,13 @@ namespace spot
return ss.str(); return ss.str();
} }
virtual std::string format_state(const state* st) const virtual std::string format_state(const state* st) const override
{ {
return format_state(state_number(st)); return format_state(state_number(st));
} }
/// \brief Get the condition on the state /// \brief Get the condition on the state
virtual bdd state_condition(const state* s) const virtual bdd state_condition(const state* s) const override
{ {
return down_cast<const kripke_graph_state*>(s)->cond(); return down_cast<const kripke_graph_state*>(s)->cond();
} }
......
...@@ -258,7 +258,7 @@ namespace spot ...@@ -258,7 +258,7 @@ namespace spot
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// SUCC_ITERATOR // SUCC_ITERATOR
class spins_succ_iterator: public kripke_succ_iterator class spins_succ_iterator final: public kripke_succ_iterator
{ {
public: public:
...@@ -280,28 +280,24 @@ namespace spot ...@@ -280,28 +280,24 @@ namespace spot
delete cc_; delete cc_;
} }
virtual virtual bool first() override
bool first()
{ {
it_ = cc_->transitions.begin(); it_ = cc_->transitions.begin();
return it_ != cc_->transitions.end(); return it_ != cc_->transitions.end();
} }
virtual virtual bool next() override
bool next()
{ {
++it_; ++it_;
return it_ != cc_->transitions.end(); return it_ != cc_->transitions.end();
} }
virtual virtual bool done() const override
bool done() const
{ {
return it_ == cc_->transitions.end(); return it_ == cc_->transitions.end();
} }
virtual virtual state* dst() const override
state* dst() const
{ {
return (*it_)->clone(); return (*it_)->clone();
} }
...@@ -605,7 +601,7 @@ namespace spot ...@@ -605,7 +601,7 @@ namespace spot
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// KRIPKE // KRIPKE
class spins_kripke: public kripke class spins_kripke final: public kripke
{ {
public: public:
...@@ -615,7 +611,7 @@ namespace spot ...@@ -615,7 +611,7 @@ namespace spot
: kripke(dict), : kripke(dict),
d_(d), d_(d),
state_size_(d_->get_state_size()), state_size_(d_->get_state_size()),
dict_(dict), ps_(ps), ps_(ps),
compress_(compress == 0 ? nullptr compress_(compress == 0 ? nullptr
: compress == 1 ? int_array_array_compress : compress == 1 ? int_array_array_compress
: int_array_array_compress2), : int_array_array_compress2),
...@@ -696,8 +692,7 @@ namespace spot ...@@ -696,8 +692,7 @@ namespace spot
delete state_condition_last_cc_; // Might be 0 already. delete state_condition_last_cc_; // Might be 0 already.
} }
virtual virtual state* get_init_state() const override
state* get_init_state() const
{ {
if (compress_) if (compress_)
{ {
...@@ -848,8 +843,7 @@ namespace spot ...@@ -848,8 +843,7 @@ namespace spot
virtual virtual
spins_succ_iterator* spins_succ_iterator* succ_iter(const state* st) const override
succ_iter(const state* st) const
{ {
// This may also compute successors in state_condition_last_cc // This may also compute successors in state_condition_last_cc
bdd scond = compute_state_condition(st); bdd scond = compute_state_condition(st);
...@@ -882,14 +876,13 @@ namespace spot ...@@ -882,14 +876,13 @@ namespace spot
} }
virtual virtual
bdd bdd state_condition(const state* st) const override
state_condition(const state* st) const
{ {
return compute_state_condition(st); return compute_state_condition(st);
} }
virtual virtual
std::string format_state(const state *st) const std::string format_state(const state *st) const override
{ {
const int* vars = get_vars(st); const int* vars = get_vars(st);
...@@ -917,16 +910,9 @@ namespace spot ...@@ -917,16 +910,9 @@ namespace spot
return res.str(); return res.str();
} }
virtual
spot::bdd_dict_ptr get_dict() const
{
return dict_;
}
private: private:
spins_interface_ptr d_; spins_interface_ptr d_;
int state_size_; int state_size_;
bdd_dict_ptr dict_;
const char** vname_; const char** vname_;
bool* format_filter_; bool* format_filter_;
const spot::prop_set* ps_; const spot::prop_set* ps_;
......
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2012, 2013 Laboratoire de Recherche et Développement // Copyright (C) 2012, 2013, 2016 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.
// //
...@@ -72,7 +72,7 @@ namespace spot ...@@ -72,7 +72,7 @@ namespace spot
} }
virtual void virtual void
print(std::ostream& os, const char*) const print(std::ostream& os, const char*) const override
{ {
os << val_; os << val_;
} }
...@@ -83,7 +83,7 @@ namespace spot ...@@ -83,7 +83,7 @@ namespace spot
{ {
public: public:
virtual void virtual void
print(std::ostream& os, const char* x) const print(std::ostream& os, const char* x) const override
{ {
os << '%' << *x; os << '%' << *x;
} }
...@@ -94,7 +94,7 @@ namespace spot ...@@ -94,7 +94,7 @@ namespace spot
{ {
public: public:
virtual void virtual void
print(std::ostream& os, const char*) const print(std::ostream& os, const char*) const override
{ {
os << '%'; os << '%';
} }
......
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Développement // Copyright (C) 2013, 2016 Laboratoire de Recherche et Développement
// de l'Epita (LRDE). // 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
...@@ -49,6 +49,6 @@ namespace spot ...@@ -49,6 +49,6 @@ namespace spot
private: private:
/// Require more variables. /// Require more variables.
void extvarnum(int more); void extvarnum(int more);
virtual int extend(int n); virtual int extend(int n) override;
}; };
} }
...@@ -201,20 +201,10 @@ namespace spot ...@@ -201,20 +201,10 @@ namespace spot
~ta_succ_iterator() ~ta_succ_iterator()
{ {
} }
virtual bool first() = 0;
virtual bool next() = 0;
virtual bool done() const = 0;
virtual const state* dst() const = 0;
/// \brief Get the changeset on the transition leading to current successor. /// \brief Get the changeset on the transition leading to current successor.
/// ///
/// This is a boolean function of atomic propositions. /// This is a boolean function of atomic propositions.
virtual bdd cond() const = 0; virtual bdd cond() const = 0;
acc_cond::mark_t acc() const = 0;
}; };
#ifndef SWIG #ifndef SWIG
......
<
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015 Laboratoire de // Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016 Laboratoire
// Recherche et Développement de l'Epita (LRDE). // 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.
// //
...@@ -64,38 +64,35 @@ namespace spot ...@@ -64,38 +64,35 @@ namespace spot
// ta interface // ta interface
virtual virtual
~ta_explicit(); ~ta_explicit();
virtual const_states_set_t virtual const_states_set_t get_initial_states_set() const override;
get_initial_states_set() const;
virtual ta_succ_iterator* virtual ta_succ_iterator* succ_iter(const spot::state* s) const override;
succ_iter(const spot::state* s) const;
virtual ta_succ_iterator* virtual ta_succ_iterator*
succ_iter(const spot::state* s, bdd condition) const; succ_iter(const spot::state* s, bdd condition) const override;
virtual bdd_dict_ptr bdd_dict_ptr get_dict() const;
get_dict() const;
virtual std::string virtual std::string
format_state(const spot::state* s) const; format_state(const spot::state* s) const override;
virtual bool virtual bool
is_accepting_state(const spot::state* s) const; is_accepting_state(const spot::state* s) const override;
virtual bool virtual bool
is_livelock_accepting_state(const spot::state* s) const; is_livelock_accepting_state(const spot::state* s) const override;
virtual bool virtual bool
is_initial_state(const spot::state* s) const; is_initial_state(const spot::state* s) const override;
virtual bdd virtual bdd
get_state_condition(const spot::state* s) const; get_state_condition(const spot::state* s) const override;
virtual void virtual void
free_state(const spot::state* s) const; free_state(const spot::state* s) const override;
spot::state* virtual spot::state*
get_artificial_initial_state() const get_artificial_initial_state() const override
{ {
return (spot::state*) artificial_initial_state_; return (spot::state*) artificial_initial_state_;
} }
...@@ -107,7 +104,7 @@ namespace spot ...@@ -107,7 +104,7 @@ namespace spot
} }
virtual void void
delete_stuttering_and_hole_successors(const spot::state* s); delete_stuttering_and_hole_successors(const spot::state* s);
ta::states_set_t ta::states_set_t
...@@ -129,7 +126,7 @@ namespace spot ...@@ -129,7 +126,7 @@ namespace spot
/// states used by spot::ta_explicit. /// states used by spot::ta_explicit.
/// \ingroup ta_representation /// \ingroup ta_representation
class SPOT_API state_ta_explicit : public spot::state class SPOT_API state_ta_explicit final: public spot::state
{ {
#ifndef SWIG #ifndef SWIG
public: public:
...@@ -156,15 +153,11 @@ namespace spot ...@@ -156,15 +153,11 @@ namespace spot
{ {
} }
virtual int virtual int compare(const spot::state* other) const override;
compare(const spot::state* other) const; virtual size_t hash() const override;
virtual size_t virtual state_ta_explicit* clone() const override;
hash() const;
virtual state_ta_explicit*
clone() const;
virtual void virtual void destroy() const override
destroy() const
{ {
} }
...@@ -227,21 +220,21 @@ namespace spot ...@@ -227,21 +220,21 @@ namespace spot