Commit 20365e53 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

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.
parent 162d8d29
......@@ -943,75 +943,75 @@ namespace spot
mutable callback_context* state_condition_last_cc_;
};
}
//////////////////////////////////////////////////////////////////////////
// LOADER
////////////////////////////////////////////////////////////////////////////
// LOADER
// Call spins to compile "foo.prom" as "foo.prom.spins" if the latter
// does not exist already or is older.
static bool
compile_model(std::string& filename, std::string& ext, bool verbose)
{
std::string command;
std::string compiled_ext;
// Call spins to compile "foo.prom" as "foo.prom.spins" if the latter
// does not exist already or is older.
bool
compile_model(std::string& filename, std::string& ext, bool verbose)
{
std::string command;
std::string compiled_ext;
if (ext == ".prom" || ext == ".pm" || ext == ".pml")
{
command = "spins " + filename;
compiled_ext = ".spins";
}
else if (ext == ".dve")
{
command = "divine compile --ltsmin " + filename;
compiled_ext = "2C";
}
else
{
if (verbose)
std::cerr << "Unknown extension `" << ext
<< ("'. Use `.prom', `.pm', `.pml', `.dve', `.dve2C' or"
"`.prom.spins'.") << std::endl;
return false;
}
if (ext == ".prom" || ext == ".pm" || ext == ".pml")
{
command = "spins " + filename;
compiled_ext = ".spins";
}
else if (ext == ".dve")
{
command = "divine compile --ltsmin " + filename;
compiled_ext = "2C";
}
else
{
if (verbose)
std::cerr << "Unknown extension `" << ext
<< "'. Use `.prom', `.pm', `.pml', `.dve', `.dve2C' or"\
"`.prom.spins'." << std::endl;
return false;
}
struct stat s;
if (stat(filename.c_str(), &s) != 0)
{
if (verbose)
{
std::cerr << "Cannot open " << filename << std::endl;
return true;
}
}
struct stat s;
if (stat(filename.c_str(), &s) != 0)
{
if (verbose)
{
std::cerr << "Cannot open " << filename << std::endl;
return true;
}
}
std::string old = filename;
filename += compiled_ext;
std::string old = filename;
filename += compiled_ext;
// Remove any directory, because the new file will
// be compiled in the current directory.
size_t pos = filename.find_last_of("/\\");
if (pos != std::string::npos)
filename = "./" + filename.substr(pos + 1);
// Remove any directory, because the new file will
// be compiled in the current directory.
size_t pos = filename.find_last_of("/\\");
if (pos != std::string::npos)
filename = "./" + filename.substr(pos + 1);
struct stat d;
if (stat(filename.c_str(), &d) == 0)
if (s.st_mtime < d.st_mtime)
// The .spins or .dve2C is up-to-date, no need to recompile it.
return false;
struct stat d;
if (stat(filename.c_str(), &d) == 0)
if (s.st_mtime < d.st_mtime)
// The .spins or .dve2C is up-to-date, no need to recompile it.
return false;
int res = system(command.c_str());
if (res)
{
if (verbose)
std::cerr << "Execution of `" << command.c_str()
<< "' returned exit code " << WEXITSTATUS(res)
<< ".\n";
return true;
}
return false;
}
int res = system(command.c_str());
if (res)
{
if (verbose)
std::cerr << "Execution of `" << command.c_str()
<< "' returned exit code " << WEXITSTATUS(res)
<< ".\n";
return true;
}
return false;
}
kripke_ptr
......
......@@ -60,7 +60,7 @@ Options:\n\
exit(1);
}
int
static int
checked_main(int argc, char **argv)
{
spot::timer_map tm;
......
......@@ -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
......
......@@ -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"
......
......@@ -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));
}
......
......@@ -108,7 +108,7 @@ namespace
};
}
int
static int
parse_opt(int key, char* arg, struct argp_state*)
{
switch (key)
......
......@@ -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)
{
......
......@@ -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)
......
......@@ -29,7 +29,7 @@
#include "twaalgos/product.hh"
#include "twaalgos/dot.hh"
void
static void
syntax(char* prog)
{
std::cerr << prog << " file" << std::endl;
......
......@@ -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);
......
......@@ -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
......
......@@ -24,7 +24,7 @@
#include <cstdlib>
#include "tl/parse.hh"
void
static void
syntax(char *prog)
{
std::cerr << prog << " formula" << std::endl;
......
......@@ -32,7 +32,7 @@
#include "twaalgos/dot.hh"
#include "twaalgos/emptiness.hh"
void
static void
syntax(char* prog)
{
std::cerr << prog << " file" << std::endl;
......
......@@ -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;
......
......@@ -70,8 +70,9 @@ dot(std::ostream& out, spot::digraph<SL, TL>& 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))
......@@ -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);
......
......@@ -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;
......
// -*- 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) +
......
// -*- 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) +
......
......@@ -24,7 +24,7 @@
#include <cstdlib>
#include "tl/parse.hh"
void
static void
syntax(char *prog)
{
std::cerr << prog << " formula" << std::endl;
......
......@@ -24,7 +24,7 @@
#include "tl/parse.hh"
#include "tl/length.hh"
void
static void
syntax(char *prog)
{
std::cerr << prog << " formula" << std::endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment