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

@ -33,7 +33,8 @@ namespace spot
public:
/// Create a pool allocating objects of \a size bytes.
fixed_size_pool(size_t size)
: freelist_(0), free_start_(0), free_end_(0), chunklist_(0)
: freelist_(nullptr), free_start_(nullptr),
free_end_(nullptr), chunklist_(nullptr)
{
const size_t alignement = 2 * sizeof(size_t);
size_ = ((size >= sizeof(block_) ? size : sizeof(block_))

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2011, 2014 Laboratoire de Recherche et
// Copyright (C) 2008, 2011, 2014, 2015 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
@ -49,7 +49,7 @@ namespace spot
size_t operator()(const T* p) const
{
return knuth32_hash(reinterpret_cast<const char*>(p)
- static_cast<const char*>(0));
- static_cast<const char*>(nullptr));
}
};

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement
// Copyright (C) 2011, 2013, 2015 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
@ -35,7 +35,7 @@ namespace spot
public:
/// Create a pool.
multiple_size_pool()
: free_start_(0), free_end_(0), chunklist_(0)
: free_start_(nullptr), free_end_(nullptr), chunklist_(nullptr)
{
}

View file

@ -38,7 +38,7 @@ namespace spot
++options;
// `!foo' is a shorthand for `foo=0'.
const char* negated = 0;
const char* negated = nullptr;
if (*options == '!')
{
// Skip spaces.
@ -124,7 +124,7 @@ namespace spot
}
}
}
return 0;
return nullptr;
}
int

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Développement
// Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et Développement
// de l'Epita.
//
// This file is part of Spot, a model checking library.
@ -123,7 +123,7 @@ namespace spot
}
satsolver::satsolver()
: cnf_tmp_(0), cnf_stream_(0)
: cnf_tmp_(nullptr), cnf_stream_(nullptr)
{
start();
}
@ -151,7 +151,7 @@ namespace spot
satsolver::get_solution()
{
delete cnf_stream_; // Close the file.
cnf_stream_ = 0;
cnf_stream_ = nullptr;
temporary_file* output = create_tmpfile("sat-", ".out");
solution_pair p;

View file

@ -122,7 +122,7 @@ namespace spot
int fd = create_temporary_file(prefix, suffix, &name);
if (close(fd))
throw std::runtime_error(std::string("failed to close ") + name);
temporary_file::cleanpos_t cp = to_clean.insert(to_clean.end(), 0);
auto cp = to_clean.insert(to_clean.end(), nullptr);
*cp = new temporary_file(name, cp);
return *cp;
}
@ -133,7 +133,7 @@ namespace spot
{
char* name;
int fd = create_temporary_file(prefix, suffix, &name);
open_temporary_file::cleanpos_t cp = to_clean.insert(to_clean.end(), 0);
auto cp = to_clean.insert(to_clean.end(), nullptr);
open_temporary_file* otf = new open_temporary_file(name, cp, fd);
*cp = otf;
return otf;

View file

@ -109,7 +109,7 @@ namespace spot
/// The temporary file is created and left empty. If you need
/// to fill it, consider using create_open_tmpfile() instead.
SPOT_API temporary_file*
create_tmpfile(const char* prefix, const char* suffix = 0)
create_tmpfile(const char* prefix, const char* suffix = nullptr)
throw(std::bad_alloc, std::runtime_error);
/// \brief Create a temporary file and leave it open for writing.
@ -117,7 +117,7 @@ namespace spot
/// Same as create_tmpfile, be leave the file open for writing. The
/// open_temporary_file::fd() method returns the file descriptor.
SPOT_API open_temporary_file*
create_open_tmpfile(const char* prefix, const char* suffix = 0)
create_open_tmpfile(const char* prefix, const char* suffix = nullptr)
throw(std::bad_alloc, std::runtime_error);
/// \brief Delete all temporary files.