nullptr cleanup for -Wzero-as-null-pointer-constant

Fixes #106.

* m4/gccwarn.m4: Use -Wzero-as-null-pointer-constant if supported.
* src/bin/autfilt.cc, src/bin/common_aoutput.cc,
src/bin/common_finput.cc, src/bin/common_finput.hh,
src/bin/common_output.cc, src/bin/common_output.hh,
src/bin/common_post.cc, src/bin/common_r.hh, src/bin/common_range.hh,
src/bin/common_setup.cc, src/bin/common_trans.cc, src/bin/dstar2tgba.cc,
src/bin/genltl.cc, src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc,
src/bin/ltlcross.cc, src/bin/ltldo.cc, src/bin/ltlfilt.cc,
src/bin/ltlgrind.cc, src/bin/randaut.cc, src/bin/randltl.cc,
src/bin/spot-x.cc, src/kripke/kripkeexplicit.cc, src/ltlast/formula.cc,
src/ltlvisit/randomltl.cc, src/ltlvisit/randomltl.hh,
src/ltlvisit/relabel.cc, src/ltlvisit/relabel.hh,
src/ltlvisit/simplify.cc, src/ltlvisit/snf.hh, src/misc/fixpool.hh,
src/misc/mspool.hh, src/misc/hash.hh, src/misc/optionmap.cc,
src/misc/satsolver.cc, src/misc/tmpfile.cc, src/misc/tmpfile.hh,
src/priv/bddalloc.cc, src/ta/ta.hh, src/ta/taexplicit.cc,
src/ta/taexplicit.hh, src/ta/taproduct.cc, src/ta/tgtaexplicit.hh,
src/ta/tgtaproduct.cc, src/taalgos/minimize.cc,
src/taalgos/reachiter.cc, src/taalgos/tgba2ta.cc,
src/tests/complementation.cc, src/tests/ikwiad.cc,
src/tests/randtgba.cc, src/tests/reduc.cc, src/twa/bdddict.cc,
src/twa/bddprint.cc, src/twa/taatgba.cc, src/twa/twa.cc,
src/twa/twagraph.hh, src/twa/twaproduct.cc,
src/twa/twasafracomplement.cc, src/twaalgos/bfssteps.cc,
src/twaalgos/compsusp.cc, src/twaalgos/dtgbasat.cc,
src/twaalgos/emptiness.cc, src/twaalgos/gtec/ce.cc,
src/twaalgos/gv04.cc, src/twaalgos/ltl2taa.cc,
src/twaalgos/ltl2tgba_fm.cc, src/twaalgos/ltl2tgba_fm.hh,
src/twaalgos/magic.cc, src/twaalgos/minimize.cc,
src/twaalgos/ndfs_result.hxx, src/twaalgos/postproc.cc,
src/twaalgos/postproc.hh, src/twaalgos/reachiter.cc,
src/twaalgos/reducerun.cc, src/twaalgos/safety.hh,
src/twaalgos/sccfilter.hh, src/twaalgos/se05.cc,
src/twaalgos/simulation.cc, src/twaalgos/tau03.cc,
src/twaalgos/tau03opt.cc, src/twaalgos/translate.cc,
src/twaalgos/translate.hh, utf8/utf8/core.h,
bench/stutter/stutter_invariance_formulas.cc, iface/ltsmin/ltsmin.cc,
iface/ltsmin/modelcheck.cc: Use nullptr to fix the warning.
This commit is contained in:
Alexandre Duret-Lutz 2015-09-26 22:14:27 +02:00
parent 51a3cfcede
commit 1729a79ac7
87 changed files with 755 additions and 717 deletions

View file

@ -102,7 +102,7 @@ namespace spot
}
}
}
return 0;
return nullptr;
}
}

View file

@ -177,7 +177,7 @@ namespace spot
pair_map seen;
pair_queue todo;
state_pair p(left->get_init_state(), 0);
state_pair p(left->get_init_state(), nullptr);
state* ris = right->get_init_state();
p.second = ris;
unsigned i = res->new_state();
@ -198,7 +198,7 @@ namespace spot
state_pair d(li->current_state(), ris);
bdd lc = li->current_condition();
twa_succ_iterator* ri = 0;
twa_succ_iterator* ri = nullptr;
// Should we reset the right automaton?
if ((lc & v) == lc)
{
@ -278,12 +278,14 @@ namespace spot
// Translate the patched formula, and remove useless SCCs.
twa_graph_ptr res =
scc_filter(ltl_to_tgba_fm(g, dict, true, true, false, false, 0, 0),
scc_filter(ltl_to_tgba_fm(g, dict, true, true, false, false,
nullptr, nullptr),
false);
if (!no_wdba)
{
twa_graph_ptr min = minimize_obligation(res, g, 0, wdba_smaller);
twa_graph_ptr min = minimize_obligation(res, g,
nullptr, wdba_smaller);
if (min != res)
{
res = min;

View file

@ -62,9 +62,9 @@ namespace spot
{
namespace
{
static bdd_dict_ptr debug_dict = 0;
static const acc_cond* debug_ref_acc = 0;
static const acc_cond* debug_cand_acc = 0;
static bdd_dict_ptr debug_dict = nullptr;
static const acc_cond* debug_ref_acc = nullptr;
static const acc_cond* debug_cand_acc = nullptr;
struct transition
{

View file

@ -39,10 +39,10 @@ namespace spot
tgba_run::~tgba_run()
{
for (steps::const_iterator i = prefix.begin(); i != prefix.end(); ++i)
i->s->destroy();
for (steps::const_iterator i = cycle.begin(); i != cycle.end(); ++i)
i->s->destroy();
for (auto i : prefix)
i.s->destroy();
for (auto i : cycle)
i.s->destroy();
}
tgba_run::tgba_run(const tgba_run& run)
@ -246,7 +246,7 @@ namespace spot
if (!opt_end)
{
*err = opt_start;
return 0;
return nullptr;
}
std::string opt(opt_start, opt_end);
@ -254,7 +254,7 @@ namespace spot
if (res)
{
*err = opt.c_str() - res + opt_start;
return 0;
return nullptr;
}
}
@ -271,7 +271,7 @@ namespace spot
for (unsigned i = 0; i < sizeof(ec_algos)/sizeof(*ec_algos); ++i, ++info)
if (n == info->name)
{
*err = 0;
*err = nullptr;
struct emptiness_check_instantiator_aux:
public emptiness_check_instantiator

View file

@ -192,10 +192,10 @@ namespace spot
s->destroy();
// Ignore unknown states.
if (i == ecs->h.end())
return 0;
return nullptr;
// Stay in the final SCC.
if (i->second < scc_root)
return 0;
return nullptr;
r->inc_ars_cycle_states();
return i->first;
}

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2010, 2011, 2013, 2014 Laboratoire de recherche
// et développement de l'Epita (LRDE).
// Copyright (C) 2008, 2010, 2011, 2013, 2014, 2015 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.
@ -160,7 +160,7 @@ namespace spot
}
if (violation)
return std::make_shared<result>(*this);
return 0;
return nullptr;
}
void
@ -171,7 +171,7 @@ namespace spot
h[s] = ++top;
stack_entry ss = { s, 0, top, dftop, 0 };
stack_entry ss = { s, nullptr, top, dftop, 0 };
if (accepting)
ss.acc = top - 1; // This differs from GV04 to support TBA.
@ -352,7 +352,7 @@ namespace spot
|| data.stack[j->second].lowlink < scc_root)
{
s->destroy();
return 0;
return nullptr;
}
r->inc_ars_cycle_states();
s->destroy();

View file

@ -148,7 +148,7 @@ namespace spot
std::vector<succ_state>::iterator i1;
std::vector<succ_state>::iterator i2;
taa_tgba::transition* t = 0;
taa_tgba::transition* t = nullptr;
bool contained = false;
bool strong = false;
@ -250,7 +250,7 @@ namespace spot
}
std::vector<succ_state>::iterator i;
taa_tgba::transition* t = 0;
taa_tgba::transition* t = nullptr;
switch (f.kind())
{
case op::And:

View file

@ -1700,7 +1700,7 @@ namespace spot
// In case the formula contains SERE operators, we need to decide
// if we have to mark unmarked operators, and more
const translate_dict::translated&
translate(formula f, bool* new_flag = 0)
translate(formula f, bool* new_flag = nullptr)
{
// Use the cached result if available.
formula_to_bdd_map::const_iterator i = f2b_.find(f);

View file

@ -144,7 +144,7 @@ namespace spot
bool exprop = false, bool symb_merge = true,
bool branching_postponement = false,
bool fair_loop_approx = false,
const ltl::atomic_prop_set* unobs = 0,
ltl::ltl_simplifier* simplifier = 0,
const ltl::atomic_prop_set* unobs = nullptr,
ltl::ltl_simplifier* simplifier = nullptr,
bool unambiguous = false);
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013, 2014 Laboratoire de recherche et
// Copyright (C) 2011, 2013, 2014, 2015 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
@ -433,21 +433,21 @@ namespace spot
{
public:
color_ref(color* c) :p(c)
{
}
{
}
color get_color() const
{
return *p;
}
{
return *p;
}
void set_color(color c)
{
assert(!is_white());
*p=c;
}
{
assert(!is_white());
*p=c;
}
bool is_white() const
{
return p == 0;
}
{
return !p;
}
private:
color *p;
};
@ -472,7 +472,7 @@ namespace spot
{
hash_type::iterator it = h.find(s);
if (it == h.end())
return color_ref(0);
return color_ref(nullptr);
if (s != it->first)
{
s->destroy();

View file

@ -194,7 +194,7 @@ namespace spot
s = seen(s);
if (sm.scc_of(std::static_pointer_cast<const twa_graph>(a_)
->state_number(s)) != scc_n)
return 0;
return nullptr;
return s;
}

View file

@ -1,9 +1,9 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013, 2014 Laboratoire de recherche et
// Copyright (C) 2011, 2013, 2014, 2015 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.
// 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.
//
// This file is part of Spot, a model checking library.
//
@ -395,7 +395,7 @@ namespace spot
if (s)
return this->bfs_steps::search(s, l);
else
return 0;
return nullptr;
}
const state* filter(const state* s)
@ -405,7 +405,7 @@ namespace spot
|| dead.find(s) != dead.end())
{
s->destroy();
return 0;
return nullptr;
}
ars->inc_ars_cycle_states();
seen.insert(s);
@ -490,7 +490,7 @@ namespace spot
if (s)
return this->bfs_steps::search(s, l);
else
return 0;
return nullptr;
}
const state* filter(const state* s)
@ -503,7 +503,7 @@ namespace spot
else
ndfsr_trace << " already seen" << std::endl;
s->destroy();
return 0;
return nullptr;
}
ndfsr_trace << " OK" << std::endl;
if (cycle)
@ -605,7 +605,8 @@ namespace spot
<< a_->format_state(current.dest) << " to "
<< a_->format_state(begin) << std::endl;
transition tmp;
tmp.source = tmp.dest = 0; // Initialize to please GCC 4.0.1 (Darwin).
// Initialize to please GCC 4.0.1 (Darwin).
tmp.source = tmp.dest = nullptr;
tmp.acc = 0U;
target.emplace(begin, tmp);
min_path<true> s(this, a_, target, h_);
@ -620,7 +621,7 @@ namespace spot
{
m_source_trans target;
transition tmp;
tmp.source = tmp.dest = 0; // Initialize to please GCC 4.0.
tmp.source = tmp.dest = nullptr; // Initialize to please GCC 4.0.
tmp.acc = 0U;
// Register all states from the cycle as target of the BFS.

View file

@ -224,15 +224,15 @@ namespace spot
bool dba_is_wdba = false;
bool dba_is_minimal = false;
twa_graph_ptr dba = 0;
twa_graph_ptr sim = 0;
twa_graph_ptr dba = nullptr;
twa_graph_ptr sim = nullptr;
// (Small,Low) is the only configuration where we do not run
// WDBA-minimization.
if ((PREF_ != Small || level_ != Low) && wdba_minimize_)
{
bool reject_bigger = (PREF_ == Small) && (level_ == Medium);
dba = minimize_obligation(a, f, 0, reject_bigger);
dba = minimize_obligation(a, f, nullptr, reject_bigger);
if (dba && dba->is_inherently_weak() && dba->is_deterministic())
{
// The WDBA is a BA, so no degeneralization is required.
@ -362,7 +362,7 @@ namespace spot
// is at least 1.
target_acc = original_acc > 0 ? original_acc : 1;
const_twa_graph_ptr in = 0;
const_twa_graph_ptr in = nullptr;
if (target_acc == 1)
{
// If we are seeking a minimal DBA with unknown number of

View file

@ -62,7 +62,7 @@ namespace spot
///
/// The \a opt argument can be used to pass extra fine-tuning
/// options used for debugging or benchmarking.
postprocessor(const option_map* opt = 0);
postprocessor(const option_map* opt = nullptr);
enum output_type { TGBA, BA, Monitor, Generic };
void

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2011, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2009, 2011, 2013, 2014, 2015 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
@ -137,7 +137,7 @@ namespace spot
tgba_reachable_iterator_breadth_first::next_state()
{
if (todo.empty())
return 0;
return nullptr;
const state* s = todo.front();
todo.pop_front();
return s;

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
// Copyright (C) 2011, 2013, 2014, 2015 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -34,7 +34,7 @@ namespace spot
{
public:
shortest_path(const const_twa_ptr& a)
: bfs_steps(a), target(0)
: bfs_steps(a), target(nullptr)
{
}

View file

@ -46,7 +46,7 @@ namespace spot
/// will be built otherwise).
SPOT_API bool
is_guarantee_automaton(const const_twa_graph_ptr& aut,
scc_info* sm = 0);
scc_info* sm = nullptr);
/// \brief Whether a minimized WDBA represents a safety property.
///

View file

@ -59,7 +59,7 @@ namespace spot
/// instead.
SPOT_API twa_graph_ptr
scc_filter(const const_twa_graph_ptr& aut, bool remove_all_useless = false,
scc_info* given_si = 0);
scc_info* given_si = nullptr);
/// \brief Prune unaccepting SCCs.
///
@ -70,7 +70,8 @@ namespace spot
/// transitions leaving accepting states are all marked as
/// accepting), then the output TGBA will also have that property.
SPOT_API twa_graph_ptr
scc_filter_states(const const_twa_graph_ptr& aut, scc_info* given_si = 0);
scc_filter_states(const const_twa_graph_ptr& aut,
scc_info* given_si = nullptr);
/// \brief Prune unaccepting SCCs, superfluous acceptance
/// sets, and suspension variables.
@ -85,5 +86,5 @@ namespace spot
SPOT_API twa_graph_ptr
scc_filter_susp(const const_twa_graph_ptr& aut, bool remove_all_useless,
bdd suspvars, bdd ignoredvars, bool early_susp,
scc_info* given_si = 0);
scc_info* given_si = nullptr);
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
// Copyright (C) 2011, 2013, 2014, 2015 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
@ -111,7 +111,7 @@ namespace spot
if (dfs_blue())
return std::make_shared<se05_result>(t, options());
}
return 0;
return nullptr;
}
virtual std::ostream& print_stats(std::ostream &os) const
@ -449,11 +449,11 @@ namespace spot
{
public:
color_ref(hash_type* h, hcyan_type* hc, const state* s)
: is_cyan(true), ph(h), phc(hc), ps(s), pc(0)
: is_cyan(true), ph(h), phc(hc), ps(s), pc(nullptr)
{
}
color_ref(color* c)
: is_cyan(false), ph(0), phc(0), ps(0), pc(c)
: is_cyan(false), ph(nullptr), phc(nullptr), ps(nullptr), pc(c)
{
}
color get_color() const
@ -480,7 +480,7 @@ namespace spot
}
bool is_white() const
{
return !is_cyan && pc == 0;
return !is_cyan && !pc;
}
private:
bool is_cyan;
@ -519,7 +519,7 @@ namespace spot
{
hash_type::iterator it = h.find(s);
if (it == h.end())
return color_ref(0); // white state
return color_ref(nullptr); // white state
if (s != it->first)
{
s->destroy();
@ -588,7 +588,7 @@ namespace spot
{
}
color_ref(unsigned char *base, unsigned char offset)
: is_cyan(false), phc(0), ps(0), b(base), o(offset*2)
: is_cyan(false), phc(nullptr), ps(nullptr), b(base), o(offset*2)
{
}
color get_color() const

View file

@ -761,7 +761,7 @@ namespace spot
twa_graph_ptr
iterated_simulations_(const const_twa_graph_ptr& t)
{
twa_graph_ptr res = 0;
twa_graph_ptr res = nullptr;
automaton_size prev;
automaton_size next;

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
// Copyright (C) 2011, 2013, 2014, 2015 Laboratoire de Recherche et
// Developpement 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
@ -306,7 +306,7 @@ namespace spot
}
bool is_white() const
{
return p == 0;
return !p;
}
private:
color *p;
@ -333,7 +333,7 @@ namespace spot
{
hash_type::iterator it = h.find(s);
if (it == h.end())
return color_ref(0, 0);
return color_ref(nullptr, nullptr);
if (s != it->first)
{
s->destroy();

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
// Copyright (C) 2011, 2013, 2014, 2015 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
@ -458,7 +458,7 @@ namespace spot
}
bool is_white() const
{
return !is_cyan && pc == 0;
return !is_cyan && !pc;
}
private:
bool is_cyan;
@ -501,7 +501,7 @@ namespace spot
hash_type::iterator it = h.find(s);
if (it == h.end())
// white state
return color_ref(0, 0);
return color_ref(nullptr, nullptr);
if (s != it->first)
{
s->destroy();

View file

@ -95,7 +95,8 @@ namespace spot
{
bool exprop = unambiguous || level_ == postprocessor::High;
aut = ltl_to_tgba_fm(r, simpl_->get_dict(), exprop,
true, false, false, 0, 0, unambiguous);
true, false, false, nullptr, nullptr,
unambiguous);
}
aut = this->postprocessor::run(aut, r);
return aut;

View file

@ -47,21 +47,21 @@ namespace spot
class SPOT_API translator: protected postprocessor
{
public:
translator(ltl::ltl_simplifier* simpl, const option_map* opt = 0)
: postprocessor(opt), simpl_(simpl), simpl_owned_(0)
translator(ltl::ltl_simplifier* simpl, const option_map* opt = nullptr)
: postprocessor(opt), simpl_(simpl), simpl_owned_(nullptr)
{
assert(simpl);
setup_opt(opt);
}
translator(const bdd_dict_ptr& dict, const option_map* opt = 0)
translator(const bdd_dict_ptr& dict, const option_map* opt = nullptr)
: postprocessor(opt)
{
build_simplifier(dict);
setup_opt(opt);
}
translator(const option_map* opt = 0)
translator(const option_map* opt = nullptr)
: postprocessor(opt)
{
build_simplifier(make_bdd_dict());