diff --git a/bench/stutter/stutter_invariance_formulas.cc b/bench/stutter/stutter_invariance_formulas.cc index a3bff7fe7..46ec21125 100644 --- a/bench/stutter/stutter_invariance_formulas.cc +++ b/bench/stutter/stutter_invariance_formulas.cc @@ -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; diff --git a/iface/ltsmin/ltsmin.cc b/iface/ltsmin/ltsmin.cc index a1d077c9c..dc5b1d8ef 100644 --- a/iface/ltsmin/ltsmin.cc +++ b/iface/ltsmin/ltsmin.cc @@ -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(&statepool_)); cc->compress = compress_; cc->compressed = compressed_; - t = d_->get_successors(0, const_cast(vars), + t = d_->get_successors(nullptr, const_cast(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(d, dict, ps, dead, compress); diff --git a/iface/ltsmin/modelcheck.cc b/iface/ltsmin/modelcheck.cc index 9a87b3f5d..71e66b2e9 100644 --- a/iface/ltsmin/modelcheck.cc +++ b/iface/ltsmin/modelcheck.cc @@ -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"; diff --git a/m4/gccwarn.m4 b/m4/gccwarn.m4 index cf0f324b2..d4a597318 100644 --- a/m4/gccwarn.m4 +++ b/m4/gccwarn.m4 @@ -20,11 +20,12 @@ AC_DEFUN([CF_GXX_WARNINGS], [ cat > conftest.$ac_ext <>'.", 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*) { diff --git a/src/bin/common_finput.cc b/src/bin/common_finput.cc index 73e808d78..2546943a2 100644 --- a/src/bin/common_finput.cc +++ b/src/bin/common_finput.cc @@ -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; } if (suffix) { free(suffix); - suffix = 0; + suffix = nullptr; } } } diff --git a/src/bin/common_finput.hh b/src/bin/common_finput.hh index 5d0c2a879..6130ed049 100644 --- a/src/bin/common_finput.hh +++ b/src/bin/common_finput.hh @@ -59,11 +59,11 @@ public: virtual int process_formula(spot::ltl::formula f, - const char* filename = 0, int linenum = 0) = 0; + const char* filename = nullptr, int linenum = 0) = 0; virtual int process_string(const std::string& str, - const char* filename = 0, int linenum = 0); + const char* filename = nullptr, int linenum = 0); virtual int process_stream(std::istream& is, const char* filename); diff --git a/src/bin/common_output.cc b/src/bin/common_output.cc index 6819e0eb1..adbdbb55f 100644 --- a/src/bin/common_output.cc +++ b/src/bin/common_output.cc @@ -42,29 +42,31 @@ char output_terminator = '\n'; static const argp_option options[] = { - { "full-parentheses", 'p', 0, 0, + { "full-parentheses", 'p', nullptr, 0, "output fully-parenthesized formulas", -20 }, - { "spin", 's', 0, 0, "output in Spin's syntax", -20 }, - { "spot", OPT_SPOT, 0, 0, "output in Spot's syntax (default)", -20 }, - { "lbt", 'l', 0, 0, "output in LBT's syntax", -20 }, - { "wring", OPT_WRING, 0, 0, "output in Wring's syntax", -20 }, - { "utf8", '8', 0, 0, "output using UTF-8 characters", -20 }, - { "latex", OPT_LATEX, 0, 0, "output using LaTeX macros", -20 }, - { "csv-escape", OPT_CSV, 0, 0, "quote the formula for use in a CSV file", - -20 }, + { "spin", 's', nullptr, 0, "output in Spin's syntax", -20 }, + { "spot", OPT_SPOT, nullptr, 0, "output in Spot's syntax (default)", -20 }, + { "lbt", 'l', nullptr, 0, "output in LBT's syntax", -20 }, + { "wring", OPT_WRING, nullptr, 0, "output in Wring's syntax", -20 }, + { "utf8", '8', nullptr, 0, "output using UTF-8 characters", -20 }, + { "latex", OPT_LATEX, nullptr, 0, "output using LaTeX macros", -20 }, + { "csv-escape", OPT_CSV, nullptr, 0, + "quote the formula for use in a CSV file", -20 }, { "format", OPT_FORMAT, "FORMAT", 0, "specify how each line should be output (default: \"%f\")", -20 }, { "output", 'o', "FORMAT", 0, "send output to a file named FORMAT instead of standard output. The" " first formula sent to a file truncates it unless FORMAT starts" " with '>>'.", 0 }, - { "zero-terminated-output", '0', 0, 0, + { "zero-terminated-output", '0', nullptr, 0, "separate output formulas with \\0 instead of \\n " "(for use with xargs -0)", 0 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, nullptr, 0 } }; -const struct argp output_argp = { options, parse_opt_output, 0, 0, 0, 0, 0 }; +const struct argp output_argp = { options, parse_opt_output, + nullptr, nullptr, nullptr, + nullptr, nullptr }; static void @@ -204,9 +206,9 @@ namespace }; } -static formula_printer* format = 0; +static formula_printer* format = nullptr; static std::ostringstream outputname; -static formula_printer* outputnamer = 0; +static formula_printer* outputnamer = nullptr; static std::map> outputfiles; int diff --git a/src/bin/common_output.hh b/src/bin/common_output.hh index 26f305ad9..c9e00b9cc 100644 --- a/src/bin/common_output.hh +++ b/src/bin/common_output.hh @@ -46,8 +46,9 @@ stream_formula(std::ostream& out, spot::ltl::formula f, const char* filename, int linenum); void output_formula_checked(spot::ltl::formula f, - const char* filename = 0, int linenum = 0, - const char* prefix = 0, const char* suffix = 0); + const char* filename = nullptr, int linenum = 0, + const char* prefix = nullptr, + const char* suffix = nullptr); class printable_formula: @@ -78,7 +79,7 @@ public: std::ostream& print(const spot::const_twa_graph_ptr& aut, - spot::ltl::formula f = 0, + spot::ltl::formula f = nullptr, double run_time = -1.) { formula_ = f; diff --git a/src/bin/common_post.cc b/src/bin/common_post.cc index 60872c01e..0acfc79f4 100644 --- a/src/bin/common_post.cc +++ b/src/bin/common_post.cc @@ -37,45 +37,45 @@ enum { static const argp_option options[] = { /**************************************************/ - { 0, 0, 0, 0, "Translation intent:", 20 }, - { "small", OPT_SMALL, 0, 0, "prefer small automata (default)", 0 }, - { "deterministic", 'D', 0, 0, "prefer deterministic automata", 0 }, - { "any", 'a', 0, 0, "no preference, do not bother making it small " + { nullptr, 0, nullptr, 0, "Translation intent:", 20 }, + { "small", OPT_SMALL, nullptr, 0, "prefer small automata (default)", 0 }, + { "deterministic", 'D', nullptr, 0, "prefer deterministic automata", 0 }, + { "any", 'a', nullptr, 0, "no preference, do not bother making it small " "or deterministic", 0 }, - { "complete", 'C', 0, 0, "output a complete automaton (combine " + { "complete", 'C', nullptr, 0, "output a complete automaton (combine " "with other intents)", 0 }, - { "state-based-acceptance", 'S', 0, 0, + { "state-based-acceptance", 'S', nullptr, 0, "define the acceptance using states", 0 }, - { "sbacc", 0, 0, OPTION_ALIAS, 0, 0 }, + { "sbacc", 0, nullptr, OPTION_ALIAS, nullptr, 0 }, /**************************************************/ - { 0, 0, 0, 0, "Optimization level:", 21 }, - { "low", OPT_LOW, 0, 0, "minimal optimizations (fast)", 0 }, - { "medium", OPT_MEDIUM, 0, 0, "moderate optimizations", 0 }, - { "high", OPT_HIGH, 0, 0, + { nullptr, 0, nullptr, 0, "Optimization level:", 21 }, + { "low", OPT_LOW, nullptr, 0, "minimal optimizations (fast)", 0 }, + { "medium", OPT_MEDIUM, nullptr, 0, "moderate optimizations", 0 }, + { "high", OPT_HIGH, nullptr, 0, "all available optimizations (slow, default)", 0 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, nullptr, 0 } }; static const argp_option options_disabled[] = { /**************************************************/ - { 0, 0, 0, 0, "Translation intent:", 20 }, - { "small", OPT_SMALL, 0, 0, "prefer small automata", 0 }, - { "deterministic", 'D', 0, 0, "prefer deterministic automata", 0 }, - { "any", 'a', 0, 0, "no preference, do not bother making it small " + { nullptr, 0, nullptr, 0, "Translation intent:", 20 }, + { "small", OPT_SMALL, nullptr, 0, "prefer small automata", 0 }, + { "deterministic", 'D', nullptr, 0, "prefer deterministic automata", 0 }, + { "any", 'a', nullptr, 0, "no preference, do not bother making it small " "or deterministic (default)", 0 }, - { "complete", 'C', 0, 0, "output a complete automaton (combine " + { "complete", 'C', nullptr, 0, "output a complete automaton (combine " "with other intents)", 0 }, - { "state-based-acceptance", 'S', 0, 0, + { "state-based-acceptance", 'S', nullptr, 0, "define the acceptance using states", 0 }, - { "sbacc", 0, 0, OPTION_ALIAS, 0, 0 }, + { "sbacc", 0, nullptr, OPTION_ALIAS, nullptr, 0 }, /**************************************************/ - { 0, 0, 0, 0, "Optimization level:", 21 }, - { "low", OPT_LOW, 0, 0, "minimal optimizations (fast, default)", 0 }, - { "medium", OPT_MEDIUM, 0, 0, "moderate optimizations", 0 }, - { "high", OPT_HIGH, 0, 0, + { nullptr, 0, nullptr, 0, "Optimization level:", 21 }, + { "low", OPT_LOW, nullptr, 0, "minimal optimizations (fast, default)", 0 }, + { "medium", OPT_MEDIUM, nullptr, 0, "moderate optimizations", 0 }, + { "high", OPT_HIGH, nullptr, 0, "all available optimizations (slow)", 0 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, nullptr, 0 } }; static int @@ -117,7 +117,8 @@ parse_opt_post(int key, char*, struct argp_state*) return 0; } -const struct argp post_argp = - { options, parse_opt_post, 0, 0, 0, 0, 0 }; -const struct argp post_argp_disabled = - { options_disabled, parse_opt_post, 0, 0, 0, 0, 0 }; +const struct argp post_argp = { options, parse_opt_post, + nullptr, nullptr, nullptr, nullptr, nullptr }; +const struct argp post_argp_disabled = { options_disabled, parse_opt_post, + nullptr, nullptr, nullptr, + nullptr, nullptr }; diff --git a/src/bin/common_r.hh b/src/bin/common_r.hh index 97b27b7a2..9c247d636 100644 --- a/src/bin/common_r.hh +++ b/src/bin/common_r.hh @@ -1,6 +1,6 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2012 Laboratoire de Recherche et Développement de -// l'Epita (LRDE). +// Copyright (C) 2012, 2015 Laboratoire de Recherche et Développement +// de l'Epita (LRDE). // // This file is part of Spot, a model checking library. // @@ -29,15 +29,16 @@ "simplify formulas according to LEVEL (see below); LEVEL is " \ "set to 3 if omitted", 0 } -#define LEVEL_DOC(g) \ - { 0, 0, 0, 0, "The simplification LEVEL may be set as follows.", g }, \ - { " 0", 0, 0, OPTION_DOC | OPTION_NO_USAGE, \ - "No rewriting", 0 }, \ - { " 1", 0, 0, OPTION_DOC | OPTION_NO_USAGE, \ - "basic rewritings and eventual/universal rules", 0 }, \ - { " 2", 0, 0, OPTION_DOC | OPTION_NO_USAGE, \ - "additional syntactic implication rules", 0 }, \ - { " 3", 0, 0, OPTION_DOC | OPTION_NO_USAGE, \ +#define LEVEL_DOC(g) \ + { nullptr, 0, nullptr, 0, \ + "The simplification LEVEL may be set as follows.", g }, \ + { " 0", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, \ + "No rewriting", 0 }, \ + { " 1", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, \ + "basic rewritings and eventual/universal rules", 0 }, \ + { " 2", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, \ + "additional syntactic implication rules", 0 }, \ + { " 3", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, \ "better implications using containment", 0 } extern int simplification_level; diff --git a/src/bin/common_range.hh b/src/bin/common_range.hh index 10a844c45..101db4537 100644 --- a/src/bin/common_range.hh +++ b/src/bin/common_range.hh @@ -1,6 +1,6 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2012, 2014 Laboratoire de Recherche et Développement -// de l'Epita (LRDE). +// Copyright (C) 2012, 2014, 2015 Laboratoire de Recherche et +// Développement de l'Epita (LRDE). // // This file is part of Spot, a model checking library. // @@ -19,13 +19,15 @@ #pragma once -#define RANGE_DOC \ - { 0, 0, 0, 0, "RANGE may have one of the following forms: 'INT', " \ +#define RANGE_DOC \ + { nullptr, 0, nullptr, 0, \ + "RANGE may have one of the following forms: 'INT', " \ "'INT..INT', or '..INT'.\nIn the latter case, the missing number " \ "is assumed to be 1.", 0 } -#define RANGE_DOC_FULL \ - { 0, 0, 0, 0, "RANGE may have one of the following forms: 'INT', " \ +#define RANGE_DOC_FULL \ + { nullptr, 0, nullptr, 0, \ + "RANGE may have one of the following forms: 'INT', " \ "'INT..INT', '..INT', or 'INT..'", 0 } struct range diff --git a/src/bin/common_setup.cc b/src/bin/common_setup.cc index e45f18271..411890070 100644 --- a/src/bin/common_setup.cc +++ b/src/bin/common_setup.cc @@ -56,12 +56,12 @@ static void setup_sig_handler() sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESETHAND; // Catch termination signals, so we can cleanup temporary files. - sigaction(SIGALRM, &sa, 0); - sigaction(SIGHUP, &sa, 0); - sigaction(SIGINT, &sa, 0); - sigaction(SIGPIPE, &sa, 0); - sigaction(SIGQUIT, &sa, 0); - sigaction(SIGTERM, &sa, 0); + sigaction(SIGALRM, &sa, nullptr); + sigaction(SIGHUP, &sa, nullptr); + sigaction(SIGINT, &sa, nullptr); + sigaction(SIGPIPE, &sa, nullptr); + sigaction(SIGQUIT, &sa, nullptr); + sigaction(SIGTERM, &sa, nullptr); } #else # define setup_sig_handler() while (0); @@ -97,20 +97,21 @@ enum { static const argp_option options[] = { - { "version", OPT_VERSION, 0, 0, "print program version", -1 }, - { "help", OPT_HELP, 0, 0, "print this help", -1 }, + { "version", OPT_VERSION, nullptr, 0, "print program version", -1 }, + { "help", OPT_HELP, nullptr, 0, "print this help", -1 }, // We support this option just in case, but we don't advertise it. - { "usage", OPT_USAGE, 0, OPTION_HIDDEN, "show short usage", -1 }, - { 0, 0, 0, 0, 0, 0 } + { "usage", OPT_USAGE, nullptr, OPTION_HIDDEN, "show short usage", -1 }, + { nullptr, 0, nullptr, 0, nullptr, 0 } }; static const argp_option options_hidden[] = { - { "version", OPT_VERSION, 0, OPTION_HIDDEN, "print program version", -1 }, - { "help", OPT_HELP, 0, OPTION_HIDDEN, "print this help", -1 }, + { "version", OPT_VERSION, nullptr, OPTION_HIDDEN, + "print program version", -1 }, + { "help", OPT_HELP, nullptr, OPTION_HIDDEN, "print this help", -1 }, // We support this option just in case, but we don't advertise it. - { "usage", OPT_USAGE, 0, OPTION_HIDDEN, "show short usage", -1 }, - { 0, 0, 0, 0, 0, 0 } + { "usage", OPT_USAGE, nullptr, OPTION_HIDDEN, "show short usage", -1 }, + { nullptr, 0, nullptr, 0, nullptr, 0 } }; static int @@ -137,7 +138,9 @@ parse_opt_misc(int key, char*, struct argp_state* state) } -const struct argp misc_argp = { options, parse_opt_misc, 0, 0, 0, 0, 0 }; +const struct argp misc_argp = { options, parse_opt_misc, + nullptr, nullptr, nullptr, nullptr, nullptr }; const struct argp misc_argp_hidden = { options_hidden, parse_opt_misc, - 0, 0, 0, 0, 0 }; + nullptr, nullptr, nullptr, + nullptr, nullptr }; diff --git a/src/bin/common_trans.cc b/src/bin/common_trans.cc index 9fea8e351..00d2e1565 100644 --- a/src/bin/common_trans.cc +++ b/src/bin/common_trans.cc @@ -361,12 +361,12 @@ setup_sig_handler() sa.sa_handler = sig_handler; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART; // So that wait() doesn't get aborted by SIGALRM. - sigaction(SIGALRM, &sa, 0); + sigaction(SIGALRM, &sa, nullptr); // Catch termination signals, so we can kill the subprocess. - sigaction(SIGHUP, &sa, 0); - sigaction(SIGINT, &sa, 0); - sigaction(SIGQUIT, &sa, 0); - sigaction(SIGTERM, &sa, 0); + sigaction(SIGHUP, &sa, nullptr); + sigaction(SIGINT, &sa, nullptr); + sigaction(SIGQUIT, &sa, nullptr); + sigaction(SIGTERM, &sa, nullptr); } int @@ -383,7 +383,7 @@ exec_with_timeout(const char* cmd) if (child_pid == 0) { setpgid(0, 0); - execlp("sh", "sh", "-c", cmd, (char*)0); + execlp("sh", "sh", "-c", cmd, nullptr); error(2, errno, "failed to run 'sh'"); // never reached return -1; @@ -412,33 +412,33 @@ enum { static const argp_option options[] = { /**************************************************/ - { 0, 0, 0, 0, "Specifying translators to call:", 2 }, + { nullptr, 0, nullptr, 0, "Specifying translators to call:", 2 }, { "translator", 't', "COMMANDFMT", 0, "register one translator to call", 0 }, { "timeout", 'T', "NUMBER", 0, "kill translators after NUMBER seconds", 0 }, - { "list-shorthands", OPT_LIST, 0 , 0, + { "list-shorthands", OPT_LIST, nullptr, 0, "list availabled shorthands to use in COMMANDFMT", 0}, /**************************************************/ - { 0, 0, 0, 0, + { nullptr, 0, nullptr, 0, "COMMANDFMT should specify input and output arguments using the " "following character sequences:", 3 }, - { "%f,%s,%l,%w", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%f,%s,%l,%w", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the formula as a (quoted) string in Spot, Spin, LBT, or Wring's syntax", 0 }, - { "%F,%S,%L,%W", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%F,%S,%L,%W", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the formula as a file in Spot, Spin, LBT, or Wring's syntax", 0 }, - { "%O", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%O", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the automaton is output in HOA, never claim, LBTT, or ltl2dstar's " "format", 0 }, - { "%%", 0, 0, OPTION_DOC | OPTION_NO_USAGE, "a single %", 0 }, - { 0, 0, 0, 0, + { "%%", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "a single %", 0 }, + { nullptr, 0, nullptr, 0, "If either %l, %L, or %T are used, any input formula that does " "not use LBT-style atomic propositions (i.e. p0, p1, ...) will be " "relabeled automatically.\n" "Furthermore, if COMMANDFMT has the form \"{NAME}CMD\", then only CMD " "will be passed to the shell, and NAME will be used to name the tool " "in the output.", 4 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, nullptr, 0 } }; static int parse_opt_trans(int key, char* arg, struct argp_state*) @@ -464,4 +464,5 @@ static int parse_opt_trans(int key, char* arg, struct argp_state*) return 0; } -const struct argp trans_argp = { options, parse_opt_trans, 0, 0, 0, 0, 0 }; +const struct argp trans_argp = { options, parse_opt_trans, nullptr, nullptr, + nullptr, nullptr, nullptr }; diff --git a/src/bin/dstar2tgba.cc b/src/bin/dstar2tgba.cc index 1dc1993f6..09493de40 100644 --- a/src/bin/dstar2tgba.cc +++ b/src/bin/dstar2tgba.cc @@ -59,30 +59,31 @@ 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 }, - { "tgba", OPT_TGBA, 0, 0, + { nullptr, 0, nullptr, 0, "Output automaton type:", 2 }, + { "tgba", OPT_TGBA, nullptr, 0, "Transition-based Generalized Büchi Automaton (default)", 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 }, /**************************************************/ - { 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 }, - { 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, 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, 0, nullptr, 20 }, + { &misc_argp, 0, nullptr, -1 }, + { nullptr, 0, nullptr, 0 } }; static spot::option_map extra_options; @@ -150,7 +151,7 @@ namespace spot::stopwatch sw; sw.start(); auto nba = spot::to_generalized_buchi(haut->aut); - auto aut = post.run(nba, 0); + auto aut = post.run(nba, nullptr); const double conversion_time = sw.stop(); printer.print(aut, nullptr, filename, -1, conversion_time, haut); @@ -200,9 +201,9 @@ 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 }; - 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()) diff --git a/src/bin/genltl.cc b/src/bin/genltl.cc index 7cc890fcd..254b928de 100644 --- a/src/bin/genltl.cc +++ b/src/bin/genltl.cc @@ -144,13 +144,13 @@ const char* const class_name[LAST_CLASS] = }; -#define OPT_ALIAS(o) { #o, 0, 0, OPTION_ALIAS, 0, 0 } +#define OPT_ALIAS(o) { #o, 0, nullptr, OPTION_ALIAS, nullptr, 0 } static const argp_option options[] = { /**************************************************/ // Keep this alphabetically sorted (expect for aliases). - { 0, 0, 0, 0, "Pattern selection:", 1}, + { nullptr, 0, nullptr, 0, "Pattern selection:", 1}, // J. Geldenhuys and H. Hansen (Spin'06): Larger automata and less // work for LTL model checking. { "and-f", OPT_AND_F, "RANGE", 0, "F(p1)&F(p2)&...&F(pn)", 0 }, @@ -194,19 +194,19 @@ static const argp_option options[] = OPT_ALIAS(go-phi), RANGE_DOC, /**************************************************/ - { 0, 0, 0, 0, "Output options:", -20 }, - { 0, 0, 0, 0, "The FORMAT string passed to --format may use "\ + { nullptr, 0, nullptr, 0, "Output options:", -20 }, + { nullptr, 0, nullptr, 0, "The FORMAT string passed to --format may use " "the following interpreted sequences:", -19 }, - { "%f", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%f", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the formula (in the selected syntax)", 0 }, - { "%F", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%F", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the name of the pattern", 0 }, - { "%L", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%L", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the argument of the pattern", 0 }, - { "%%", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%%", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "a single %", 0 }, - { 0, 0, 0, 0, "Miscellaneous options:", -1 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, "Miscellaneous options:", -1 }, + { nullptr, 0, nullptr, 0, nullptr, 0 } }; struct job @@ -221,9 +221,9 @@ static jobs_t jobs; const struct argp_child children[] = { - { &output_argp, 0, 0, -20 }, - { &misc_argp, 0, 0, -1 }, - { 0, 0, 0, 0 } + { &output_argp, 0, nullptr, -20 }, + { &misc_argp, 0, nullptr, -1 }, + { nullptr, 0, nullptr, 0 } }; static void @@ -819,10 +819,10 @@ main(int argc, char** argv) { setup(argv); - const argp ap = { options, parse_opt, 0, argp_program_doc, - children, 0, 0 }; + const argp ap = { options, parse_opt, nullptr, 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); if (jobs.empty()) diff --git a/src/bin/ltl2tgba.cc b/src/bin/ltl2tgba.cc index bcea09c5e..2b8ab34a6 100644 --- a/src/bin/ltl2tgba.cc +++ b/src/bin/ltl2tgba.cc @@ -54,32 +54,33 @@ enum { static const argp_option options[] = { /**************************************************/ - { 0, 0, 0, 0, "Output automaton type:", 2 }, - { "tgba", OPT_TGBA, 0, 0, + { nullptr, 0, nullptr, 0, "Output automaton type:", 2 }, + { "tgba", OPT_TGBA, nullptr, 0, "Transition-based Generalized Büchi Automaton (default)", 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 formula)", 0 }, /**************************************************/ - { "%f", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%f", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the formula, in Spot's syntax", 4 }, /**************************************************/ - { "unambiguous", 'U', 0, 0, "output unambiguous automata " + { "unambiguous", 'U', nullptr, 0, "output unambiguous automata " "(combine with other intents)", 20 }, - { 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 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, nullptr, 0 } }; const struct argp_child children[] = { - { &finput_argp, 0, 0, 1 }, - { &aoutput_argp, 0, 0, 0 }, - { &aoutput_o_format_argp, 0, 0, 0 }, - { &post_argp, 0, 0, 0 }, - { &misc_argp, 0, 0, -1 }, - { 0, 0, 0, 0 } + { &finput_argp, 0, nullptr, 1 }, + { &aoutput_argp, 0, nullptr, 0 }, + { &aoutput_o_format_argp, 0, nullptr, 0 }, + { &post_argp, 0, nullptr, 0 }, + { &misc_argp, 0, nullptr, -1 }, + { nullptr, 0, nullptr, 0 } }; static spot::option_map extra_options; @@ -139,7 +140,7 @@ namespace int process_formula(spot::ltl::formula f, - const char* filename = 0, int linenum = 0) + const char* filename = nullptr, int linenum = 0) { // This should not happen, because the parser we use can only // read PSL/LTL formula, but since our ltl::formula type can @@ -173,11 +174,11 @@ main(int argc, char** argv) setup(argv); const argp ap = { options, parse_opt, "[FORMULA...]", - argp_program_doc, children, 0, 0 }; + argp_program_doc, children, nullptr, nullptr }; simplification_level = 3; - 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()) diff --git a/src/bin/ltl2tgta.cc b/src/bin/ltl2tgta.cc index 7f7280df9..338c70238 100644 --- a/src/bin/ltl2tgta.cc +++ b/src/bin/ltl2tgta.cc @@ -64,35 +64,35 @@ enum { static const argp_option options[] = { /**************************************************/ - { 0, 0, 0, 0, "Automaton type:", 1 }, - { "tgta", OPT_TGTA, 0, 0, + { nullptr, 0, nullptr, 0, "Automaton type:", 1 }, + { "tgta", OPT_TGTA, nullptr, 0, "Transition-based Generalized Testing Automaton (default)", 0 }, - { "ta", OPT_TA, 0, 0, "Testing Automaton", 0 }, - { "gta", OPT_GTA, 0, 0, "Generalized Testing Automaton", 0 }, + { "ta", OPT_TA, nullptr, 0, "Testing Automaton", 0 }, + { "gta", OPT_GTA, nullptr, 0, "Generalized Testing Automaton", 0 }, /**************************************************/ - { 0, 0, 0, 0, "Options for TA and GTA creation:", 3 }, - { "single-pass-lv", OPT_SPLV, 0, 0, + { nullptr, 0, nullptr, 0, "Options for TA and GTA creation:", 3 }, + { "single-pass-lv", OPT_SPLV, nullptr, 0, "add an artificial livelock state to obtain a single-pass (G)TA", 0 }, - { "single-pass", OPT_SPNO, 0, 0, + { "single-pass", OPT_SPNO, nullptr, 0, "create a single-pass (G)TA without artificial livelock state", 0 }, - { "multiple-init", OPT_INIT, 0, 0, + { "multiple-init", OPT_INIT, nullptr, 0, "do not create the fake initial state", 0 }, /**************************************************/ - { 0, 0, 0, 0, "Output options:", 4 }, - { "utf8", '8', 0, 0, "enable UTF-8 characters in output", 0 }, + { nullptr, 0, nullptr, 0, "Output options:", 4 }, + { "utf8", '8', nullptr, 0, "enable UTF-8 characters in output", 0 }, /**************************************************/ - { 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 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, nullptr, 0 } }; const struct argp_child children[] = { - { &finput_argp, 0, 0, 1 }, - { &post_argp, 0, 0, 20 }, - { &misc_argp, 0, 0, -1 }, - { 0, 0, 0, 0 } + { &finput_argp, 0, nullptr, 1 }, + { &post_argp, 0, nullptr, 20 }, + { &misc_argp, 0, nullptr, -1 }, + { nullptr, 0, nullptr, 0 } }; enum ta_types { TGTA, GTA, TA }; @@ -171,7 +171,7 @@ namespace int process_formula(spot::ltl::formula f, - const char* filename = 0, int linenum = 0) + const char* filename = nullptr, int linenum = 0) { auto aut = trans.run(&f); @@ -219,11 +219,11 @@ main(int argc, char** argv) setup(argv); const argp ap = { options, parse_opt, "[FORMULA...]", - argp_program_doc, children, 0, 0 }; + argp_program_doc, children, nullptr, nullptr }; simplification_level = 3; - 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()) diff --git a/src/bin/ltlcross.cc b/src/bin/ltlcross.cc index 5c7ba6fa6..3972d9b48 100644 --- a/src/bin/ltlcross.cc +++ b/src/bin/ltlcross.cc @@ -99,22 +99,22 @@ enum { static const argp_option options[] = { /**************************************************/ - { 0, 0, 0, 0, "ltlcross behavior:", 5 }, - { "allow-dups", OPT_DUPS, 0, 0, + { nullptr, 0, nullptr, 0, "ltlcross behavior:", 5 }, + { "allow-dups", OPT_DUPS, nullptr, 0, "translate duplicate formulas in input", 0 }, - { "no-checks", OPT_NOCHECKS, 0, 0, + { "no-checks", OPT_NOCHECKS, nullptr, 0, "do not perform any sanity checks (negated formulas " "will not be translated)", 0 }, - { "no-complement", OPT_NOCOMP, 0, 0, + { "no-complement", OPT_NOCOMP, nullptr, 0, "do not complement deterministic automata to perform extra checks", 0 }, - { "stop-on-error", OPT_STOP_ERR, 0, 0, + { "stop-on-error", OPT_STOP_ERR, nullptr, 0, "stop on first execution error or failure to pass" " sanity checks (timeouts are OK)", 0 }, - { "ignore-execution-failures", OPT_IGNORE_EXEC_FAIL, 0, 0, + { "ignore-execution-failures", OPT_IGNORE_EXEC_FAIL, nullptr, 0, "ignore automata from translators that return with a non-zero exit code," " but do not flag this as an error", 0 }, /**************************************************/ - { 0, 0, 0, 0, "State-space generation:", 6 }, + { nullptr, 0, nullptr, 0, "State-space generation:", 6 }, { "states", OPT_STATES, "INT", 0, "number of the states in the state-spaces (200 by default)", 0 }, { "density", OPT_DENSITY, "FLOAT", 0, @@ -126,19 +126,19 @@ static const argp_option options[] = "number of products to perform (1 by default), statistics will be " "averaged unless the number is prefixed with '+'", 0 }, /**************************************************/ - { 0, 0, 0, 0, "Statistics output:", 7 }, + { nullptr, 0, nullptr, 0, "Statistics output:", 7 }, { "json", OPT_JSON, "[>>]FILENAME", OPTION_ARG_OPTIONAL, "output statistics as JSON in FILENAME or on standard output", 0 }, { "csv", OPT_CSV, "[>>]FILENAME", OPTION_ARG_OPTIONAL, "output statistics as CSV in FILENAME or on standard output " "(if '>>' is used to request append mode, the header line is " "not output)", 0 }, - { "omit-missing", OPT_OMIT, 0, 0, + { "omit-missing", OPT_OMIT, nullptr, 0, "do not output statistics for timeouts or failed translations", 0 }, - { "automata", OPT_AUTOMATA, 0, 0, + { "automata", OPT_AUTOMATA, nullptr, 0, "store automata (in the HOA format) into the CSV or JSON output", 0 }, /**************************************************/ - { 0, 0, 0, 0, "Miscellaneous options:", -2 }, + { nullptr, 0, nullptr, 0, "Miscellaneous options:", -2 }, { "color", OPT_COLOR, "WHEN", OPTION_ARG_OPTIONAL, "colorize output; WHEN can be 'never', 'always' (the default if " "--color is used without argument), or " @@ -148,19 +148,20 @@ static const argp_option options[] = "formula that fails on the same test in FILENAME", 0 }, { "save-bogus", OPT_BOGUS, "[>>]FILENAME", 0, "save formulas for which problems were detected in FILENAME", 0 }, - { "verbose", OPT_VERBOSE, 0, 0, + { "verbose", OPT_VERBOSE, nullptr, 0, "print what is being done, for debugging", 0 }, - { 0, 0, 0, 0, "If an output FILENAME is prefixed with '>>', is it open " + { nullptr, 0, nullptr, 0, + "If an output FILENAME is prefixed with '>>', is it open " "in append mode instead of being truncated.", -1 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, nullptr, 0 } }; const struct argp_child children[] = { - { &finput_argp, 0, 0, 1 }, - { &trans_argp, 0, 0, 0 }, - { &misc_argp, 0, 0, -2 }, - { 0, 0, 0, 0 } + { &finput_argp, 0, nullptr, 1 }, + { &trans_argp, 0, nullptr, 0 }, + { &misc_argp, 0, nullptr, -2 }, + { nullptr, 0, nullptr, 0 } }; enum color_type { color_never, color_always, color_if_tty }; @@ -169,7 +170,7 @@ static char const *const color_args[] = { "always", "yes", "force", "never", "no", "none", - "auto", "tty", "if-tty", 0 + "auto", "tty", "if-tty", nullptr }; static color_type const color_types[] = { @@ -187,8 +188,8 @@ static const char* reset_color = "\033[m"; static unsigned states = 200; static float density = 0.1; -static const char* json_output = 0; -static const char* csv_output = 0; +static const char* json_output = nullptr; +static const char* csv_output = nullptr; static bool want_stats = false; static bool allow_dups = false; static bool no_checks = false; @@ -198,9 +199,9 @@ static int seed = 0; static unsigned products = 1; static bool products_avg = true; static bool opt_omit = false; -static const char* bogus_output_filename = 0; -static output_file* bogus_output = 0; -static output_file* grind_output = 0; +static const char* bogus_output_filename = nullptr; +static output_file* bogus_output = nullptr; +static output_file* grind_output = nullptr; static bool verbose = false; static bool ignore_exec_fail = false; static unsigned ignored_exec_fail = 0; @@ -239,7 +240,7 @@ struct statistics { statistics() : ok(false), - status_str(0), + status_str(nullptr), status_code(0), time(0), states(0), @@ -499,9 +500,9 @@ namespace int es = exec_with_timeout(cmd.c_str()); double duration = sw.stop(); - const char* status_str = 0; + const char* status_str = nullptr; - spot::twa_graph_ptr res = 0; + spot::twa_graph_ptr res = nullptr; if (timed_out) { // This is not considered to be a global error. @@ -938,7 +939,7 @@ namespace int process_formula(spot::ltl::formula f, - const char* filename = 0, int linenum = 0) + const char* filename = nullptr, int linenum = 0) { static unsigned round = 0; @@ -998,7 +999,7 @@ namespace unsigned n = vstats.size(); vstats.resize(n + (no_checks ? 1 : 2)); statistics_formula* pstats = &vstats[n]; - statistics_formula* nstats = 0; + statistics_formula* nstats = nullptr; pstats->resize(m); formulas.push_back(fstr); @@ -1380,9 +1381,9 @@ main(int argc, char** argv) setup(argv); const argp ap = { options, parse_opt, "[COMMANDFMT...]", - argp_program_doc, children, 0, 0 }; + 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); if (jobs.empty()) diff --git a/src/bin/ltldo.cc b/src/bin/ltldo.cc index f535834b2..b93a47c48 100644 --- a/src/bin/ltldo.cc +++ b/src/bin/ltldo.cc @@ -49,20 +49,20 @@ of input and output as required."; static const argp_option options[] = { - { 0, 0, 0, 0, "Miscellaneous options:", -1 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, "Miscellaneous options:", -1 }, + { nullptr, 0, nullptr, 0, nullptr, 0 } }; static const argp_option more_o_format[] = { - { "%R", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%R", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "serial number of the formula translated", 0 }, - { "%T", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%T", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "tool used for translation", 0 }, - { "%f", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%f", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "formula translated", 0 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, nullptr, 0 } }; // This is not very elegant, but we need to add the above %-escape @@ -87,18 +87,18 @@ build_percent_list() memcpy(d + count, more_o_format, sizeof(more_o_format)); static const struct argp more_o_format_argp = - { d, 0, 0, 0, 0, 0, 0 }; + { d, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; return &more_o_format_argp; } const struct argp_child children[] = { - { &finput_argp, 0, 0, 1 }, - { &trans_argp, 0, 0, 3 }, - { &aoutput_argp, 0, 0, 4 }, - { build_percent_list(), 0, 0, 5 }, - { &misc_argp, 0, 0, -1 }, - { 0, 0, 0, 0 } + { &finput_argp, 0, nullptr, 1 }, + { &trans_argp, 0, nullptr, 3 }, + { &aoutput_argp, 0, nullptr, 4 }, + { build_percent_list(), 0, nullptr, 5 }, + { &misc_argp, 0, nullptr, -1 }, + { nullptr, 0, nullptr, 0 } }; static int @@ -256,7 +256,7 @@ namespace int process_formula(spot::ltl::formula f, - const char* filename = 0, int linenum = 0) + const char* filename = nullptr, int linenum = 0) { std::unique_ptr relmap; @@ -306,13 +306,13 @@ main(int argc, char** argv) setup(argv); const argp ap = { options, parse_opt, "[COMMANDFMT...]", - argp_program_doc, children, 0, 0 }; + argp_program_doc, children, nullptr, nullptr }; // Disable post-processing as much as possible by default. 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()) diff --git a/src/bin/ltlfilt.cc b/src/bin/ltlfilt.cc index 54e9b9abe..e753f51d9 100644 --- a/src/bin/ltlfilt.cc +++ b/src/bin/ltlfilt.cc @@ -96,17 +96,18 @@ enum { static const argp_option options[] = { /**************************************************/ - { 0, 0, 0, 0, "Error handling:", 2 }, - { "skip-errors", OPT_SKIP_ERRORS, 0, 0, + { nullptr, 0, nullptr, 0, "Error handling:", 2 }, + { "skip-errors", OPT_SKIP_ERRORS, nullptr, 0, "output erroneous lines as-is without processing", 0 }, - { "drop-errors", OPT_DROP_ERRORS, 0, 0, + { "drop-errors", OPT_DROP_ERRORS, nullptr, 0, "discard erroneous lines (default)", 0 }, - { "ignore-errors", OPT_IGNORE_ERRORS, 0, 0, + { "ignore-errors", OPT_IGNORE_ERRORS, nullptr, 0, "do not report syntax errors", 0 }, /**************************************************/ - { 0, 0, 0, 0, "Transformation options:", 3 }, - { "negate", OPT_NEGATE, 0, 0, "negate each formula", 0 }, - { "nnf", OPT_NNF, 0, 0, "rewrite formulas in negative normal form", 0 }, + { nullptr, 0, nullptr, 0, "Transformation options:", 3 }, + { "negate", OPT_NEGATE, nullptr, 0, "negate each formula", 0 }, + { "nnf", OPT_NNF, nullptr, 0, + "rewrite formulas in negative normal form", 0 }, { "relabel", OPT_RELABEL, "abc|pnn", OPTION_ARG_OPTIONAL, "relabel all atomic propositions, alphabetically unless " \ "specified otherwise", 0 }, @@ -116,13 +117,13 @@ static const argp_option options[] = { "define", OPT_DEFINE, "FILENAME", OPTION_ARG_OPTIONAL, "when used with --relabel or --relabel-bool, output the relabeling map " "using #define statements", 0 }, - { "remove-wm", OPT_REMOVE_WM, 0, 0, + { "remove-wm", OPT_REMOVE_WM, nullptr, 0, "rewrite operators W and M using U and R (this is an alias for " "--unabbreviate=WM)", 0 }, - { "boolean-to-isop", OPT_BOOLEAN_TO_ISOP, 0, 0, + { "boolean-to-isop", OPT_BOOLEAN_TO_ISOP, nullptr, 0, "rewrite Boolean subformulas as irredundant sum of products " "(implies at least -r1)", 0 }, - { "remove-x", OPT_REMOVE_X, 0, 0, + { "remove-x", OPT_REMOVE_X, nullptr, 0, "remove X operators (valid only for stutter-insensitive properties)", 0 }, { "unabbreviate", OPT_UNABBREVIATE, "STR", OPTION_ARG_OPTIONAL, @@ -138,30 +139,32 @@ static const argp_option options[] = DECLARE_OPT_R, LEVEL_DOC(4), /**************************************************/ - { 0, 0, 0, 0, + { nullptr, 0, nullptr, 0, "Filtering options (matching is done after transformation):", 5 }, - { "ltl", OPT_LTL, 0, 0, "match only LTL formulas (no PSL operator)", 0 }, - { "boolean", OPT_BOOLEAN, 0, 0, "match Boolean formulas", 0 }, - { "eventual", OPT_EVENTUAL, 0, 0, "match pure eventualities", 0 }, - { "universal", OPT_UNIVERSAL, 0, 0, "match purely universal formulas", 0 }, - { "syntactic-safety", OPT_SYNTACTIC_SAFETY, 0, 0, + { "ltl", OPT_LTL, nullptr, 0, + "match only LTL formulas (no PSL operator)", 0 }, + { "boolean", OPT_BOOLEAN, nullptr, 0, "match Boolean formulas", 0 }, + { "eventual", OPT_EVENTUAL, nullptr, 0, "match pure eventualities", 0 }, + { "universal", OPT_UNIVERSAL, nullptr, 0, + "match purely universal formulas", 0 }, + { "syntactic-safety", OPT_SYNTACTIC_SAFETY, nullptr, 0, "match syntactic-safety formulas", 0 }, - { "syntactic-guarantee", OPT_SYNTACTIC_GUARANTEE, 0, 0, + { "syntactic-guarantee", OPT_SYNTACTIC_GUARANTEE, nullptr, 0, "match syntactic-guarantee formulas", 0 }, - { "syntactic-obligation", OPT_SYNTACTIC_OBLIGATION, 0, 0, + { "syntactic-obligation", OPT_SYNTACTIC_OBLIGATION, nullptr, 0, "match syntactic-obligation formulas", 0 }, - { "syntactic-recurrence", OPT_SYNTACTIC_RECURRENCE, 0, 0, + { "syntactic-recurrence", OPT_SYNTACTIC_RECURRENCE, nullptr, 0, "match syntactic-recurrence formulas", 0 }, - { "syntactic-persistence", OPT_SYNTACTIC_PERSISTENCE, 0, 0, + { "syntactic-persistence", OPT_SYNTACTIC_PERSISTENCE, nullptr, 0, "match syntactic-persistence formulas", 0 }, - { "syntactic-stutter-invariant", OPT_SYNTACTIC_SI, 0, 0, + { "syntactic-stutter-invariant", OPT_SYNTACTIC_SI, nullptr, 0, "match stutter-invariant formulas syntactically (LTL-X or siPSL)", 0 }, - { "nox", 0, 0, OPTION_ALIAS, 0, 0 }, - { "safety", OPT_SAFETY, 0, 0, + { "nox", 0, nullptr, OPTION_ALIAS, nullptr, 0 }, + { "safety", OPT_SAFETY, nullptr, 0, "match safety formulas (even pathological)", 0 }, - { "guarantee", OPT_GUARANTEE, 0, 0, + { "guarantee", OPT_GUARANTEE, nullptr, 0, "match guarantee formulas (even pathological)", 0 }, - { "obligation", OPT_OBLIGATION, 0, 0, + { "obligation", OPT_OBLIGATION, nullptr, 0, "match obligation formulas (even pathological)", 0 }, { "size-max", OPT_SIZE_MAX, "INT", 0, "match formulas with size <= INT", 0 }, @@ -177,45 +180,45 @@ static const argp_option options[] = "match formulas implying FORMULA", 0 }, { "equivalent-to", OPT_EQUIVALENT_TO, "FORMULA", 0, "match formulas equivalent to FORMULA", 0 }, - { "stutter-insensitive", OPT_STUTTER_INSENSITIVE, 0, 0, + { "stutter-insensitive", OPT_STUTTER_INSENSITIVE, nullptr, 0, "match stutter-insensitive LTL formulas", 0 }, - { "stutter-invariant", 0, 0, OPTION_ALIAS, 0, 0 }, + { "stutter-invariant", 0, nullptr, OPTION_ALIAS, nullptr, 0 }, { "ap", OPT_AP_N, "N", 0, "match formulas which use exactly N atomic propositions", 0 }, - { "invert-match", 'v', 0, 0, "select non-matching formulas", 0}, - { "unique", 'u', 0, 0, + { "invert-match", 'v', nullptr, 0, "select non-matching formulas", 0}, + { "unique", 'u', nullptr, 0, "drop formulas that have already been output (not affected by -v)", 0 }, /**************************************************/ - { 0, 0, 0, 0, "Output options:", -20 }, - { "count", 'c', 0, 0, "print only a count of matched formulas", 0 }, - { "quiet", 'q', 0, 0, "suppress all normal output", 0 }, + { nullptr, 0, nullptr, 0, "Output options:", -20 }, + { "count", 'c', nullptr, 0, "print only a count of matched formulas", 0 }, + { "quiet", 'q', nullptr, 0, "suppress all normal output", 0 }, { "max-count", 'n', "NUM", 0, "output at most NUM formulas", 0 }, - { 0, 0, 0, 0, "The FORMAT string passed to --format may use "\ + { nullptr, 0, nullptr, 0, "The FORMAT string passed to --format may use "\ "the following interpreted sequences:", -19 }, - { "%f", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%f", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the formula (in the selected syntax)", 0 }, - { "%F", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%F", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the name of the input file", 0 }, - { "%L", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%L", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the original line number in the input file", 0 }, - { "%<", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%<", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the part of the line before the formula if it " "comes from a column extracted from a CSV file", 0 }, - { "%>", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%>", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the part of the line after the formula if it " "comes from a column extracted from a CSV file", 0 }, - { "%%", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%%", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "a single %", 0 }, - { 0, 0, 0, 0, "Miscellaneous options:", -1 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, "Miscellaneous options:", -1 }, + { nullptr, 0, nullptr, 0, nullptr, 0 } }; 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 } }; static bool one_match = false; @@ -453,7 +456,7 @@ namespace int process_string(const std::string& input, - const char* filename = 0, int linenum = 0) + const char* filename = nullptr, int linenum = 0) { spot::ltl::parse_error_list pel; spot::ltl::formula f = parse_formula(input, pel); @@ -487,7 +490,7 @@ namespace int process_formula(spot::ltl::formula f, - const char* filename = 0, int linenum = 0) + const char* filename = nullptr, int linenum = 0) { if (opt_max_count >= 0 && match_count >= opt_max_count) { @@ -626,11 +629,11 @@ main(int argc, char** argv) setup(argv); const argp ap = { options, parse_opt, "[FILENAME[/COL]...]", - argp_program_doc, children, 0, 0 }; + argp_program_doc, children, nullptr, nullptr }; try { - 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()) diff --git a/src/bin/ltlgrind.cc b/src/bin/ltlgrind.cc index f640e4024..946ec2a15 100644 --- a/src/bin/ltlgrind.cc +++ b/src/bin/ltlgrind.cc @@ -51,43 +51,43 @@ static const char * argp_program_doc = "List formulas that are similar to but simpler than a given formula."; static const argp_option options[] = { - {0, 0, 0, 0, "Mutation rules (all enabled unless those options are used):", - 15}, - {"ap-to-const", OPT_AP2CONST, 0, 0, + {nullptr, 0, nullptr, 0, + "Mutation rules (all enabled unless those options are used):", 15}, + {"ap-to-const", OPT_AP2CONST, nullptr, 0, "atomic propositions are replaced with true/false", 15}, - {"remove-one-ap", OPT_REMOVE_ONE_AP, 0, 0, + {"remove-one-ap", OPT_REMOVE_ONE_AP, nullptr, 0, "all occurrences of an atomic proposition are replaced with another " \ "atomic proposition used in the formula", 15}, - {"remove-multop-operands", OPT_REMOVE_MULTOP_OPERANDS, 0, 0, + {"remove-multop-operands", OPT_REMOVE_MULTOP_OPERANDS, nullptr, 0, "remove one operand from multops", 15}, - {"remove-ops", OPT_REMOVE_OPS, 0, 0, + {"remove-ops", OPT_REMOVE_OPS, nullptr, 0, "replace unary/binary operators with one of their operands", 15}, - {"split-ops", OPT_SPLIT_OPS, 0, 0, + {"split-ops", OPT_SPLIT_OPS, nullptr, 0, "when an operator can be expressed as a conjunction/disjunction using " \ "simpler operators, each term of the conjunction/disjunction is a " \ "mutation. e.g. a <-> b can be written as ((a & b) | (!a & !b)) or as " \ "((a -> b) & (b -> a)) so those four terms can be a mutation of a <-> b", 0}, - {"rewrite-ops", OPT_REWRITE_OPS, 0, 0, + {"rewrite-ops", OPT_REWRITE_OPS, nullptr, 0, "rewrite operators that have a semantically simpler form: a U b becomes " \ "a W b, etc.", 0}, - {"simplify-bounds", OPT_SIMPLIFY_BOUNDS, 0, 0, + {"simplify-bounds", OPT_SIMPLIFY_BOUNDS, nullptr, 0, "on a bounded unary operator, decrement one of the bounds, or set min to " \ "0 or max to unbounded", 15}, - {0, 0, 0, 0, "Output options:", 20}, + {nullptr, 0, nullptr, 0, "Output options:", 20}, {"max-count", 'n', "NUM", 0, "maximum number of mutations to output", 20}, {"mutations", 'm', "NUM", 0, "number of mutations to apply to the " \ "formulae (default: 1)", 0}, - {"sort", OPT_SORT, 0, 0, "sort the result by formula size", 0}, - {0, 0, 0, 0, "Miscellaneous options:", -1}, - {0, 0, 0, 0, 0, 0} + {"sort", OPT_SORT, nullptr, 0, "sort the result by formula size", 0}, + {nullptr, 0, nullptr, 0, "Miscellaneous options:", -1}, + {nullptr, 0, nullptr, 0, nullptr, 0} }; static const argp_child children[] = { - {&finput_argp, 0, 0, 10}, - {&output_argp, 0, 0, 20}, - {&misc_argp, 0, 0, -1}, - {0, 0, 0, 0} + {&finput_argp, 0, nullptr, 10}, + {&output_argp, 0, nullptr, 20}, + {&misc_argp, 0, nullptr, -1}, + {nullptr, 0, nullptr, 0} }; namespace @@ -96,7 +96,7 @@ namespace { public: int - process_formula(spot::ltl::formula f, const char *filename = 0, + process_formula(spot::ltl::formula f, const char* filename = nullptr, int linenum = 0) { auto mutations = @@ -161,9 +161,10 @@ main(int argc, char* argv[]) { setup(argv); - const argp ap = { options, parse_opt, 0, argp_program_doc, children, 0, 0 }; + const argp ap = { options, parse_opt, nullptr, 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); mut_opts |= opt_all; diff --git a/src/bin/randaut.cc b/src/bin/randaut.cc index 1ace59c57..a0b2e200c 100644 --- a/src/bin/randaut.cc +++ b/src/bin/randaut.cc @@ -74,31 +74,32 @@ enum { static const argp_option options[] = { /**************************************************/ - { 0, 0, 0, 0, "Generation:", 1 }, + { nullptr, 0, nullptr, 0, "Generation:", 1 }, { "acceptance", 'A', "ACCEPTANCE", 0, "specify the acceptance type of the automaton", 0 }, { "acc-probability", 'a', "FLOAT", 0, "probability that an edge belongs to one acceptance set (0.2)", 0 }, { "automata", 'n', "INT", 0, "number of automata to output (1)\n"\ "use a negative value for unbounded generation", 0 }, - { "ba", 'B', 0, 0, + { "ba", 'B', nullptr, 0, "build a Buchi automaton (implies --acceptance=Buchi --state-acc)", 0 }, - { "colored", OPT_COLORED, 0, 0, + { "colored", OPT_COLORED, nullptr, 0, "build an automaton in which each edge (or state if combined with " "-S) belong to a single acceptance set", 0 }, { "density", 'd', "FLOAT", 0, "density of the edges (0.2)", 0 }, - { "deterministic", 'D', 0, 0, "build a complete, deterministic automaton ", - 0 }, - { "unique", 'u', 0, 0, + { "deterministic", 'D', nullptr, 0, + "build a complete, deterministic automaton ", 0 }, + { "unique", 'u', nullptr, 0, "do not output the same automaton twice (same in the sense that they "\ "are isomorphic)", 0 }, { "seed", OPT_SEED, "INT", 0, "seed for the random number generator (0)", 0 }, { "states", 'Q', "RANGE", 0, "number of states to output (10)", 0 }, - { "state-based-acceptance", 'S', 0, 0, "used state-based acceptance", 0 }, - { "sbacc", 0, 0, OPTION_ALIAS, 0, 0 }, + { "state-based-acceptance", 'S', nullptr, 0, + "used state-based acceptance", 0 }, + { "sbacc", 0, nullptr, OPTION_ALIAS, nullptr, 0 }, RANGE_DOC, - { 0, 0, 0, 0, "ACCEPTANCE may be either a RANGE (in which case " + { nullptr, 0, nullptr, 0, "ACCEPTANCE may be either a RANGE (in which case " "generalized Büchi is assumed), or an arbitrary acceptance formula " "such as 'Fin(0)|Inf(1)&Fin(2)' in the same syntax as in the HOA " "format, or one of the following patterns:\n" @@ -118,17 +119,17 @@ static const argp_option options[] = "unless a probability (to reuse the set again every time it is used) " "is given.", 2 }, /**************************************************/ - { 0, 0, 0, 0, "Miscellaneous options:", -1 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, "Miscellaneous options:", -1 }, + { nullptr, 0, nullptr, 0, nullptr, 0 } }; static const struct argp_child children[] = { - { &aoutput_argp, 0, 0, 3 }, - { &aoutput_o_format_argp, 0, 0, 4 }, - { &misc_argp, 0, 0, -1 }, - { 0, 0, 0, 0 } + { &aoutput_argp, 0, nullptr, 3 }, + { &aoutput_o_format_argp, 0, nullptr, 4 }, + { &misc_argp, 0, nullptr, -1 }, + { nullptr, 0, nullptr, 0 } }; static const char* opt_acceptance = nullptr; @@ -269,9 +270,9 @@ main(int argc, char** argv) setup(argv); const argp ap = { options, parse_opt, "N|PROP...", argp_program_doc, - children, 0, 0 }; + 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); // running 'randaut 0' is one way to generate automata using no diff --git a/src/bin/randltl.cc b/src/bin/randltl.cc index 620661c48..d700f004b 100644 --- a/src/bin/randltl.cc +++ b/src/bin/randltl.cc @@ -74,14 +74,14 @@ static const argp_option options[] = { // Keep this alphabetically sorted (expect for aliases). /**************************************************/ - { 0, 0, 0, 0, "Type of formula to generate:", 1 }, - { "boolean", 'B', 0, 0, "generate Boolean formulas", 0 }, - { "ltl", 'L', 0, 0, "generate LTL formulas (default)", 0 }, - { "sere", 'S', 0, 0, "generate SERE", 0 }, - { "psl", 'P', 0, 0, "generate PSL formulas", 0 }, + { nullptr, 0, nullptr, 0, "Type of formula to generate:", 1 }, + { "boolean", 'B', nullptr, 0, "generate Boolean formulas", 0 }, + { "ltl", 'L', nullptr, 0, "generate LTL formulas (default)", 0 }, + { "sere", 'S', nullptr, 0, "generate SERE", 0 }, + { "psl", 'P', nullptr, 0, "generate PSL formulas", 0 }, /**************************************************/ - { 0, 0, 0, 0, "Generation:", 2 }, - { "weak-fairness", OPT_WF, 0, 0, + { nullptr, 0, nullptr, 0, "Generation:", 2 }, + { "weak-fairness", OPT_WF, nullptr, 0, "append some weak-fairness conditions", 0 }, { "formulas", 'n', "INT", 0, "number of formulas to output (1)\n"\ "use a negative value for unbounded generation", 0 }, @@ -90,14 +90,14 @@ static const argp_option options[] = { "tree-size", OPT_TREE_SIZE, "RANGE", 0, "tree size of the formulas generated, before mandatory "\ "trivial simplifications (15)", 0 }, - { "allow-dups", OPT_DUPS, 0, 0, + { "allow-dups", OPT_DUPS, nullptr, 0, "allow duplicate formulas to be output", 0 }, DECLARE_OPT_R, RANGE_DOC, LEVEL_DOC(3), /**************************************************/ - { 0, 0, 0, 0, "Adjusting probabilities:", 4 }, - { "dump-priorities", OPT_DUMP_PRIORITIES, 0, 0, + { nullptr, 0, nullptr, 0, "Adjusting probabilities:", 4 }, + { "dump-priorities", OPT_DUMP_PRIORITIES, nullptr, 0, "show current priorities, do not generate any formula", 0 }, { "ltl-priorities", OPT_LTL_PRIORITIES, "STRING", 0, "set priorities for LTL formulas", 0 }, @@ -105,36 +105,36 @@ static const argp_option options[] = "set priorities for SERE formulas", 0 }, { "boolean-priorities", OPT_BOOLEAN_PRIORITIES, "STRING", 0, "set priorities for Boolean formulas", 0 }, - { 0, 0, 0, 0, "STRING should be a comma-separated list of " + { nullptr, 0, nullptr, 0, "STRING should be a comma-separated list of " "assignments, assigning integer priorities to the tokens " "listed by --dump-priorities.", 0 }, /**************************************************/ - { 0, 0, 0, 0, "Output options:", -20 }, - { 0, 0, 0, 0, "The FORMAT string passed to --format may use "\ + { nullptr, 0, nullptr, 0, "Output options:", -20 }, + { nullptr, 0, nullptr, 0, "The FORMAT string passed to --format may use " "the following interpreted sequences:", -19 }, - { "%f", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%f", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the formula (in the selected syntax)", 0 }, - { "%L", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%L", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "the (serial) number of the formula", 0 }, - { "%%", 0, 0, OPTION_DOC | OPTION_NO_USAGE, + { "%%", 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, "a single %", 0 }, - { 0, 0, 0, 0, "Miscellaneous options:", -1 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, "Miscellaneous options:", -1 }, + { nullptr, 0, nullptr, 0, nullptr, 0 } }; const struct argp_child children[] = { - { &output_argp, 0, 0, -20 }, - { &misc_argp, 0, 0, -1 }, - { 0, 0, 0, 0 } + { &output_argp, 0, nullptr, -20 }, + { &misc_argp, 0, nullptr, -1 }, + { nullptr, 0, nullptr, 0 } }; spot::ltl::atomic_prop_set aprops; static int output = OUTPUTLTL; -static char* opt_pL = 0; -static char* opt_pS = 0; -static char* opt_pB = 0; +static char* opt_pL = nullptr; +static char* opt_pS = nullptr; +static char* opt_pB = nullptr; static bool opt_dump_priorities = false; static int opt_formulas = 1; static int opt_seed = 0; @@ -227,9 +227,9 @@ main(int argc, char** argv) setup(argv); const argp ap = { options, parse_opt, "N|PROP...", argp_program_doc, - children, 0, 0 }; + 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); // running 'randltl 0' is one way to generate formulas using no @@ -300,7 +300,7 @@ main(int argc, char** argv) } else { - output_formula_checked(f, 0, ++count); + output_formula_checked(f, nullptr, ++count); } }; } diff --git a/src/bin/spot-x.cc b/src/bin/spot-x.cc index 550fac400..8d6147a7e 100644 --- a/src/bin/spot-x.cc +++ b/src/bin/spot-x.cc @@ -33,11 +33,11 @@ be passed to other algorithms in the future). These options are \ mostly used for benchmarking and debugging purpose. KEYR (without any \ value) is a shorthand for KEY=1, while !KEY is a shorthand for KEY=0."; -#define DOC(NAME, TXT) NAME, 0, 0, OPTION_DOC | OPTION_NO_USAGE, TXT, 0 +#define DOC(NAME, TXT) NAME, 0, nullptr, OPTION_DOC | OPTION_NO_USAGE, TXT, 0 static const argp_option options[] = { - { 0, 0, 0, 0, "Translation options:", 0 }, + { nullptr, 0, nullptr, 0, "Translation options:", 0 }, { DOC("comp-susp", "Set to 1 to enable compositional suspension, \ as described in our SPIN'13 paper (see Bibliography below). Set to 2, \ to build only the skeleton TGBA without composing it. Set to 0 (the \ @@ -55,7 +55,7 @@ Set to 1 always WDBA-minimize the skeleton . Set to 2 to keep the WDBA \ only if it is smaller than the original skeleton. This option is only \ used when comp-susp=1 and default to 1 or 2 depending on whether --small \ or --deterministic is specified.") }, - { 0, 0, 0, 0, "Postprocessing options:", 0 }, + { nullptr, 0, nullptr, 0, "Postprocessing options:", 0 }, { DOC("scc-filter", "Set to 1 (the default) to enable \ SCC-pruning and acceptance simplification at the beginning of \ post-processing. Transitions that are outside of accepting SCC are \ @@ -134,13 +134,13 @@ sets sat-minimize to 1 if not set differently.") }, "Set to 1 to instruct the SAT-minimization procedure to produce \ a TGBA where all outgoing transition of a state have the same acceptance \ sets. By default this is only enabled when option -B is used.") }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, 0, nullptr, 0, nullptr, 0 } }; const struct argp_child children[] = { - { &misc_argp_hidden, 0, 0, -1 }, - { 0, 0, 0, 0 } + { &misc_argp_hidden, 0, nullptr, -1 }, + { nullptr, 0, nullptr, 0 } }; int @@ -148,9 +148,10 @@ main(int argc, char** argv) { setup(argv); - const argp ap = { options, 0, 0, argp_program_doc, children, 0, 0 }; + const argp ap = { options, nullptr, nullptr, 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); std::cerr << "This binary serves no purpose other than generating" diff --git a/src/kripke/kripkeexplicit.cc b/src/kripke/kripkeexplicit.cc index acc473afb..4d1d085d3 100644 --- a/src/kripke/kripkeexplicit.cc +++ b/src/kripke/kripkeexplicit.cc @@ -58,7 +58,7 @@ namespace spot state_kripke::hash() const { return - reinterpret_cast(this) - static_cast(0); + reinterpret_cast(this) - static_cast(nullptr); } state_kripke* diff --git a/src/ltlast/formula.cc b/src/ltlast/formula.cc index fab5ba360..4c2788de5 100644 --- a/src/ltlast/formula.cc +++ b/src/ltlast/formula.cc @@ -405,7 +405,7 @@ namespace spot // std::unique(), because we must destroy() any formula we drop. // Also ignore neutral elements and handle absorbent elements. { - const fnode* last = 0; + const fnode* last = nullptr; vec::iterator i = v.begin(); bool weak_abs_seen = false; while (i != v.end()) diff --git a/src/ltlvisit/randomltl.cc b/src/ltlvisit/randomltl.cc index d3d95a063..e39340057 100644 --- a/src/ltlvisit/randomltl.cc +++ b/src/ltlvisit/randomltl.cc @@ -273,8 +273,8 @@ namespace spot char* key = strtok(options, "=\t, :;"); while (key) { - char* value = strtok(0, "=\t, :;"); - if (value == 0) + char* value = strtok(nullptr, "=\t, :;"); + if (!value) return key; char* endptr; @@ -296,10 +296,10 @@ namespace spot if (i == proba_size_) return key; - key = strtok(0, "=\t, :;"); + key = strtok(nullptr, "=\t, :;"); } update_sums(); - return 0; + return nullptr; } std::ostream& @@ -418,9 +418,9 @@ namespace spot opt_wf_ = opts.get("wf", false); opt_simpl_level_ = opts.get("simplification_level", 3); - const char* tok_pL = 0; - const char* tok_pS = 0; - const char* tok_pB = 0; + const char* tok_pL = nullptr; + const char* tok_pS = nullptr; + const char* tok_pB = nullptr; switch (output_) { diff --git a/src/ltlvisit/randomltl.hh b/src/ltlvisit/randomltl.hh index 4bfa19f31..e6f2655ce 100644 --- a/src/ltlvisit/randomltl.hh +++ b/src/ltlvisit/randomltl.hh @@ -345,9 +345,9 @@ namespace spot int output_; - random_formula* rf_ = 0; - random_psl* rp_ = 0; - random_sere* rs_ = 0; + random_formula* rf_ = nullptr; + random_psl* rp_ = nullptr; + random_sere* rs_ = nullptr; }; } } diff --git a/src/ltlvisit/relabel.cc b/src/ltlvisit/relabel.cc index 5787d708c..b02bd4e97 100644 --- a/src/ltlvisit/relabel.cc +++ b/src/ltlvisit/relabel.cc @@ -138,7 +138,7 @@ namespace spot formula relabel(formula f, relabeling_style style, relabeling_map* m) { - ap_generator* gen = 0; + ap_generator* gen = nullptr; switch (style) { case Pnn: @@ -470,7 +470,7 @@ namespace spot // Relabel the formula recursively, stopping // at cut-points or atomic propositions. - ap_generator* gen = 0; + ap_generator* gen = nullptr; switch (style) { case Pnn: diff --git a/src/ltlvisit/relabel.hh b/src/ltlvisit/relabel.hh index 98411d4da..a8448be00 100644 --- a/src/ltlvisit/relabel.hh +++ b/src/ltlvisit/relabel.hh @@ -38,7 +38,7 @@ namespace spot /// between the new names (keys) and the old names (values). SPOT_API formula relabel(formula f, relabeling_style style, - relabeling_map* m = 0); + relabeling_map* m = nullptr); /// \ingroup ltl_rewriting @@ -49,6 +49,6 @@ namespace spot /// between the new names (keys) and the old names (values). SPOT_API formula relabel_bse(formula f, relabeling_style style, - relabeling_map* m = 0); + relabeling_map* m = nullptr); } } diff --git a/src/ltlvisit/simplify.cc b/src/ltlvisit/simplify.cc index de11222e7..79a8ded26 100644 --- a/src/ltlvisit/simplify.cc +++ b/src/ltlvisit/simplify.cc @@ -265,7 +265,7 @@ namespace spot { f2f_map::const_iterator i = simplified_.find(f); if (i == simplified_.end()) - return 0; + return nullptr; return i->second; } @@ -1985,7 +1985,7 @@ namespace spot { xset.insert(c); } - res[n] = 0; + res[n] = nullptr; } // Make a second pass to check if the "a" // terms can be used to simplify "Xa W b", @@ -2044,7 +2044,7 @@ namespace spot } else if (tokill[n]) { - res[n] = 0; + res[n] = nullptr; } } diff --git a/src/ltlvisit/snf.hh b/src/ltlvisit/snf.hh index 340934d1c..74fccc528 100644 --- a/src/ltlvisit/snf.hh +++ b/src/ltlvisit/snf.hh @@ -49,10 +49,10 @@ namespace spot /// \param sere the SERE to rewrite /// \param cache an optional cache SPOT_API formula - star_normal_form(formula sere, snf_cache* cache = 0); + star_normal_form(formula sere, snf_cache* cache = nullptr); /// A variant of star_normal_form() for r[*0..j] where j < ω. SPOT_API formula - star_normal_form_bounded(formula sere, snf_cache* cache = 0); + star_normal_form_bounded(formula sere, snf_cache* cache = nullptr); } } diff --git a/src/misc/fixpool.hh b/src/misc/fixpool.hh index 70ae91176..df60f48fd 100644 --- a/src/misc/fixpool.hh +++ b/src/misc/fixpool.hh @@ -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_)) diff --git a/src/misc/hash.hh b/src/misc/hash.hh index 0d64a57a5..d0207b9b6 100644 --- a/src/misc/hash.hh +++ b/src/misc/hash.hh @@ -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(p) - - static_cast(0)); + - static_cast(nullptr)); } }; diff --git a/src/misc/mspool.hh b/src/misc/mspool.hh index c8da80d4f..724063098 100644 --- a/src/misc/mspool.hh +++ b/src/misc/mspool.hh @@ -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) { } diff --git a/src/misc/optionmap.cc b/src/misc/optionmap.cc index d01faa365..ec669247a 100644 --- a/src/misc/optionmap.cc +++ b/src/misc/optionmap.cc @@ -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 diff --git a/src/misc/satsolver.cc b/src/misc/satsolver.cc index 177e76909..886f6abd8 100644 --- a/src/misc/satsolver.cc +++ b/src/misc/satsolver.cc @@ -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; diff --git a/src/misc/tmpfile.cc b/src/misc/tmpfile.cc index d0f99c2b8..22ac10142 100644 --- a/src/misc/tmpfile.cc +++ b/src/misc/tmpfile.cc @@ -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; diff --git a/src/misc/tmpfile.hh b/src/misc/tmpfile.hh index e2a72dacf..20b95fd68 100644 --- a/src/misc/tmpfile.hh +++ b/src/misc/tmpfile.hh @@ -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. diff --git a/src/priv/bddalloc.cc b/src/priv/bddalloc.cc index 023e0c7cb..02fea0044 100644 --- a/src/priv/bddalloc.cc +++ b/src/priv/bddalloc.cc @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2007, 2011, 2014 Laboratoire de Recherche et +// Copyright (C) 2007, 2011, 2014, 2015 Laboratoire de Recherche et // Développement de l'Epita (LRDE). // Copyright (C) 2003, 2004, 2006, 2007 Laboratoire d'Informatique de // Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), @@ -54,7 +54,7 @@ namespace spot // Disable the default GC handler. (Note that this will only be // done if Buddy is initialized by Spot. Otherwise we prefer not // to overwrite a handler that might have been set by the user.) - bdd_gbc_hook(0); + bdd_gbc_hook(nullptr); // When the node time is full, add 500000 nodes, i.e., 10MB. bdd_setmaxincrease(500000); } diff --git a/src/ta/ta.hh b/src/ta/ta.hh index 89aa662ab..7d4148096 100644 --- a/src/ta/ta.hh +++ b/src/ta/ta.hh @@ -105,7 +105,7 @@ namespace spot virtual spot::state* get_artificial_initial_state() const { - return 0; + return nullptr; } /// \brief Get an iterator over the successors of \a state. diff --git a/src/ta/taexplicit.cc b/src/ta/taexplicit.cc index c15a7aae4..e5c6d5e9c 100644 --- a/src/ta/taexplicit.cc +++ b/src/ta/taexplicit.cc @@ -117,26 +117,21 @@ namespace spot transitions_by_condition.find(condition.id()); if (i == transitions_by_condition.end()) - { - return 0; - } + return nullptr; else - { - return i->second; - } - + return i->second; } void state_ta_explicit::add_transition(state_ta_explicit::transition* t, bool add_at_beginning) { - if (transitions_ == 0) + if (!transitions_) transitions_ = new transitions; transitions* trans_by_condition = get_transitions(t->condition); - if (trans_by_condition == 0) + if (!trans_by_condition) { trans_by_condition = new transitions; transitions_by_condition[(t->condition).id()] = trans_by_condition; @@ -229,7 +224,7 @@ namespace spot state_ta_explicit::is_hole_state() const { state_ta_explicit::transitions* trans = get_transitions(); - return trans == 0 || trans->empty(); + return !trans || trans->empty(); } int @@ -240,7 +235,7 @@ namespace spot int compare_value = tgba_state_->compare(o->tgba_state_); - if (compare_value != 0) + if (compare_value) return compare_value; compare_value = tgba_condition_.id() - o->tgba_condition_.id(); @@ -275,7 +270,7 @@ namespace spot state_ta_explicit::transitions* trans = get_transitions(); state_ta_explicit::transitions::iterator it_trans; - if (trans != 0) + if (trans) for (it_trans = trans->begin(); it_trans != trans->end();) { state_ta_explicit* dest = (*it_trans)->dest; @@ -301,7 +296,7 @@ namespace spot //remove hole successors states state_ta_explicit::transitions* dest_trans = (dest)->get_transitions(); - bool dest_trans_empty = dest_trans == 0 || dest_trans->empty(); + bool dest_trans_empty = !dest_trans || dest_trans->empty(); if (is_stuttering_transition || (dest_trans_empty && (!dest_is_livelock_accepting))) { @@ -324,7 +319,7 @@ namespace spot state_ta_explicit::transitions::iterator it_trans; // We don't destroy the transitions in the state's destructor because // they are not cloned. - if (trans != 0) + if (trans) for (it_trans = trans->begin(); it_trans != trans->end(); ++it_trans) { delete *it_trans; @@ -339,7 +334,7 @@ namespace spot ++i; } - transitions_ = 0; + transitions_ = nullptr; } //////////////////////////////////////// @@ -356,7 +351,7 @@ namespace spot get_dict()->register_all_variables_of(&tgba_, this); acc().add_sets(n_acc); acc().set_generalized_buchi(); - if (artificial_initial_state != 0) + if (artificial_initial_state) { state_ta_explicit* is = add_state(artificial_initial_state); assert(is == artificial_initial_state); @@ -396,7 +391,7 @@ namespace spot condition = get_state_condition(s); std::pair add_state = initial_states_set_.insert(s); - if (get_artificial_initial_state() != 0) + if (get_artificial_initial_state()) if (add_state.second) { state_ta_explicit* i = @@ -524,7 +519,7 @@ namespace spot state_ta_explicit::transitions* trans = source->get_transitions(); state_ta_explicit::transitions::iterator it_trans; - if (trans != 0) + if (trans) for (it_trans = trans->begin(); it_trans != trans->end();) { if (source->get_tgba_condition() diff --git a/src/ta/taexplicit.hh b/src/ta/taexplicit.hh index 88aa1704a..db292f4ca 100644 --- a/src/ta/taexplicit.hh +++ b/src/ta/taexplicit.hh @@ -1,6 +1,6 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2010, 2011, 2012, 2013, 2014 Laboratoire de Recherche -// et Développement de l'Epita (LRDE). +// Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015 Laboratoire de +// Recherche et Développement de l'Epita (LRDE). // // This file is part of Spot, a model checking library. // @@ -42,7 +42,7 @@ namespace spot public: ta_explicit(const const_twa_ptr& tgba, unsigned n_acc, - state_ta_explicit* artificial_initial_state = 0); + state_ta_explicit* artificial_initial_state = nullptr); const_twa_ptr get_tgba() const; @@ -145,8 +145,10 @@ namespace spot typedef std::list transitions; state_ta_explicit(const state* tgba_state, const bdd tgba_condition, - bool is_initial_state = false, bool is_accepting_state = false, - bool is_livelock_accepting_state = false, transitions* trans = 0) : + bool is_initial_state = false, + bool is_accepting_state = false, + bool is_livelock_accepting_state = false, + transitions* trans = nullptr) : tgba_state_(tgba_state), tgba_condition_(tgba_condition), is_initial_state_(is_initial_state), is_accepting_state_( is_accepting_state), is_livelock_accepting_state_( @@ -252,10 +254,10 @@ namespace spot typedef std::shared_ptr ta_explicit_ptr; typedef std::shared_ptr const_ta_explicit_ptr; - inline ta_explicit_ptr make_ta_explicit(const const_twa_ptr& tgba, - unsigned n_acc, - state_ta_explicit* - artificial_initial_state = 0) + inline ta_explicit_ptr + make_ta_explicit(const const_twa_ptr& tgba, + unsigned n_acc, + state_ta_explicit* artificial_initial_state = nullptr) { return std::make_shared(tgba, n_acc, artificial_initial_state); } diff --git a/src/ta/taproduct.cc b/src/ta/taproduct.cc index 2bb7bded7..f99aa74ee 100644 --- a/src/ta/taproduct.cc +++ b/src/ta/taproduct.cc @@ -1,6 +1,6 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2011, 2012, 2014 Laboratoire de Recherche et Développement -// de l'Epita (LRDE). +// Copyright (C) 2011, 2012, 2014, 2015 Laboratoire de Recherche et +// Développement de l'Epita (LRDE). // // // This file is part of Spot, a model checking library. @@ -74,18 +74,18 @@ namespace spot kripke_source_condition = kripke_->state_condition(s->get_kripke_state()); kripke_succ_it_ = kripke_->succ_iter(s->get_kripke_state()); - kripke_current_dest_state = 0; - ta_succ_it_ = 0; - current_state_ = 0; + kripke_current_dest_state = nullptr; + ta_succ_it_ = nullptr; + current_state_ = nullptr; } ta_succ_iterator_product::~ta_succ_iterator_product() { delete current_state_; - current_state_ = 0; + current_state_ = nullptr; delete ta_succ_it_; delete kripke_succ_it_; - if (kripke_current_dest_state != 0) + if (kripke_current_dest_state) kripke_current_dest_state->destroy(); } @@ -97,7 +97,7 @@ namespace spot if (ta_succ_it_->done()) { delete ta_succ_it_; - ta_succ_it_ = 0; + ta_succ_it_ = nullptr; next_kripke_dest(); } } @@ -108,14 +108,14 @@ namespace spot if (!kripke_succ_it_) return; - if (kripke_current_dest_state == 0) + if (!kripke_current_dest_state) { kripke_succ_it_->first(); } else { kripke_current_dest_state->destroy(); - kripke_current_dest_state = 0; + kripke_current_dest_state = nullptr; kripke_succ_it_->next(); } @@ -126,7 +126,7 @@ namespace spot if (kripke_succ_it_->done()) { delete kripke_succ_it_; - kripke_succ_it_ = 0; + kripke_succ_it_ = nullptr; return; } @@ -165,7 +165,7 @@ namespace spot ta_succ_iterator_product::next() { delete current_state_; - current_state_ = 0; + current_state_ = nullptr; if (is_stuttering_transition()) { next_kripke_dest(); @@ -275,7 +275,7 @@ namespace spot spot::state* artificial_initial_state = ta_->get_artificial_initial_state(); - if (artificial_initial_state != 0) + if (artificial_initial_state) { ta_succ_iterator* ta_init_it_ = ta_->succ_iter( artificial_initial_state, kripke_init_state_condition); @@ -294,8 +294,8 @@ namespace spot for (it = ta_init_states_set.begin(); it != ta_init_states_set.end(); ++it) { - if ((artificial_initial_state != 0) || (kripke_init_state_condition - == ta_->get_state_condition(*it))) + if (artificial_initial_state || + (kripke_init_state_condition == ta_->get_state_condition(*it))) { state_ta_product* stp = new state_ta_product((*it), kripke_init_state->clone()); @@ -422,14 +422,14 @@ namespace spot if (!kripke_succ_it_) return; - if (kripke_current_dest_state == 0) + if (!kripke_current_dest_state) { kripke_succ_it_->first(); } else { kripke_current_dest_state->destroy(); - kripke_current_dest_state = 0; + kripke_current_dest_state = nullptr; kripke_succ_it_->next(); } @@ -440,7 +440,7 @@ namespace spot if (kripke_succ_it_->done()) { delete kripke_succ_it_; - kripke_succ_it_ = 0; + kripke_succ_it_ = nullptr; return; } diff --git a/src/ta/tgtaexplicit.hh b/src/ta/tgtaexplicit.hh index 89b90f82a..644d5a7ab 100644 --- a/src/ta/tgtaexplicit.hh +++ b/src/ta/tgtaexplicit.hh @@ -1,6 +1,6 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2010, 2011, 2012, 2013, 2014 Laboratoire de Recherche -// et Développement de l'Epita (LRDE). +// Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015 Laboratoire de +// Recherche et Développement de l'Epita (LRDE). // // This file is part of Spot, a model checking library. // @@ -66,10 +66,9 @@ namespace spot typedef std::shared_ptr tgta_explicit_ptr; typedef std::shared_ptr const_tgta_explicit_ptr; - inline tgta_explicit_ptr make_tgta_explicit(const const_twa_ptr& tgba, - unsigned n_acc, - state_ta_explicit* - artificial_initial_state = 0) + inline tgta_explicit_ptr + make_tgta_explicit(const const_twa_ptr& tgba, unsigned n_acc, + state_ta_explicit* artificial_initial_state = nullptr) { return std::make_shared(tgba, n_acc, artificial_initial_state); diff --git a/src/ta/tgtaproduct.cc b/src/ta/tgtaproduct.cc index 4825a0c98..09a699561 100644 --- a/src/ta/tgtaproduct.cc +++ b/src/ta/tgtaproduct.cc @@ -1,6 +1,6 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2012, 2014 Laboratoire de Recherche et Développement -// de l Epita (LRDE). +// Copyright (C) 2012, 2014, 2015 Laboratoire de Recherche et +// Développement de l Epita (LRDE). // // This file is part of Spot, a model checking library. // @@ -81,11 +81,11 @@ namespace spot state * tgta_init_state = tgta_->get_init_state(); if ((s->right())->compare(tgta_init_state) == 0) - source_ = 0; + source_ = nullptr; - if (source_ == 0) + if (!source_) { - kripke_succ_it_ = 0; + kripke_succ_it_ = nullptr; kripke_current_dest_state = kripke_->get_init_state(); current_condition_ = kripke_->state_condition(kripke_current_dest_state); @@ -101,23 +101,23 @@ namespace spot { kripke_source_condition = kripke_->state_condition(s->left()); kripke_succ_it_ = kripke_->succ_iter(s->left()); - kripke_current_dest_state = 0; - tgta_succ_it_ = 0; + kripke_current_dest_state = nullptr; + tgta_succ_it_ = nullptr; } tgta_init_state->destroy(); - current_state_ = 0; + current_state_ = nullptr; } tgta_succ_iterator_product::~tgta_succ_iterator_product() { // ta_->free_state(current_state_); - if (current_state_ != 0) + if (current_state_) current_state_->destroy(); - current_state_ = 0; + current_state_ = nullptr; delete tgta_succ_it_; delete kripke_succ_it_; - if (kripke_current_dest_state != 0) + if (kripke_current_dest_state) kripke_current_dest_state->destroy(); } @@ -129,7 +129,7 @@ namespace spot if (tgta_succ_it_->done()) { delete tgta_succ_it_; - tgta_succ_it_ = 0; + tgta_succ_it_ = nullptr; next_kripke_dest(); } } @@ -140,14 +140,14 @@ namespace spot if (!kripke_succ_it_) return; - if (kripke_current_dest_state == 0) + if (!kripke_current_dest_state) { kripke_succ_it_->first(); } else { kripke_current_dest_state->destroy(); - kripke_current_dest_state = 0; + kripke_current_dest_state = nullptr; kripke_succ_it_->next(); } @@ -158,7 +158,7 @@ namespace spot if (kripke_succ_it_->done()) { delete kripke_succ_it_; - kripke_succ_it_ = 0; + kripke_succ_it_ = nullptr; return; } @@ -187,7 +187,7 @@ namespace spot tgta_succ_iterator_product::next() { current_state_->destroy(); - current_state_ = 0; + current_state_ = nullptr; step_(); @@ -219,7 +219,7 @@ namespace spot bool tgta_succ_iterator_product::done() const { - if (source_ == 0) + if (!source_) { return !tgta_succ_it_ || tgta_succ_it_->done(); } diff --git a/src/taalgos/minimize.cc b/src/taalgos/minimize.cc index db9a4a660..6c23212cb 100644 --- a/src/taalgos/minimize.cc +++ b/src/taalgos/minimize.cc @@ -106,7 +106,7 @@ namespace spot bdd tgba_condition = bddtrue; bool is_initial_state = a->is_initial_state(src); - if ((a->get_artificial_initial_state() == 0) && is_initial_state) + if (!a->get_artificial_initial_state() && is_initial_state) tgba_condition = a->get_state_condition(src); bool is_accepting_state = a->is_accepting_state(src); bool is_livelock_accepting_state = @@ -124,7 +124,7 @@ namespace spot { delete new_src; } - else if (a->get_artificial_initial_state() != 0) + else if (a->get_artificial_initial_state()) { if (a->get_artificial_initial_state() == src) result->set_artificial_initial_state(new_src); @@ -146,7 +146,7 @@ namespace spot bdd tgba_condition = bddtrue; is_initial_state = a->is_initial_state(dst); - if ((a->get_artificial_initial_state() == 0) && is_initial_state) + if (!a->get_artificial_initial_state() && is_initial_state) tgba_condition = a->get_state_condition(dst); bool is_accepting_state = a->is_accepting_state(dst); bool is_livelock_accepting_state = @@ -165,7 +165,7 @@ namespace spot { delete new_dst; } - else if (a->get_artificial_initial_state() != 0) + else if (a->get_artificial_initial_state()) { if (a->get_artificial_initial_state() == dst) result->set_artificial_initial_state(new_dst); @@ -238,7 +238,7 @@ namespace spot const state* s = *it; if (s == artificial_initial_state) I->insert(s); - else if (artificial_initial_state == 0 && ta_->is_initial_state(s)) + else if (!artificial_initial_state && ta_->is_initial_state(s)) I->insert(s); else if (ta_->is_livelock_accepting_state(s) && ta_->is_accepting_state(s)) @@ -508,7 +508,7 @@ namespace spot { auto tgba = make_twa_graph(ta_->get_dict()); - auto res = make_ta_explicit(tgba, ta_->acc().num_sets(), 0); + auto res = make_ta_explicit(tgba, ta_->acc().num_sets(), nullptr); partition_t partition = build_partition(ta_); @@ -528,7 +528,7 @@ namespace spot { auto tgba = make_twa_graph(tgta_->get_dict()); - auto res = make_tgta_explicit(tgba, tgta_->acc().num_sets(), 0); + auto res = make_tgta_explicit(tgba, tgta_->acc().num_sets(), nullptr); auto ta = tgta_->get_ta(); diff --git a/src/taalgos/reachiter.cc b/src/taalgos/reachiter.cc index df11d0761..da8c625f1 100644 --- a/src/taalgos/reachiter.cc +++ b/src/taalgos/reachiter.cc @@ -1,6 +1,6 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2010, 2012, 2014 Laboratoire de Recherche et Développement -// de l'Epita (LRDE). +// Copyright (C) 2010, 2012, 2014, 2015 Laboratoire de Recherche et +// Développement de l'Epita (LRDE). // // This file is part of Spot, a model checking library. // @@ -57,7 +57,7 @@ namespace spot ta::states_set_t::const_iterator it; - if (artificial_initial_state != 0) + if (artificial_initial_state) { init_states_set.insert(artificial_initial_state); } @@ -153,7 +153,7 @@ namespace spot ta_reachable_iterator_depth_first::next_state() { if (todo.empty()) - return 0; + return nullptr; const state* s = todo.top(); todo.pop(); return s; @@ -178,7 +178,7 @@ namespace spot ta_reachable_iterator_breadth_first::next_state() { if (todo.empty()) - return 0; + return nullptr; const state* s = todo.front(); todo.pop_front(); return s; diff --git a/src/taalgos/tgba2ta.cc b/src/taalgos/tgba2ta.cc index 5707da956..5ba49b247 100644 --- a/src/taalgos/tgba2ta.cc +++ b/src/taalgos/tgba2ta.cc @@ -47,10 +47,10 @@ namespace spot static void transform_to_single_pass_automaton (const ta_explicit_ptr& testing_automata, - state_ta_explicit* artificial_livelock_acc_state = 0) + state_ta_explicit* artificial_livelock_acc_state = nullptr) { - if (artificial_livelock_acc_state != 0) + if (artificial_livelock_acc_state) { state_ta_explicit* artificial_livelock_acc_state_added = testing_automata->add_state(artificial_livelock_acc_state); @@ -78,14 +78,14 @@ namespace spot state_ta_explicit::transitions* trans = source->get_transitions(); state_ta_explicit::transitions::iterator it_trans; - if (trans != 0) + if (trans) for (it_trans = trans->begin(); it_trans != trans->end();) { state_ta_explicit* dest = (*it_trans)->dest; state_ta_explicit::transitions* dest_trans = (dest)->get_transitions(); - bool dest_trans_empty = dest_trans == 0 || dest_trans->empty(); + bool dest_trans_empty = !dest_trans || dest_trans->empty(); //select transitions where a destination is a livelock state // which isn't a Buchi accepting state and has successors @@ -101,7 +101,7 @@ namespace spot ++it_trans; } - if (transitions_to_livelock_states != 0) + if (transitions_to_livelock_states) { state_ta_explicit::transitions::iterator it_trans; @@ -109,7 +109,7 @@ namespace spot it_trans != transitions_to_livelock_states->end(); ++it_trans) { - if (artificial_livelock_acc_state != 0) + if (artificial_livelock_acc_state) { testing_automata->create_transition (source, @@ -136,7 +136,7 @@ namespace spot state_ta_explicit* state = static_cast (*it); state_ta_explicit::transitions* state_trans = (state)->get_transitions(); - bool state_trans_empty = state_trans == 0 || state_trans->empty(); + bool state_trans_empty = !state_trans || state_trans->empty(); if (state->is_livelock_accepting_state() && (!state->is_accepting_state()) && (!state_trans_empty)) @@ -274,7 +274,6 @@ namespace spot assert(!arc.empty()); sscc.pop(); arc.pop(); - } // automata reduction @@ -396,8 +395,7 @@ namespace spot } - if ((artificial_livelock_acc_state != 0) - || single_pass_emptiness_check) + if (artificial_livelock_acc_state || single_pass_emptiness_check) transform_to_single_pass_automaton(testing_aut, artificial_livelock_acc_state); } @@ -517,7 +515,7 @@ namespace spot if (no_livelock) return ta; - state_ta_explicit* artificial_livelock_acc_state = 0; + state_ta_explicit* artificial_livelock_acc_state = nullptr; trace << "*** build_ta: artificial_livelock_acc_state_mode = ***" << artificial_livelock_state_mode << std::endl; @@ -527,7 +525,7 @@ namespace spot single_pass_emptiness_check = true; artificial_livelock_acc_state = new state_ta_explicit(ta->get_tgba()->get_init_state(), bddtrue, - false, false, true, 0); + false, false, true, nullptr); trace << "*** build_ta: artificial_livelock_acc_state = ***" << artificial_livelock_acc_state << std::endl; @@ -638,7 +636,7 @@ namespace spot state_ta_explicit::transitions* trans = state->get_transitions(); if (state->is_livelock_accepting_state()) { - bool trans_empty = (trans == 0 || trans->empty()); + bool trans_empty = !trans || trans->empty(); if (trans_empty || state->is_accepting_state()) { ta->create_transition(state, bdd_stutering_transition, diff --git a/src/tests/complementation.cc b/src/tests/complementation.cc index e5dd5ad88..f354705b1 100644 --- a/src/tests/complementation.cc +++ b/src/tests/complementation.cc @@ -49,7 +49,7 @@ void usage(const char* prog) int main(int argc, char* argv[]) { - char *file = 0; + char *file = nullptr; bool print_safra = false; bool print_automaton = false; //bool check = false; @@ -110,7 +110,7 @@ int main(int argc, char* argv[]) file = argv[i]; } - if (file == 0) + if (!file) { usage(argv[0]); return 1; @@ -126,7 +126,7 @@ int main(int argc, char* argv[]) return 2; spot::twa_graph_ptr a = h->aut; - spot::twa_ptr complement = 0; + spot::twa_ptr complement = nullptr; complement = spot::make_safra_complement(a); @@ -154,7 +154,7 @@ int main(int argc, char* argv[]) return 2; auto a = spot::ltl_to_tgba_fm(f1, dict); - spot::twa_ptr complement = 0; + spot::twa_ptr complement = nullptr; complement = spot::make_safra_complement(a); spot::print_dot(std::cout, complement); diff --git a/src/tests/ikwiad.cc b/src/tests/ikwiad.cc index fa5d2e8fb..428d9af51 100644 --- a/src/tests/ikwiad.cc +++ b/src/tests/ikwiad.cc @@ -332,8 +332,8 @@ checked_main(int argc, char** argv) bool degen_cache = true; int output = 0; int formula_index = 0; - const char* echeck_algo = 0; - spot::emptiness_check_instantiator_ptr echeck_inst = 0; + const char* echeck_algo = nullptr; + spot::emptiness_check_instantiator_ptr echeck_inst = nullptr; enum { NoneDup, BFS, DFS } dupexp = NoneDup; bool expect_counter_example = false; bool accepting_run = false; @@ -364,8 +364,8 @@ checked_main(int argc, char** argv) const char* opt_never = nullptr; const char* hoa_opt = nullptr; auto& env = spot::ltl::default_environment::instance(); - spot::ltl::atomic_prop_set* unobservables = 0; - spot::twa_ptr system_aut = 0; + spot::ltl::atomic_prop_set* unobservables = nullptr; + spot::twa_ptr system_aut = nullptr; auto dict = spot::make_bdd_dict(); spot::timer_map tm; bool use_timer = false; @@ -797,7 +797,7 @@ checked_main(int argc, char** argv) while (tok) { unobservables->insert(env.require(tok)); - tok = strtok(0, ", \t;"); + tok = strtok(nullptr, ", \t;"); } } else if (!strncmp(argv[formula_index], "-u", 2)) @@ -944,7 +944,7 @@ checked_main(int argc, char** argv) if (f || from_file) { - spot::twa_ptr a = 0; + spot::twa_ptr a = nullptr; bool assume_sba = false; if (from_file) @@ -964,7 +964,7 @@ checked_main(int argc, char** argv) } else { - spot::ltl::ltl_simplifier* simp = 0; + spot::ltl::ltl_simplifier* simp = nullptr; if (simpltl) simp = new spot::ltl::ltl_simplifier(redopt, dict); @@ -1004,7 +1004,7 @@ checked_main(int argc, char** argv) post_branching, fair_loop_approx, unobservables, - fm_red ? simp : 0, + fm_red ? simp : nullptr, fm_unambiguous); break; case TransCompo: @@ -1061,8 +1061,7 @@ checked_main(int argc, char** argv) { auto aa = ensure_digraph(a); tm.start("obligation minimization"); - auto minimized = minimize_obligation(aa, - f, 0, reject_bigger); + auto minimized = minimize_obligation(aa, f, nullptr, reject_bigger); tm.stop("obligation minimization"); if (!minimized) @@ -1318,7 +1317,7 @@ checked_main(int argc, char** argv) } tm.stop("producing output"); } - a = 0; + a = nullptr; output = -1; } if (tgta_opt) @@ -1457,8 +1456,9 @@ checked_main(int argc, char** argv) { std::cout << "this is not an obligation property"; auto tmp = tba_determinize_check(ensure_digraph(a), - 0, opt_o_threshold, f, 0); - if (tmp != 0 && tmp != a) + 0, opt_o_threshold, + f, nullptr); + if (tmp && tmp != a) std::cout << ", but it is a recurrence property"; } else diff --git a/src/tests/randtgba.cc b/src/tests/randtgba.cc index e783ec604..89a0a6ee7 100644 --- a/src/tests/randtgba.cc +++ b/src/tests/randtgba.cc @@ -77,7 +77,7 @@ const char* default_algos[] = { "Tau03_opt(condstack)", "Tau03_opt(condstack ordering)", "Tau03_opt(condstack ordering !weights)", - 0 + nullptr }; std::vector ec_algos; @@ -520,7 +520,7 @@ generate_formula(const spot::ltl::random_ltl& rl, assert(opt_l); std::cerr << "Failed to generate non-reducible formula " << "of size " << opt_l << " or more." << std::endl; - return 0; + return nullptr; } std::string txt = spot::ltl::str_psl(f); if (!opt_u || unique.insert(txt).second) @@ -529,7 +529,7 @@ generate_formula(const spot::ltl::random_ltl& rl, assert(opt_u); std::cerr << "Failed to generate another unique formula." << std::endl; - return 0; + return nullptr; } int @@ -539,9 +539,9 @@ main(int argc, char** argv) bool opt_dp = false; int opt_f = 15; int opt_F = 0; - char* opt_p = 0; - char* opt_i = 0; - std::istream *formula_file = 0; + char* opt_p = nullptr; + char* opt_i = nullptr; + std::istream *formula_file = nullptr; int opt_l = 0; bool opt_u = false; int opt_S = 0; @@ -633,7 +633,7 @@ main(int argc, char** argv) break; else if (input == "") break; - ec_algo a = { input, 0 }; + ec_algo a = { input, nullptr }; ec_algos.push_back(a); } @@ -815,7 +815,7 @@ main(int argc, char** argv) const char** i = default_algos; while (*i) { - ec_algo a = { *(i++), 0 }; + ec_algo a = { *(i++), nullptr }; ec_algos.push_back(a); } } @@ -834,7 +834,7 @@ main(int argc, char** argv) ec_algos[i].inst = spot::make_emptiness_check_instantiator(ec_algos[i].name.c_str(), &err); - if (ec_algos[i].inst == 0) + if (!ec_algos[i].inst) { std::cerr << "Parse error after `" << err << '\'' << std::endl; exit(1); diff --git a/src/tests/reduc.cc b/src/tests/reduc.cc index 56a16214a..880ed6030 100644 --- a/src/tests/reduc.cc +++ b/src/tests/reduc.cc @@ -154,7 +154,7 @@ main(int argc, char** argv) spot::ltl::formula f1 = nullptr; spot::ltl::formula f2 = nullptr; - std::ifstream* fin = 0; + std::ifstream* fin = nullptr; if (readfile) { diff --git a/src/twa/bdddict.cc b/src/twa/bdddict.cc index 0a2a494df..d2aa2190d 100644 --- a/src/twa/bdddict.cc +++ b/src/twa/bdddict.cc @@ -49,7 +49,7 @@ namespace spot // WARNING: We need a default constructor so this can be used in // a hash; but we should ensure that no object in the hash is // constructed with p==0. - anon_free_list(bdd_dict_priv* p = 0) + anon_free_list(bdd_dict_priv* p = nullptr) : priv_(p) { } @@ -73,7 +73,7 @@ namespace spot bdd_dict_priv() { - free_anonymous_list_of[0] = anon_free_list(this); + free_anonymous_list_of[nullptr] = anon_free_list(this); } /// List of unused anonymous variable number for each automaton. @@ -202,7 +202,7 @@ namespace spot { i = (priv_->free_anonymous_list_of.insert (fal::value_type(for_me, - priv_->free_anonymous_list_of[0]))).first; + priv_->free_anonymous_list_of[nullptr]))).first; } int res = i->second.register_n(n); diff --git a/src/twa/bddprint.cc b/src/twa/bddprint.cc index e51a1769a..2c74a5dc5 100644 --- a/src/twa/bddprint.cc +++ b/src/twa/bddprint.cc @@ -157,7 +157,7 @@ namespace spot want_acc = true; bdd_strm_hook(print_handler); os << bddset << b; - bdd_strm_hook(0); + bdd_strm_hook(nullptr); return os; } diff --git a/src/twa/taatgba.cc b/src/twa/taatgba.cc index 942e83f69..e1ddf306b 100644 --- a/src/twa/taatgba.cc +++ b/src/twa/taatgba.cc @@ -33,7 +33,7 @@ namespace spot taa_tgba::taa_tgba(const bdd_dict_ptr& dict) : twa(dict), - init_(0), state_set_vec_() + init_(nullptr), state_set_vec_() { } @@ -122,7 +122,7 @@ namespace spot taa_tgba::state_set::const_iterator it = s_->begin(); while (it != s_->end()) { - res ^= reinterpret_cast(*it++) - static_cast(0); + res ^= reinterpret_cast(*it++) - static_cast(nullptr); res = wang32_hash(res); } return res; diff --git a/src/twa/twa.cc b/src/twa/twa.cc index 23cdf63c4..7586f4fdf 100644 --- a/src/twa/twa.cc +++ b/src/twa/twa.cc @@ -31,7 +31,7 @@ namespace spot twa::twa(const bdd_dict_ptr& d) : iter_cache_(nullptr), dict_(d), - last_support_conditions_input_(0) + last_support_conditions_input_(nullptr) { props = 0U; bddaps_ = bddtrue; @@ -65,7 +65,7 @@ namespace spot { if (t.get() == this) return s->clone(); - return 0; + return nullptr; } std::string diff --git a/src/twa/twagraph.hh b/src/twa/twagraph.hh index 824da7f6b..93fa2bf38 100644 --- a/src/twa/twagraph.hh +++ b/src/twa/twagraph.hh @@ -201,7 +201,7 @@ namespace spot get_dict()->unregister_all_my_variables(this); // Prevent this state from being destroyed by ~twa(), // as the state will be destroyed when g_ is destroyed. - last_support_conditions_input_ = 0; + last_support_conditions_input_ = nullptr; } #ifndef SWIG diff --git a/src/twa/twaproduct.cc b/src/twa/twaproduct.cc index 949a2465f..0ddeb1cdc 100644 --- a/src/twa/twaproduct.cc +++ b/src/twa/twaproduct.cc @@ -119,7 +119,7 @@ namespace spot if (!(left_->first() && right_->first())) { delete right_; - right_ = 0; + right_ = nullptr; return false; } return next_non_false_(); @@ -326,7 +326,7 @@ namespace spot if (last_support_conditions_input_) { last_support_conditions_input_->destroy(); - last_support_conditions_input_ = 0; + last_support_conditions_input_ = nullptr; } } diff --git a/src/twa/twasafracomplement.cc b/src/twa/twasafracomplement.cc index 453fa8572..4907f91c6 100644 --- a/src/twa/twasafracomplement.cc +++ b/src/twa/twasafracomplement.cc @@ -124,7 +124,7 @@ namespace spot /// \brief Is this node the root of the tree? bool is_root() const { - return parent == 0; + return parent == nullptr; } bool marked; @@ -141,14 +141,14 @@ namespace spot safra_tree::safra_tree() : marked(false), name(0) { - parent = 0; + parent = nullptr; } /// \brief Copy the tree \a other, and set \c marked to false. safra_tree::safra_tree(const safra_tree& other) : marked(false), name(other.name), nodes(other.nodes) { - parent = 0; + parent = nullptr; for (auto i: other.children) { safra_tree* c = new safra_tree(*i); @@ -254,7 +254,7 @@ namespace spot int safra_tree::get_new_name() const { - if (parent == 0) + if (parent == nullptr) { if (free_names_.empty()) { @@ -1014,7 +1014,7 @@ namespace spot //////////////////////// safra_tree_automaton::safra_tree_automaton(const const_twa_graph_ptr& a) - : max_nb_pairs_(-1), initial_state(0), a_(a) + : max_nb_pairs_(-1), initial_state(nullptr), a_(a) { a->get_dict()->register_all_variables_of(a, this); } diff --git a/src/twaalgos/bfssteps.cc b/src/twaalgos/bfssteps.cc index 1d801dff6..b2e7ac84f 100644 --- a/src/twaalgos/bfssteps.cc +++ b/src/twaalgos/bfssteps.cc @@ -102,7 +102,7 @@ namespace spot } } } - return 0; + return nullptr; } } diff --git a/src/twaalgos/compsusp.cc b/src/twaalgos/compsusp.cc index 024f71ec1..f5e1e1043 100644 --- a/src/twaalgos/compsusp.cc +++ b/src/twaalgos/compsusp.cc @@ -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; diff --git a/src/twaalgos/dtgbasat.cc b/src/twaalgos/dtgbasat.cc index bd2dafa09..6ee15f21e 100644 --- a/src/twaalgos/dtgbasat.cc +++ b/src/twaalgos/dtgbasat.cc @@ -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 { diff --git a/src/twaalgos/emptiness.cc b/src/twaalgos/emptiness.cc index 6cf6754cc..fd0f37609 100644 --- a/src/twaalgos/emptiness.cc +++ b/src/twaalgos/emptiness.cc @@ -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 diff --git a/src/twaalgos/gtec/ce.cc b/src/twaalgos/gtec/ce.cc index 4bdf3893e..bb73562eb 100644 --- a/src/twaalgos/gtec/ce.cc +++ b/src/twaalgos/gtec/ce.cc @@ -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; } diff --git a/src/twaalgos/gv04.cc b/src/twaalgos/gv04.cc index 6c394b1b1..65c37005e 100644 --- a/src/twaalgos/gv04.cc +++ b/src/twaalgos/gv04.cc @@ -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(*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(); diff --git a/src/twaalgos/ltl2taa.cc b/src/twaalgos/ltl2taa.cc index ffddc5694..7fe956b3b 100644 --- a/src/twaalgos/ltl2taa.cc +++ b/src/twaalgos/ltl2taa.cc @@ -148,7 +148,7 @@ namespace spot std::vector::iterator i1; std::vector::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::iterator i; - taa_tgba::transition* t = 0; + taa_tgba::transition* t = nullptr; switch (f.kind()) { case op::And: diff --git a/src/twaalgos/ltl2tgba_fm.cc b/src/twaalgos/ltl2tgba_fm.cc index 7ba1402d5..fbfdd3df9 100644 --- a/src/twaalgos/ltl2tgba_fm.cc +++ b/src/twaalgos/ltl2tgba_fm.cc @@ -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); diff --git a/src/twaalgos/ltl2tgba_fm.hh b/src/twaalgos/ltl2tgba_fm.hh index 7e8db5787..f3f6e3885 100644 --- a/src/twaalgos/ltl2tgba_fm.hh +++ b/src/twaalgos/ltl2tgba_fm.hh @@ -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); } diff --git a/src/twaalgos/magic.cc b/src/twaalgos/magic.cc index 0e4981dd2..9d4f5b0e3 100644 --- a/src/twaalgos/magic.cc +++ b/src/twaalgos/magic.cc @@ -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(); diff --git a/src/twaalgos/minimize.cc b/src/twaalgos/minimize.cc index 7f04a4a29..01104d1b8 100644 --- a/src/twaalgos/minimize.cc +++ b/src/twaalgos/minimize.cc @@ -194,7 +194,7 @@ namespace spot s = seen(s); if (sm.scc_of(std::static_pointer_cast(a_) ->state_number(s)) != scc_n) - return 0; + return nullptr; return s; } diff --git a/src/twaalgos/ndfs_result.hxx b/src/twaalgos/ndfs_result.hxx index 4c272a826..b9caf317a 100644 --- a/src/twaalgos/ndfs_result.hxx +++ b/src/twaalgos/ndfs_result.hxx @@ -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 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. diff --git a/src/twaalgos/postproc.cc b/src/twaalgos/postproc.cc index 7e20e3939..9516ffdd6 100644 --- a/src/twaalgos/postproc.cc +++ b/src/twaalgos/postproc.cc @@ -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 diff --git a/src/twaalgos/postproc.hh b/src/twaalgos/postproc.hh index 6b41464a0..cd04ec039 100644 --- a/src/twaalgos/postproc.hh +++ b/src/twaalgos/postproc.hh @@ -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 diff --git a/src/twaalgos/reachiter.cc b/src/twaalgos/reachiter.cc index 2c05ce603..00081bc8e 100644 --- a/src/twaalgos/reachiter.cc +++ b/src/twaalgos/reachiter.cc @@ -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; diff --git a/src/twaalgos/reducerun.cc b/src/twaalgos/reducerun.cc index 13d7e4f41..287017c78 100644 --- a/src/twaalgos/reducerun.cc +++ b/src/twaalgos/reducerun.cc @@ -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) { } diff --git a/src/twaalgos/safety.hh b/src/twaalgos/safety.hh index a28cffe9e..ee08b0ec5 100644 --- a/src/twaalgos/safety.hh +++ b/src/twaalgos/safety.hh @@ -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. /// diff --git a/src/twaalgos/sccfilter.hh b/src/twaalgos/sccfilter.hh index 3447539b5..ff6e44c4c 100644 --- a/src/twaalgos/sccfilter.hh +++ b/src/twaalgos/sccfilter.hh @@ -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); } diff --git a/src/twaalgos/se05.cc b/src/twaalgos/se05.cc index ec16d4ffa..9fc245e76 100644 --- a/src/twaalgos/se05.cc +++ b/src/twaalgos/se05.cc @@ -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(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 diff --git a/src/twaalgos/simulation.cc b/src/twaalgos/simulation.cc index 351a15b84..ce32de1e4 100644 --- a/src/twaalgos/simulation.cc +++ b/src/twaalgos/simulation.cc @@ -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; diff --git a/src/twaalgos/tau03.cc b/src/twaalgos/tau03.cc index 531e41793..8802466a3 100644 --- a/src/twaalgos/tau03.cc +++ b/src/twaalgos/tau03.cc @@ -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(); diff --git a/src/twaalgos/tau03opt.cc b/src/twaalgos/tau03opt.cc index 14f687327..2d601859d 100644 --- a/src/twaalgos/tau03opt.cc +++ b/src/twaalgos/tau03opt.cc @@ -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(); diff --git a/src/twaalgos/translate.cc b/src/twaalgos/translate.cc index ca98db778..ef8b81f9b 100644 --- a/src/twaalgos/translate.cc +++ b/src/twaalgos/translate.cc @@ -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; diff --git a/src/twaalgos/translate.hh b/src/twaalgos/translate.hh index 7bf93961e..3049ef074 100644 --- a/src/twaalgos/translate.hh +++ b/src/twaalgos/translate.hh @@ -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()); diff --git a/utf8/utf8/core.h b/utf8/utf8/core.h index 268cf7cd4..336973171 100644 --- a/utf8/utf8/core.h +++ b/utf8/utf8/core.h @@ -116,15 +116,15 @@ namespace internal inline bool is_overlong_sequence(uint32_t cp, octet_difference_type length) { if (cp < 0x80) { - if (length != 1) + if (length != 1) return true; } else if (cp < 0x800) { - if (length != 2) + if (length != 2) return true; } else if (cp < 0x10000) { - if (length != 3) + if (length != 3) return true; } @@ -189,7 +189,7 @@ namespace internal *code_point = cp; ret_code = UTF8_OK; } - else + else ret_code = INCOMPLETE_SEQUENCE; } else @@ -238,7 +238,7 @@ namespace internal else ret_code = NOT_ENOUGH_ROOM; } - else + else ret_code = INCOMPLETE_SEQUENCE; } else @@ -292,7 +292,7 @@ namespace internal else err = OVERLONG_SEQUENCE; } - else + else err = INVALID_CODE_POINT; } @@ -303,7 +303,7 @@ namespace internal template inline utf_error validate_next(octet_iterator& it, octet_iterator end) { - return validate_next(it, end, 0); + return validate_next(it, end, nullptr); } } // namespace internal @@ -340,8 +340,8 @@ namespace internal ((it != end) && (internal::mask8(*it)) == bom[2]) ); } - - //Deprecated in release 2.3 + + //Deprecated in release 2.3 template inline bool is_bom (octet_iterator it) { @@ -354,5 +354,3 @@ namespace internal } // namespace utf8 #endif // header guard - -