Commit 1729a79a authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

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.
parent 51a3cfce
......@@ -34,10 +34,10 @@ const char argp_program_doc[] ="";
const struct argp_child children[] =
{
{ &finput_argp, 0, 0, 1 },
{ &output_argp, 0, 0, -20 },
{ &misc_argp, 0, 0, -1 },
{ 0, 0, 0, 0 }
{ &finput_argp, 0, nullptr, 1 },
{ &output_argp, 0, nullptr, -20 },
{ &misc_argp, 0, nullptr, -1 },
{ nullptr, 0, nullptr, 0 }
};
namespace
......@@ -109,10 +109,10 @@ main(int argc, char** argv)
{
setup(argv);
const argp ap = { 0, 0, "[FILENAME[/COL]...]",
argp_program_doc, children, 0, 0 };
const argp ap = { nullptr, nullptr, "[FILENAME[/COL]...]",
argp_program_doc, children, nullptr, nullptr };
if (int err = argp_parse(&ap, argc, argv, ARGP_NO_HELP, 0, 0))
if (int err = argp_parse(&ap, argc, argv, ARGP_NO_HELP, nullptr, nullptr))
exit(err);
spot::translator trans;
......
......@@ -376,7 +376,7 @@ namespace spot
char* name = (char*) malloc(str.size() + 1);
char* name_p = name;
char* lastdot = 0;
char* lastdot = nullptr;
while (*s && (*s != '=') && *s != '<' && *s != '!' && *s != '>')
{
......@@ -608,17 +608,18 @@ namespace spot
d_(d),
state_size_(d_->get_state_size()),
dict_(dict), ps_(ps),
compress_(compress == 0 ? 0
compress_(compress == 0 ? nullptr
: compress == 1 ? int_array_array_compress
: int_array_array_compress2),
decompress_(compress == 0 ? 0
decompress_(compress == 0 ? nullptr
: compress == 1 ? int_array_array_decompress
: int_array_array_decompress2),
uncompressed_(compress ? new int[state_size_ + 30] : 0),
compressed_(compress ? new int[state_size_ * 2] : 0),
uncompressed_(compress ? new int[state_size_ + 30] : nullptr),
compressed_(compress ? new int[state_size_ * 2] : nullptr),
statepool_(compress ? sizeof(spins_compressed_state) :
(sizeof(spins_state) + state_size_ * sizeof(int))),
state_condition_last_state_(0), state_condition_last_cc_(0)
state_condition_last_state_(nullptr),
state_condition_last_cc_(nullptr)
{
vname_ = new const char*[state_size_];
format_filter_ = new bool[state_size_];
......@@ -770,7 +771,7 @@ namespace spot
: static_cast<const void*>(&statepool_));
cc->compress = compress_;
cc->compressed = compressed_;
t = d_->get_successors(0, const_cast<int*>(vars),
t = d_->get_successors(nullptr, const_cast<int*>(vars),
compress_
? transition_callback_compress
: transition_callback,
......@@ -790,7 +791,7 @@ namespace spot
{
state_condition_last_state_->destroy();
delete state_condition_last_cc_; // Might be 0 already.
state_condition_last_cc_ = 0;
state_condition_last_cc_ = nullptr;
}
const int* vars = get_vars(st);
......@@ -853,7 +854,7 @@ namespace spot
if (state_condition_last_cc_)
{
cc = state_condition_last_cc_;
state_condition_last_cc_ = 0; // Now owned by the iterator.
state_condition_last_cc_ = nullptr; // Now owned by the iterator.
}
else
{
......@@ -1032,7 +1033,7 @@ namespace spot
if (verbose)
std::cerr << "Failed to compile `" << file_arg
<< "'." << std::endl;
return 0;
return nullptr;
}
}
......@@ -1040,7 +1041,7 @@ namespace spot
{
if (verbose)
std::cerr << "Failed to initialize libltdl." << std::endl;
return 0;
return nullptr;
}
lt_dlhandle h = lt_dlopen(file.c_str());
......@@ -1049,7 +1050,7 @@ namespace spot
if (verbose)
std::cerr << "Failed to load `" << file << "'." << std::endl;
lt_dlexit();
return 0;
return nullptr;
}
spins_interface* d = new spins_interface;
......@@ -1117,7 +1118,7 @@ namespace spot
<< file << "'\n";
delete d;
lt_dlexit();
return 0;
return nullptr;
}
if (d->have_property && d->have_property())
......@@ -1127,7 +1128,7 @@ namespace spot
<< std::endl;
delete d;
lt_dlexit();
return 0;
return nullptr;
}
spot::prop_set* ps = new spot::prop_set;
......@@ -1138,7 +1139,7 @@ namespace spot
dict->unregister_all_my_variables(d);
delete d;
lt_dlexit();
return 0;
return nullptr;
}
return std::make_shared<spins_kripke>(d, dict, ps, dead, compress);
......
......@@ -72,7 +72,7 @@ checked_main(int argc, char **argv)
bool accepting_run = false;
bool expect_counter_example = false;
bool deterministic = false;
char *dead = 0;
char *dead = nullptr;
int compress_states = 0;
const char* echeck_algo = "Cou99";
......
......@@ -20,11 +20,12 @@ AC_DEFUN([CF_GXX_WARNINGS],
[
cat > conftest.$ac_ext <<EOF
#line __oline__ "configure"
int main(int argc, char *argv[[]]) { return argv[[argc-1]] == 0; }
int main(int argc, char *argv[[]]) { return argv[[argc-1]] == nullptr; }
EOF
cf_save_CXXFLAGS="$CXXFLAGS"
ac_cv_prog_gxx_warn_flags="-W -Wall"
for cf_opt in \
Wzero-as-null-pointer-constant \
Wcast-align \
Wpointer-arith \
Wwrite-strings \
......
......@@ -104,29 +104,30 @@ enum {
static const argp_option options[] =
{
/**************************************************/
{ 0, 0, 0, 0, "Input:", 1 },
{ nullptr, 0, nullptr, 0, "Input:", 1 },
{ "file", 'F', "FILENAME", 0,
"process the automaton in FILENAME", 0 },
/**************************************************/
{ 0, 0, 0, 0, "Output automaton type:", 2 },
{ "generic", OPT_GENERIC, 0, 0,
{ nullptr, 0, nullptr, 0, "Output automaton type:", 2 },
{ "generic", OPT_GENERIC, nullptr, 0,
"Any acceptance is allowed (default)", 0 },
{ "tgba", OPT_TGBA, 0, 0,
{ "tgba", OPT_TGBA, nullptr, 0,
"Transition-based Generalized Büchi Automaton", 0 },
{ "ba", 'B', 0, 0, "Büchi Automaton (with state-based acceptance)", 0 },
{ "monitor", 'M', 0, 0, "Monitor (accepts all finite prefixes "
{ "ba", 'B', nullptr, 0,
"Büchi Automaton (with state-based acceptance)", 0 },
{ "monitor", 'M', nullptr, 0, "Monitor (accepts all finite prefixes "
"of the given property)", 0 },
/**************************************************/
{ "count", 'c', 0, 0, "print only a count of matched automata", 3 },
{ "count", 'c', nullptr, 0, "print only a count of matched automata", 3 },
{ "max-count", 'n', "NUM", 0, "output at most NUM automata", 3 },
/**************************************************/
{ 0, 0, 0, 0, "Transformations:", 5 },
{ "merge-transitions", OPT_MERGE, 0, 0,
{ nullptr, 0, nullptr, 0, "Transformations:", 5 },
{ "merge-transitions", OPT_MERGE, nullptr, 0,
"merge transitions with same destination and acceptance", 0 },
{ "product", OPT_PRODUCT_AND, "FILENAME", 0,
"build the product with the automaton in FILENAME "
"to intersect languages", 0 },
{ "product-and", 0, 0, OPTION_ALIAS, 0, 0 },
{ "product-and", 0, nullptr, OPTION_ALIAS, nullptr, 0 },
{ "product-or", OPT_PRODUCT_OR, "FILENAME", 0,
"build the product with the automaton in FILENAME "
"to sum languages", 0 },
......@@ -135,23 +136,23 @@ static const argp_option options[] =
"randomize only states or transitions)", 0 },
{ "instut", OPT_INSTUT, "1|2", OPTION_ARG_OPTIONAL,
"allow more stuttering (two possible algorithms)", 0 },
{ "destut", OPT_DESTUT, 0, 0, "allow less stuttering", 0 },
{ "destut", OPT_DESTUT, nullptr, 0, "allow less stuttering", 0 },
{ "mask-acc", OPT_MASK_ACC, "NUM[,NUM...]", 0,
"remove all transitions in specified acceptance sets", 0 },
{ "strip-acceptance", OPT_STRIPACC, 0, 0,
{ "strip-acceptance", OPT_STRIPACC, nullptr, 0,
"remove the acceptance condition and all acceptance sets", 0 },
{ "keep-states", OPT_KEEP_STATES, "NUM[,NUM...]", 0,
"only keep specified states. The first state will be the new "\
"initial state. Implies --remove-unreachable-states.", 0 },
{ "dnf-acceptance", OPT_DNF_ACC, 0, 0,
{ "dnf-acceptance", OPT_DNF_ACC, nullptr, 0,
"put the acceptance condition in Disjunctive Normal Form", 0 },
{ "cnf-acceptance", OPT_CNF_ACC, 0, 0,
{ "cnf-acceptance", OPT_CNF_ACC, nullptr, 0,
"put the acceptance condition in Conjunctive Normal Form", 0 },
{ "remove-fin", OPT_REM_FIN, 0, 0,
{ "remove-fin", OPT_REM_FIN, nullptr, 0,
"rewrite the automaton without using Fin acceptance", 0 },
{ "cleanup-acceptance", OPT_CLEAN_ACC, 0, 0,
{ "cleanup-acceptance", OPT_CLEAN_ACC, nullptr, 0,
"remove unused acceptance sets from the automaton", 0 },
{ "complement-acceptance", OPT_COMPLEMENT_ACC, 0, 0,
{ "complement-acceptance", OPT_COMPLEMENT_ACC, nullptr, 0,
"complement the acceptance condition (without touching the automaton)",
0 },
{ "exclusive-ap", OPT_EXCLUSIVE_AP, "AP,AP,...", 0,
......@@ -159,44 +160,44 @@ static const argp_option options[] =
"ensure two of them may not be true at the same time. Use this option "
"multiple times to declare independent groups of exclusive "
"propositions.", 0 },
{ "simplify-exclusive-ap", OPT_SIMPLIFY_EXCLUSIVE_AP, 0, 0,
{ "simplify-exclusive-ap", OPT_SIMPLIFY_EXCLUSIVE_AP, nullptr, 0,
"if --exclusive-ap is used, assume those AP groups are actually exclusive"
" in the system to simplify the expression of transition labels (implies "
"--merge-transitions)", 0 },
{ "remove-ap", OPT_REM_AP, "AP[=0|=1][,AP...]", 0,
"remove atomic propositions either by existential quantification, or "
"by assigning them 0 or 1", 0 },
{ "remove-unreachable-states", OPT_REM_UNREACH, 0, 0,
{ "remove-unreachable-states", OPT_REM_UNREACH, nullptr, 0,
"remove states that are unreachable from the initial state", 0 },
{ "remove-dead-states", OPT_REM_DEAD, 0, 0,
{ "remove-dead-states", OPT_REM_DEAD, nullptr, 0,
"remove states that are unreachable, or that cannot belong to an "
"infinite path", 0 },
{ "separate-sets", OPT_SEP_SETS, 0, 0,
{ "separate-sets", OPT_SEP_SETS, nullptr, 0,
"if both Inf(x) and Fin(x) appear in the acceptance condition, replace "
"Fin(x) by a new Fin(y) and adjust the automaton", 0 },
{ "sat-minimize", OPT_SAT_MINIMIZE, "options", OPTION_ARG_OPTIONAL,
"minimize the automaton using a SAT solver (only work for deterministic"
" automata)", 0 },
/**************************************************/
{ 0, 0, 0, 0, "Filtering options:", 6 },
{ nullptr, 0, nullptr, 0, "Filtering options:", 6 },
{ "are-isomorphic", OPT_ARE_ISOMORPHIC, "FILENAME", 0,
"keep automata that are isomorphic to the automaton in FILENAME", 0 },
{ "isomorphic", 0, 0, OPTION_ALIAS | OPTION_HIDDEN, 0, 0 },
{ "unique", 'u', 0, 0,
{ "isomorphic", 0, nullptr, OPTION_ALIAS | OPTION_HIDDEN, nullptr, 0 },
{ "unique", 'u', nullptr, 0,
"do not output the same automaton twice (same in the sense that they "\
"are isomorphic)", 0 },
{ "is-complete", OPT_IS_COMPLETE, 0, 0,
{ "is-complete", OPT_IS_COMPLETE, nullptr, 0,
"keep complete automata", 0 },
{ "is-deterministic", OPT_IS_DETERMINISTIC, 0, 0,
{ "is-deterministic", OPT_IS_DETERMINISTIC, nullptr, 0,
"keep deterministic automata", 0 },
{ "is-empty", OPT_IS_EMPTY, 0, 0,
{ "is-empty", OPT_IS_EMPTY, nullptr, 0,
"keep automata with an empty language", 0 },
{ "is-unambiguous", OPT_IS_UNAMBIGUOUS, 0, 0,
{ "is-unambiguous", OPT_IS_UNAMBIGUOUS, nullptr, 0,
"keep only unambiguous automata", 0 },
{ "intersect", OPT_INTERSECT, "FILENAME", 0,
"keep automata whose languages have an non-empty intersection with"
" the automaton from FILENAME", 0 },
{ "invert-match", 'v', 0, 0, "select non-matching automata", 0 },
{ "invert-match", 'v', nullptr, 0, "select non-matching automata", 0 },
{ "states", OPT_STATES, "RANGE", 0,
"keep automata whose number of states are in RANGE", 0 },
{ "edges", OPT_EDGES, "RANGE", 0,
......@@ -205,21 +206,21 @@ static const argp_option options[] =
"keep automata whose number of acceptance sets are in RANGE", 0 },
RANGE_DOC_FULL,
/**************************************************/
{ 0, 0, 0, 0, "Miscellaneous options:", -1 },
{ nullptr, 0, nullptr, 0, "Miscellaneous options:", -1 },
{ "extra-options", 'x', "OPTS", 0,
"fine-tuning options (see spot-x (7))", 0 },
{ "seed", OPT_SEED, "INT", 0,
"seed for the random number generator (0)", 0 },
{ 0, 0, 0, 0, 0, 0 }
{ nullptr, 0, nullptr, 0, nullptr, 0 }
};
static const struct argp_child children[] =
{
{ &aoutput_argp, 0, 0, 0 },
{ &aoutput_io_format_argp, 0, 0, 4 },
{ &post_argp_disabled, 0, 0, 20 },
{ &misc_argp, 0, 0, -1 },
{ 0, 0, 0, 0 }
{ &aoutput_argp, 0, nullptr, 0 },
{ &aoutput_io_format_argp, 0, nullptr, 4 },
{ &post_argp_disabled, 0, nullptr, 20 },
{ &misc_argp, 0, nullptr, -1 },
{ nullptr, 0, nullptr, 0 }
};
typedef spot::twa_graph::graph_t::edge_storage_t tr_t;
......@@ -677,7 +678,7 @@ main(int argc, char** argv)
setup(argv);
const argp ap = { options, parse_opt, "[FILENAMES...]",
argp_program_doc, children, 0, 0 };
argp_program_doc, children, nullptr, nullptr };
try
{
......@@ -690,7 +691,7 @@ main(int argc, char** argv)
level = spot::postprocessor::Low;
pref = spot::postprocessor::Any;
type = spot::postprocessor::Generic;
if (int err = argp_parse(&ap, argc, argv, ARGP_NO_HELP, 0, 0))
if (int err = argp_parse(&ap, argc, argv, ARGP_NO_HELP, nullptr, nullptr))
exit(err);
if (jobs.empty())
......
......@@ -55,7 +55,7 @@ static char const *const check_args[] =
"stutter-insensitive", "stuttering-insensitive",
"stutter-sensitive", "stuttering-sensitive",
"all",
0
nullptr
};
static check_type const check_types[] =
{
......@@ -79,7 +79,7 @@ enum {
static const argp_option options[] =
{
/**************************************************/
{ 0, 0, 0, 0, "Output format:", 3 },
{ nullptr, 0, nullptr, 0, "Output format:", 3 },
{ "dot", OPT_DOT, "1|a|b|B|c|e|f(FONT)|h|n|N|o|r|R|s|t|v",
OPTION_ARG_OPTIONAL,
"GraphViz's format (default). Add letters for "
......@@ -109,11 +109,11 @@ static const argp_option options[] =
"send output to a file named FORMAT instead of standard output. The"
" first automaton sent to a file truncates it unless FORMAT starts"
" with '>>'.", 0 },
{ "quiet", 'q', 0, 0, "suppress all normal output", 0 },
{ "quiet", 'q', nullptr, 0, "suppress all normal output", 0 },
{ "spin", 's', "6|c", OPTION_ARG_OPTIONAL, "Spin neverclaim (implies --ba)."
" Add letters to select (6) Spin's 6.2.4 style, (c) comments on states",
0 },
{ "utf8", '8', 0, 0, "enable UTF-8 characters in output "
{ "utf8", '8', nullptr, 0, "enable UTF-8 characters in output "
"(ignored with --lbtt or --spin)", 0 },
{ "stats", OPT_STATS, "FORMAT", 0,
"output statistics about the automaton", 0 },
......@@ -121,10 +121,11 @@ static const argp_option options[] =
"test for the additional property PROP and output the result "
"in the HOA format (implies -H). PROP may be any prefix of "
"'all' (default), 'unambiguous', or 'stutter-invariant'.", 0 },
{ 0, 0, 0, 0, 0, 0 }
{ nullptr, 0, nullptr, 0, nullptr, 0 }
};
const struct argp aoutput_argp = { options, parse_opt_aoutput, 0, 0, 0, 0, 0 };
const struct argp aoutput_argp = { options, parse_opt_aoutput, nullptr, nullptr,
nullptr, nullptr, nullptr };
// Those can be overridden by individual tools. E.g. randaut has no
// notion of input file, so %F and %L represent something else.
......@@ -134,69 +135,83 @@ char L_doc[32] = "location in the input file";
static const argp_option io_options[] =
{
/**************************************************/
{ 0, 0, 0, 0, "Any FORMAT string may use "\
{ nullptr, 0, nullptr, 0, "Any FORMAT string may use "\
"the following interpreted sequences (capitals for input,"
" minuscules for output):", 4 },
{ "%F", 0, 0, OPTION_DOC | OPTION_NO_USAGE, F_doc, 0 },
{ "%L", 0, 0, OPTION_DOC | OPTION_NO_USAGE, L_doc, 0 },
{ "%M, %m", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%F", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, F_doc, 0 },
{ "%L", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, L_doc, 0 },
{ "%M, %m", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"name of the automaton", 0 },
{ "%S, %s", 0, 0, OPTION_DOC | OPTION_NO_USAGE, "number of states", 0 },
{ "%E, %e", 0, 0, OPTION_DOC | OPTION_NO_USAGE, "number of edges", 0 },
{ "%T, %t", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%S, %s", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of states", 0 },
{ "%E, %e", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of edges", 0 },
{ "%T, %t", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of transitions", 0 },
{ "%A, %a", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%A, %a", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of acceptance sets", 0 },
{ "%G, %g", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%G, %g", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"acceptance condition (in HOA syntax)", 0 },
{ "%C, %c", 0, 0, OPTION_DOC | OPTION_NO_USAGE, "number of SCCs", 0 },
{ "%n", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%C, %c", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of SCCs", 0 },
{ "%n", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of nondeterministic states in output", 0 },
{ "%d", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%d", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"1 if the output is deterministic, 0 otherwise", 0 },
{ "%p", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%p", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"1 if the output is complete, 0 otherwise", 0 },
{ "%r", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%r", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"processing time (excluding parsing) in seconds", 0 },
{ "%w", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%w", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"one word accepted by the output automaton", 0 },
{ "%%", 0, 0, OPTION_DOC | OPTION_NO_USAGE, "a single %", 0 },
{ 0, 0, 0, 0, 0, 0 }
{ "%%", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"a single %", 0 },
{ nullptr, 0, nullptr, 0, nullptr, 0 }
};
const struct argp aoutput_io_format_argp = { io_options, 0, 0, 0, 0, 0, 0 };
const struct argp aoutput_io_format_argp = { io_options, nullptr, nullptr,
nullptr, nullptr,
nullptr, nullptr };
static const argp_option o_options[] =
{
/**************************************************/
{ 0, 0, 0, 0, "Any FORMAT string may use "\
{ nullptr, 0, nullptr, 0, "Any FORMAT string may use "\
"the following interpreted sequences:", 4 },
{ "%F", 0, 0, OPTION_DOC | OPTION_NO_USAGE, F_doc, 0 },
{ "%L", 0, 0, OPTION_DOC | OPTION_NO_USAGE, L_doc, 0 },
{ "%m", 0, 0, OPTION_DOC | OPTION_NO_USAGE, "name of the automaton", 0 },
{ "%s", 0, 0, OPTION_DOC | OPTION_NO_USAGE, "number of states", 0 },
{ "%e", 0, 0, OPTION_DOC | OPTION_NO_USAGE, "number of edges", 0 },
{ "%t", 0, 0, OPTION_DOC | OPTION_NO_USAGE, "number of transitions", 0 },
{ "%a", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%F", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, F_doc, 0 },
{ "%L", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, L_doc, 0 },
{ "%m", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"name of the automaton", 0 },
{ "%s", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of states", 0 },
{ "%e", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of edges", 0 },
{ "%t", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of transitions", 0 },
{ "%a", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of acceptance sets", 0 },
{ "%g", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%g", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"acceptance condition (in HOA syntax)", 0 },
{ "%c", 0, 0, OPTION_DOC | OPTION_NO_USAGE, "number of SCCs", 0 },
{ "%n", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%c", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of SCCs", 0 },
{ "%n", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"number of nondeterministic states in output", 0 },
{ "%d", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%d", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"1 if the output is deterministic, 0 otherwise", 0 },
{ "%p", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%p", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"1 if the output is complete, 0 otherwise", 0 },
{ "%r", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%r", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"processing time (excluding parsing) in seconds", 0 },
{ "%w", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
{ "%w", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"one word accepted by the output automaton", 0 },
{ "%%", 0, 0, OPTION_DOC | OPTION_NO_USAGE, "a single %", 0 },
{ 0, 0, 0, 0, 0, 0 }
{ "%%", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE,
"a single %", 0 },
{ nullptr, 0, nullptr, 0, nullptr, 0 }
};
const struct argp aoutput_o_format_argp = { o_options, 0, 0, 0, 0, 0, 0 };
const struct argp aoutput_o_format_argp = { o_options,
nullptr, nullptr, nullptr,
nullptr, nullptr, nullptr };
int parse_opt_aoutput(int key, char* arg, struct argp_state*)
{
......
......@@ -35,21 +35,23 @@ static bool lenient = false;
static const argp_option options[] =
{
{ 0, 0, 0, 0, "Input options:", 1 },
{ nullptr, 0, nullptr, 0, "Input options:", 1 },
{ "formula", 'f', "STRING", 0, "process the formula STRING", 0 },
{ "file", 'F', "FILENAME[/COL]", 0,
"process each line of FILENAME as a formula; if COL is a "
"positive integer, assume a CSV file and read column COL; use "
"a negative COL to drop the first line of the CSV file", 0 },
{ "lbt-input", OPT_LBT, 0, 0,
{ "lbt-input", OPT_LBT, nullptr, 0,
"read all formulas using LBT's prefix syntax", 0 },
{ "lenient", OPT_LENIENT, 0, 0,
{ "lenient", OPT_LENIENT, nullptr, 0,
"parenthesized blocks that cannot be parsed as subformulas "
"are considered as atomic properties", 0 },
{ 0, 0, 0, 0, 0, 0 }
{ nullptr, 0, nullptr, 0, nullptr, 0 }
};
const struct argp finput_argp = { options, parse_opt_finput, 0, 0, 0, 0, 0 };
const struct argp finput_argp = { options, parse_opt_finput,
nullptr, nullptr, nullptr,
nullptr, nullptr };
int
parse_opt_finput(int key, char* arg, struct argp_state*)
......@@ -86,8 +88,8 @@ parse_formula(const std::string& s, spot::ltl::parse_error_list& pel)
}
job_processor::job_processor()
: abort_run(false), real_filename(0),
col_to_read(0), prefix(0), suffix(0)
: abort_run(false), real_filename(nullptr),
col_to_read(0), prefix(nullptr), suffix(nullptr)
{
}
......@@ -179,7 +181,7 @@ job_processor::process_stream(std::istream& is,
const char* col1_start = str;
// Delimiters for the extracted column.
const char* coln_start = str;
const char* coln_end = 0;
const char* coln_end = nullptr;
// The current column. (1-based)
int colnum = 1;
// Whether we are parsing a double-quoted string.
......@@ -250,8 +252,8 @@ job_processor::process_stream(std::istream& is,
// %< and %> escapes (ignoring the trailing and leading
// commas).
prefix = (col_to_read != 1) ?
strndup(col1_start, coln_start - col1_start - 1) : 0;
suffix = (*coln_end != 0) ? strdup(coln_end + 1) : 0;
strndup(col1_start, coln_start - col1_start - 1) : nullptr;
suffix = (*coln_end != 0) ? strdup(coln_end + 1) : nullptr;
std::string field(coln_start, coln_end);
// Remove double-quotes if any.
if (field.find('"') != std::string::npos)
......@@ -275,12 +277,12 @@ job_processor::process_stream(std::istream& is,
if (prefix)
{
free(prefix);
prefix = 0;
prefix = nullptr;