Enable -Wmissing-declarations in development mode.

* m4/gccwarn.m4: Add -Wmissing-declarations.
* iface/ltsmin/ltsmin.cc, iface/ltsmin/modelcheck.cc,
src/bin/common_trans.cc, src/bin/genltl.cc, src/bin/ltlgrind.cc,
src/tests/acc.cc, src/tests/bitvect.cc, src/tests/checkpsl.cc,
src/tests/checkta.cc, src/tests/complementation.cc,
src/tests/consterm.cc, src/tests/emptchk.cc, src/tests/equalsf.cc,
src/tests/graph.cc, src/tests/ikwiad.cc, src/tests/intvcmp2.cc,
src/tests/intvcomp.cc, src/tests/kind.cc, src/tests/length.cc,
src/tests/ltlprod.cc, src/tests/ltlrel.cc, src/tests/ngraph.cc,
src/tests/randtgba.cc, src/tests/readltl.cc, src/tests/reduc.cc,
src/tests/syntimpl.cc, src/tests/tostring.cc, src/tests/twagraph.cc,
src/tl/contain.cc, src/twaalgos/dtgbacomp.cc, src/twaalgos/minimize.cc:
Add "static" and move in anonymous namespace when appropriate.
This commit is contained in:
Alexandre Duret-Lutz 2015-10-02 11:00:00 +02:00
parent 162d8d297d
commit 20365e53f0
32 changed files with 553 additions and 563 deletions

View file

@ -943,16 +943,14 @@ namespace spot
mutable callback_context* state_condition_last_cc_;
};
}
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// LOADER
// Call spins to compile "foo.prom" as "foo.prom.spins" if the latter
// does not exist already or is older.
bool
static bool
compile_model(std::string& filename, std::string& ext, bool verbose)
{
std::string command;
@ -972,8 +970,8 @@ namespace spot
{
if (verbose)
std::cerr << "Unknown extension `" << ext
<< "'. Use `.prom', `.pm', `.pml', `.dve', `.dve2C' or"\
"`.prom.spins'." << std::endl;
<< ("'. Use `.prom', `.pm', `.pml', `.dve', `.dve2C' or"
"`.prom.spins'.") << std::endl;
return false;
}
@ -1014,6 +1012,8 @@ namespace spot
return false;
}
}
kripke_ptr
load_ltsmin(const std::string& file_arg, const bdd_dict_ptr& dict,
const atomic_prop_set* to_observe,

View file

@ -60,7 +60,7 @@ Options:\n\
exit(1);
}
int
static int
checked_main(int argc, char **argv)
{
spot::timer_map tm;

View file

@ -32,7 +32,8 @@ EOF
Wpointer-arith \
Wwrite-strings \
Wcast-qual \
Wdocumentation
Wdocumentation \
Wmissing-declarations
do
CXXFLAGS="$cf_save_CXXFLAGS $ac_cv_prog_gxx_warn_flags -$cf_opt"
if AC_TRY_EVAL(ac_compile); then

View file

@ -48,7 +48,7 @@ static struct shorthands_t
{ "spin", " -f %s>%O" },
};
void show_shorthands()
static void show_shorthands()
{
std::cout
<< ("If a COMMANDFMT does not use any %-sequence, and starts with one of\n"

View file

@ -321,7 +321,8 @@ phi_n(std::string name, int n)
return result;
}
formula N_n(std::string name, int n)
static formula
N_n(std::string name, int n)
{
return formula::F(phi_n(name, n));
}

View file

@ -108,7 +108,7 @@ namespace
};
}
int
static int
parse_opt(int key, char* arg, struct argp_state*)
{
switch (key)

View file

@ -24,7 +24,7 @@
#include <cstdlib>
#include "twa/acc.hh"
void check(spot::acc_cond& ac, spot::acc_cond::mark_t m)
static void check(spot::acc_cond& ac, spot::acc_cond::mark_t m)
{
std::cout << '#' << m.count() << ": " << ac.format(m);
if (!m)
@ -34,7 +34,7 @@ void check(spot::acc_cond& ac, spot::acc_cond::mark_t m)
std::cout << '\n';
}
void print(const std::vector<std::vector<int>>& res)
static void print(const std::vector<std::vector<int>>& res)
{
for (auto& v: res)
{

View file

@ -20,7 +20,7 @@
#include <iostream>
#include "misc/bitvect.hh"
void ruler()
static void ruler()
{
std::cout << "\n ";
for (size_t x = 0; x < 76; ++x)

View file

@ -29,7 +29,7 @@
#include "twaalgos/product.hh"
#include "twaalgos/dot.hh"
void
static void
syntax(char* prog)
{
std::cerr << prog << " file" << std::endl;

View file

@ -33,14 +33,15 @@
#include "taalgos/dot.hh"
#include "taalgos/stats.hh"
void
static void
syntax(char* prog)
{
std::cerr << prog << " file" << std::endl;
exit(2);
}
void stats(std::string title, const spot::ta_ptr& ta)
static void
stats(std::string title, const spot::ta_ptr& ta)
{
auto s = stats_reachable(ta);
@ -50,7 +51,8 @@ void stats(std::string title, const spot::ta_ptr& ta)
<< std::setw(6) << s.acceptance_states << '\n';
}
void stats(std::string title, const spot::twa_ptr& tg)
static void
stats(std::string title, const spot::twa_ptr& tg)
{
auto s = stats_reachable(tg);

View file

@ -34,7 +34,7 @@
#include "twa/twasafracomplement.hh"
void usage(const char* prog)
static void usage(const char* prog)
{
std::cout << "usage: " << prog << " [options]" << std::endl;
std::cout << "with options" << std::endl

View file

@ -24,7 +24,7 @@
#include <cstdlib>
#include "tl/parse.hh"
void
static void
syntax(char *prog)
{
std::cerr << prog << " formula" << std::endl;

View file

@ -32,7 +32,7 @@
#include "twaalgos/dot.hh"
#include "twaalgos/emptiness.hh"
void
static void
syntax(char* prog)
{
std::cerr << prog << " file" << std::endl;

View file

@ -32,7 +32,7 @@
#include "tl/simplify.hh"
#include "tl/print.hh"
void
static void
syntax(char* prog)
{
std::cerr << prog << " [-E] file" << std::endl;

View file

@ -70,7 +70,8 @@ dot(std::ostream& out, spot::digraph<SL, TL>& g)
}
bool g1(const spot::digraph<void, void>& g,
static bool
g1(const spot::digraph<void, void>& g,
unsigned s, int e)
{
int f = 0;
@ -82,7 +83,8 @@ bool g1(const spot::digraph<void, void>& g,
return f == e;
}
bool f1()
static bool
f1()
{
spot::digraph<void, void> g(3);
@ -111,7 +113,8 @@ bool f1()
}
bool f2()
static bool
f2()
{
spot::digraph<int, void> g(3);
@ -133,7 +136,8 @@ bool f2()
return f == 5;
}
bool f3()
static bool
f3()
{
spot::digraph<void, int> g(3);
@ -155,7 +159,8 @@ bool f3()
return f == 3 && g.states().size() == 3;
}
bool f4()
static bool
f4()
{
spot::digraph<int, int> g(3);
@ -177,7 +182,8 @@ bool f4()
return f == 11;
}
bool f5()
static bool
f5()
{
spot::digraph<void, std::pair<int, float>> g(3);
@ -199,7 +205,8 @@ bool f5()
return f == 3 && (h > 2.49 && h < 2.51);
}
bool f6()
static bool
f6()
{
spot::digraph<void, std::pair<int, float>> g(3);
@ -221,7 +228,8 @@ bool f6()
return f == 3 && (h > 2.49 && h < 2.51);
}
bool f7()
static bool
f7()
{
spot::digraph<int, int, true> g(3);
auto s1 = g.new_state(2);
@ -267,7 +275,8 @@ struct int_pair
#endif
};
bool f8()
static bool
f8()
{
spot::digraph<int_pair, int_pair> g(3);
auto s1 = g.new_state(2, 4);

View file

@ -71,25 +71,7 @@
#include "taalgos/dot.hh"
#include "taalgos/stats.hh"
std::string
ltl_defs()
{
std::string s = "\
X=(0 1 true \
1 2 $0 \
accept 2) \
U=(0 0 $0 \
0 1 $1 \
accept 1) \
G=(0 0 $0) \
F=U(true, $0) \
W=G($0)|U($0, $1) \
R=!U(!$0, !$1) \
M=F($0)&R($0, $1)";
return s;
}
void
static void
syntax(char* prog)
{
// Display the supplied name unless it appears to be a libtool wrapper.
@ -304,7 +286,8 @@ to_int(const char* s)
return res;
}
spot::twa_graph_ptr ensure_digraph(const spot::twa_ptr& a)
static spot::twa_graph_ptr
ensure_digraph(const spot::twa_ptr& a)
{
auto aa = std::dynamic_pointer_cast<spot::twa_graph>(a);
if (aa)
@ -312,7 +295,7 @@ spot::twa_graph_ptr ensure_digraph(const spot::twa_ptr& a)
return spot::make_twa_graph(a, spot::twa::prop_set::all());
}
int
static int
checked_main(int argc, char** argv)
{
int exit_code = 0;

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2014 Laboratoire de Recherche et Developpement
// Copyright (C) 2011, 2014, 2015 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -22,7 +22,8 @@
#include <cstring>
int check_aa(int* data, int size, unsigned expected = 0)
static int
check_aa(int* data, int size, unsigned expected = 0)
{
int* comp = new int[size * 2];
size_t csize = size * 2;
@ -67,7 +68,8 @@ int check_aa(int* data, int size, unsigned expected = 0)
return !!res;
}
int check(int* comp, int size, unsigned expected = 0)
static int
check(int* comp, int size, unsigned expected = 0)
{
return
//check_vv(comp, size, expected) +

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2014 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE).
// Copyright (C) 2011, 2014, 2015 Laboratoire de Recherche et
// Developpement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -21,7 +21,8 @@
#include "misc/intvcomp.hh"
#include <cstring>
int check_vv(int* data, int size, unsigned expected = 0)
static int
check_vv(int* data, int size, unsigned expected = 0)
{
std::vector<int> input;
@ -69,7 +70,8 @@ int check_vv(int* data, int size, unsigned expected = 0)
return !!res;
}
int check_av(int* data, int size, unsigned expected = 0)
static int
check_av(int* data, int size, unsigned expected = 0)
{
const std::vector<unsigned int>* v =
spot::int_array_vector_compress(data, size);
@ -113,7 +115,8 @@ int check_av(int* data, int size, unsigned expected = 0)
return !!res;
}
int check_aa(int* data, int size, unsigned expected = 0)
static int
check_aa(int* data, int size, unsigned expected = 0)
{
int* comp = new int[size *2];
size_t csize = size * 2;
@ -158,7 +161,8 @@ int check_aa(int* data, int size, unsigned expected = 0)
return !!res;
}
int check(int* comp, int size, unsigned expected = 0)
static int
check(int* comp, int size, unsigned expected = 0)
{
return
check_vv(comp, size, expected) +

View file

@ -24,7 +24,7 @@
#include <cstdlib>
#include "tl/parse.hh"
void
static void
syntax(char *prog)
{
std::cerr << prog << " formula" << std::endl;

View file

@ -24,7 +24,7 @@
#include "tl/parse.hh"
#include "tl/length.hh"
void
static void
syntax(char *prog)
{
std::cerr << prog << " formula" << std::endl;

View file

@ -28,7 +28,7 @@
#include "twaalgos/ltl2tgba_fm.hh"
#include "twaalgos/dot.hh"
void
static void
syntax(char* prog)
{
std::cerr << prog << " formula1 formula2" << std::endl;

View file

@ -24,7 +24,7 @@
#include "tl/relabel.hh"
#include "tl/print.hh"
void
static void
syntax(char *prog)
{
std::cerr << prog << " formula" << std::endl;

View file

@ -108,8 +108,8 @@ dot(std::ostream& out, const spot::named_graph<G1, G2, G3, G4>& g)
}
bool g1(const spot::digraph<void, void>& g,
unsigned s, int e)
static bool
g1(const spot::digraph<void, void>& g, unsigned s, int e)
{
int f = 0;
for (auto& t: g.out(s))
@ -120,7 +120,7 @@ bool g1(const spot::digraph<void, void>& g,
return f == e;
}
bool f1()
static bool f1()
{
spot::digraph<void, void> g(3);
spot::named_graph<spot::digraph<void, void>, std::string> gg(g);
@ -150,7 +150,7 @@ bool f1()
}
bool f2()
static bool f2()
{
spot::digraph<int, void> g(3);
spot::named_graph<spot::digraph<int, void>, std::string> gg(g);
@ -173,7 +173,7 @@ bool f2()
return f == 5;
}
bool f3()
static bool f3()
{
spot::digraph<void, int> g(3);
spot::named_graph<spot::digraph<void, int>, std::string> gg(g);
@ -196,7 +196,7 @@ bool f3()
return f == 3 && g.states().size() == 3;
}
bool f4()
static bool f4()
{
spot::digraph<int, int> g(3);
spot::named_graph<spot::digraph<int, int>, std::string> gg(g);
@ -219,7 +219,7 @@ bool f4()
return f == 11;
}
bool f5()
static bool f5()
{
typedef spot::digraph<void, std::pair<int, float>> graph_t;
graph_t g(3);
@ -243,7 +243,7 @@ bool f5()
return f == 3 && (h > 2.49 && h < 2.51);
}
bool f6()
static bool f6()
{
typedef spot::digraph<void, std::pair<int, float>> graph_t;
graph_t g(3);
@ -267,7 +267,7 @@ bool f6()
return f == 3 && (h > 2.49 && h < 2.51);
}
bool f7()
static bool f7()
{
typedef spot::digraph<int, int, true> graph_t;
graph_t g(3);
@ -316,7 +316,7 @@ struct int_pair
#endif
};
bool f8()
static bool f8()
{
typedef spot::digraph<int_pair, int_pair> graph_t;
graph_t g(3);
@ -382,7 +382,7 @@ public:
}
};
bool f9()
static bool f9()
{
typedef spot::digraph<my_state, int_pair> graph_t;
graph_t g(3);

View file

@ -82,7 +82,7 @@ const char* default_algos[] = {
std::vector<ec_algo> ec_algos;
spot::emptiness_check_ptr
static spot::emptiness_check_ptr
cons_emptiness_check(int num, spot::const_twa_graph_ptr a,
const spot::const_twa_graph_ptr& degen,
unsigned int n_acc)
@ -96,7 +96,7 @@ cons_emptiness_check(int num, spot::const_twa_graph_ptr a,
return nullptr;
}
void
static void
syntax(char* prog)
{
std::cerr << "Usage: "<< prog << " [OPTIONS...] PROPS..." << std::endl
@ -173,7 +173,7 @@ syntax(char* prog)
}
int
static int
to_int(const char* s)
{
char* endptr;
@ -186,7 +186,7 @@ to_int(const char* s)
return res;
}
int
static int
to_int_pos(const char* s, const char* arg)
{
int res = to_int(s);
@ -199,7 +199,7 @@ to_int_pos(const char* s, const char* arg)
return res;
}
int
static int
to_int_nonneg(const char* s, const char* arg)
{
int res = to_int(s);
@ -212,7 +212,7 @@ to_int_nonneg(const char* s, const char* arg)
return res;
}
float
static float
to_float(const char* s)
{
char* endptr;
@ -226,7 +226,7 @@ to_float(const char* s)
return res;
}
float
static float
to_float_nonneg(const char* s, const char* arg)
{
float res = to_float(s);
@ -250,7 +250,7 @@ id(const char*, unsigned x)
spot::tgba_statistics prod_stats;
float
static float
prod_conv(const char* name, unsigned x)
{
float y = static_cast<float>(x);
@ -418,7 +418,7 @@ ar_stats_type ar_stats; // Statistics about accepting runs.
ar_stats_type mar_stats; // ... about minimized accepting runs.
void
static void
print_ar_stats(ar_stats_type& ar_stats, const std::string& s)
{
std::ios::fmtflags old = std::cout.flags();
@ -486,7 +486,7 @@ print_ar_stats(ar_stats_type& ar_stats, const std::string& s)
std::cout << std::setiosflags(old);
}
spot::formula
static spot::formula
generate_formula(const spot::random_ltl& rl,
spot::ltl_simplifier& simp,
int opt_f, int opt_s,

View file

@ -27,7 +27,7 @@
#include "tl/parse.hh"
#include "tl/dot.hh"
void
static void
syntax(char* prog)
{
std::cerr << prog << " [-d] formula" << std::endl;

View file

@ -31,7 +31,7 @@
#include "tl/simplify.hh"
#include "tl/length.hh"
void
static void
syntax(char* prog)
{
std::cerr << prog << " option formula1 (formula2)?" << std::endl;

View file

@ -28,7 +28,7 @@
#include "tl/simplify.hh"
#include "tl/nenoform.hh"
void
static void
syntax(char* prog)
{
std::cerr << prog << " formula1 formula2?" << std::endl;

View file

@ -26,7 +26,7 @@
#include "tl/parse.hh"
#include "tl/print.hh"
void
static void
syntax(char *prog)
{
std::cerr << prog << " formula1" << std::endl;

View file

@ -23,7 +23,7 @@
#include "twaalgos/dot.hh"
#include "tl/defaultenv.hh"
void f1()
static void f1()
{
auto d = spot::make_bdd_dict();
auto tg = make_twa_graph(d);

View file

@ -120,17 +120,4 @@ namespace spot
r.translation = e;
return &r;
}
formula
reduce_tau03(formula f, bool stronger)
{
if (!f.is_psl_formula())
return f;
ltl_simplifier_options opt(false, false, false,
true, stronger);
ltl_simplifier simpl(opt);
return simpl.simplify(f);
}
}

View file

@ -24,7 +24,10 @@
namespace spot
{
twa_graph_ptr dtgba_complement_nonweak(const const_twa_graph_ptr& aut)
namespace
{
static twa_graph_ptr
dtgba_complement_nonweak(const const_twa_graph_ptr& aut)
{
// Clone the original automaton.
auto res = make_twa_graph(aut,
@ -112,7 +115,8 @@ namespace spot
return res;
}
twa_graph_ptr dtgba_complement_weak(const const_twa_graph_ptr& aut)
static twa_graph_ptr
dtgba_complement_weak(const const_twa_graph_ptr& aut)
{
// Clone the original automaton.
auto res = make_twa_graph(aut,
@ -159,6 +163,7 @@ namespace spot
//res->merge_edges();
return res;
}
}
twa_graph_ptr dtgba_complement(const const_twa_graph_ptr& aut)
{

View file

@ -80,10 +80,10 @@ namespace spot
dump_hash_set(hs, aut, s);
return s.str();
}
}
// Find all states of an automaton.
void build_state_set(const const_twa_ptr& a, hash_set* seen)
static void
build_state_set(const const_twa_ptr& a, hash_set* seen)
{
std::queue<const state*> tovisit;
// Perform breadth-first traversal.
@ -113,7 +113,8 @@ namespace spot
// From the base automaton and the list of sets, build the minimal
// resulting automaton
twa_graph_ptr build_result(const const_twa_ptr& a,
static twa_graph_ptr
build_result(const const_twa_ptr& a,
std::list<hash_set*>& sets,
hash_set* final)
{
@ -174,10 +175,6 @@ namespace spot
return res;
}
namespace
{
struct wdba_search_acc_loop : public bfs_steps
{
wdba_search_acc_loop(const const_twa_ptr& det_a,
@ -265,9 +262,7 @@ namespace spot
return accepting;
}
}
twa_graph_ptr minimize_dfa(const const_twa_graph_ptr& det_a,
static twa_graph_ptr minimize_dfa(const const_twa_graph_ptr& det_a,
hash_set* final, hash_set* non_final)
{
typedef std::list<hash_set*> partition_t;
@ -332,8 +327,8 @@ namespace spot
delete non_final;
}
// A bdd_states_map is a list of formulae (in a BDD form) associated with a
// destination set of states.
// A bdd_states_map is a list of formulae (in a BDD form)
// associated with a destination set of states.
typedef std::map<bdd, hash_set*, bdd_less_than> bdd_states_map;
bool did_split = true;
@ -347,7 +342,8 @@ namespace spot
hash_set* cur = cur_run.front();
cur_run.pop_front();
trace << "processing " << format_hash_set(cur, det_a) << std::endl;
trace << "processing " << format_hash_set(cur, det_a)
<< std::endl;
hash_set::iterator hi;
bdd_states_map bdd_map;
@ -471,7 +467,7 @@ namespace spot
return res;
}
}
twa_graph_ptr minimize_monitor(const const_twa_graph_ptr& a)
{