diff --git a/spot/ltsmin/ltsmin.cc b/spot/ltsmin/ltsmin.cc index 32e3d1431..a6cebb285 100644 --- a/spot/ltsmin/ltsmin.cc +++ b/spot/ltsmin/ltsmin.cc @@ -38,6 +38,8 @@ #include #include +using namespace std::string_literals; + namespace spot { namespace @@ -972,15 +974,15 @@ namespace spot } else { - throw std::runtime_error(std::string("Unknown extension '") - + ext + "'. Use '.prom', '.pm', '.pml', " + throw std::runtime_error("Unknown extension '"s + ext + + "'. Use '.prom', '.pm', '.pml', " "'.dve', '.dve2C', '.gal', '.gal2C' or " "'.prom.spins'."); } struct stat s; if (stat(filename.c_str(), &s) != 0) - throw std::runtime_error(std::string("Cannot open ") + filename); + throw std::runtime_error("Cannot open "s + filename); filename += compiled_ext; @@ -998,7 +1000,7 @@ namespace spot int res = system(command.c_str()); if (res) - throw std::runtime_error(std::string("Execution of '") + throw std::runtime_error("Execution of '"s + command.c_str() + "' returned exit code " + std::to_string(WEXITSTATUS(res))); } @@ -1029,7 +1031,7 @@ namespace spot { std::string lt_error = lt_dlerror(); lt_dlexit(); - throw std::runtime_error(std::string("Failed to load '") + throw std::runtime_error("Failed to load '"s + file + "'.\n" + lt_error); } @@ -1046,7 +1048,7 @@ namespace spot // assume they can for POSIX). *reinterpret_cast(dst) = lt_dlsym(h, name); if (dst == nullptr) - throw std::runtime_error(std::string("Failed to resolve symbol '") + throw std::runtime_error("Failed to resolve symbol '"s + name + "' in '" + file + "'."); }; diff --git a/spot/misc/tmpfile.cc b/spot/misc/tmpfile.cc index 7e9108aea..6eda6abff 100644 --- a/spot/misc/tmpfile.cc +++ b/spot/misc/tmpfile.cc @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2013, 2015, 2017 Laboratoire de Recherche et +// Copyright (C) 2013, 2015, 2017, 2018 Laboratoire de Recherche et // Développement de l'Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -24,6 +24,8 @@ #include #include +using namespace std::string_literals; + namespace spot { namespace @@ -73,7 +75,7 @@ namespace spot fd = mkstemp(*name); } if (fd < 0) - throw std::runtime_error(std::string("failed to create ") + *name); + throw std::runtime_error("failed to create "s + *name); return fd; } } @@ -109,7 +111,7 @@ namespace spot if (fd_ < 0) return; if (::close(fd_)) - throw std::runtime_error(std::string("failed to close ") + name_); + throw std::runtime_error("failed to close "s + name_); fd_ = -1; } @@ -119,7 +121,7 @@ namespace spot char* name; int fd = create_temporary_file(prefix, suffix, &name); if (close(fd)) - throw std::runtime_error(std::string("failed to close ") + name); + throw std::runtime_error("failed to close "s + name); auto cp = to_clean.insert(to_clean.end(), nullptr); *cp = new temporary_file(name, cp); return *cp; diff --git a/spot/parseaut/parseaut.yy b/spot/parseaut/parseaut.yy index 6239bbaa0..bcb3685e3 100644 --- a/spot/parseaut/parseaut.yy +++ b/spot/parseaut/parseaut.yy @@ -43,6 +43,8 @@ #include #include +using namespace std::string_literals; + #ifndef HAVE_STRVERSCMP // If the libc does not have this, a version is compiled in lib/. extern "C" int strverscmp(const char *s1, const char *s2); @@ -877,11 +879,10 @@ properties: | properties IDENTIFIER if (pos.first->second.val != val) { std::ostringstream out(std::ios_base::ate); - error(@2, std::string("'properties: ") - + (val ? "" : "!") + *$2 + "' contradicts..."); + error(@2, "'properties: "s + (val ? "" : "!") + + *$2 + "' contradicts..."); error(pos.first->second.loc, - std::string("... 'properties: ") - + (val ? "!" : "") + *$2 + "... 'properties: "s + (val ? "!" : "") + *$2 + "' previously given here."); } delete $2; @@ -894,11 +895,9 @@ properties: | properties IDENTIFIER if (pos.first->second.val) { std::ostringstream out(std::ios_base::ate); - error(loc, std::string("'properties: !") - + *$3 + "' contradicts..."); - error(pos.first->second.loc, - std::string("... 'properties: ") + *$3 - + "' previously given here."); + error(loc, "'properties: !"s + *$3 + "' contradicts..."); + error(pos.first->second.loc, "... 'properties: "s + *$3 + + "' previously given here."); } delete $3; } @@ -1058,7 +1057,7 @@ acceptance-cond: IDENTIFIER '(' acc-set ')' } else { - error(@1, std::string("unknown acceptance '") + *$1 + error(@1, "unknown acceptance '"s + *$1 + "', expected Fin or Inf"); $$ = new spot::acc_cond::acc_code; } @@ -1837,9 +1836,8 @@ nc-one-ident: IDENTIFIER ':' auto r = res.labels.insert(std::make_pair(*$1, @1)); if (!r.second) { - error(@1, std::string("redefinition of ") + *$1 + "..."); - error(r.first->second, std::string("... ") + *$1 - + " previously defined here"); + error(@1, "redefinition of "s + *$1 + "..."); + error(r.first->second, "... "s + *$1 + " previously defined here"); } $$ = $1; } @@ -2507,7 +2505,7 @@ namespace spot : filename_(name), opts_(opt) { if (hoayyopen(name, &scanner_)) - throw std::runtime_error(std::string("Cannot open file ") + name); + throw std::runtime_error("Cannot open file "s + name); } catch (...) { @@ -2522,7 +2520,7 @@ namespace spot : filename_(name), opts_(opt) { if (hoayyopen(fd, &scanner_)) - throw std::runtime_error(std::string("Cannot open file ") + name); + throw std::runtime_error("Cannot open file "s + name); } catch (...) { diff --git a/spot/taalgos/dot.cc b/spot/taalgos/dot.cc index 39e69e683..91b6065a9 100644 --- a/spot/taalgos/dot.cc +++ b/spot/taalgos/dot.cc @@ -27,6 +27,8 @@ #include #include +using namespace std::string_literals; + namespace spot { namespace @@ -55,7 +57,7 @@ namespace spot // Prevent infinite recursions... if (orig == def.c_str()) throw std::runtime_error - (std::string("SPOT_DOTDEFAULT should not contain '.'")); + ("SPOT_DOTDEFAULT should not contain '.'"); if (!def.empty()) parse_opts(def.c_str()); break; @@ -85,12 +87,12 @@ namespace spot case 'f': if (*options != '(') throw std::runtime_error - (std::string("invalid font specification for dotty()")); + ("invalid font specification for dotty()"); { auto* end = strchr(++options, ')'); if (!end) throw std::runtime_error - (std::string("invalid font specification for dotty()")); + ("invalid font specification for dotty()"); opt_font_ = std::string(options, end - options); options = end + 1; } @@ -128,8 +130,7 @@ namespace spot // SPOT_DEFAULT would be annoying. break; default: - throw std::runtime_error - (std::string("unknown option for dotty(): ") + c); + throw std::runtime_error("unknown option for dotty(): "s + c); } } diff --git a/spot/tl/hierarchy.cc b/spot/tl/hierarchy.cc index 7b9716f5a..ec89ca14d 100644 --- a/spot/tl/hierarchy.cc +++ b/spot/tl/hierarchy.cc @@ -32,6 +32,7 @@ #include #include +using namespace std::string_literals; namespace spot { @@ -460,7 +461,7 @@ namespace spot goto break2; default: throw std::runtime_error - (std::string("nesting_depth(): unknown operator '") + c + '\''); + ("nesting_depth(): unknown operator '"s + c + '\''); } break2: if (want_nnf) diff --git a/spot/tl/unabbrev.cc b/spot/tl/unabbrev.cc index e0164a5ce..c7bc01924 100644 --- a/spot/tl/unabbrev.cc +++ b/spot/tl/unabbrev.cc @@ -21,6 +21,8 @@ #include "config.h" #include +using namespace std::string_literals; + namespace spot { unabbreviator::unabbreviator(const char* opt) @@ -61,9 +63,7 @@ namespace spot re_some_bool_ = true; break; default: - throw std::runtime_error - (std::string("unknown unabbreviation option: ") - + c); + throw std::runtime_error("unknown unabbreviation option: "s + c); } } diff --git a/spot/twa/acc.cc b/spot/twa/acc.cc index 210bc4721..f1228b6c8 100644 --- a/spot/twa/acc.cc +++ b/spot/twa/acc.cc @@ -30,6 +30,8 @@ #include #include +using namespace std::string_literals; + namespace spot { void acc_cond::report_too_many_sets() @@ -1654,7 +1656,7 @@ namespace spot break; default: throw std::runtime_error - (std::string("unknown option for acc_cond::name(): ") + c); + ("unknown option for acc_cond::name(): "s + c); } std::ostringstream os; diff --git a/spot/twa/twagraph.cc b/spot/twa/twagraph.cc index db5ce6976..97a9908ec 100644 --- a/spot/twa/twagraph.cc +++ b/spot/twa/twagraph.cc @@ -26,6 +26,8 @@ #include #include +using namespace std::string_literals; + namespace spot { @@ -791,9 +793,8 @@ namespace spot want_properties = true; break; default: - throw std::runtime_error(std::string("dump_storage_as_dow(): " - "unsupported option '") - + opt[-1] +"'"); + throw std::runtime_error + ("dump_storage_as_dow(): unsupported option '"s + opt[-1] +"'"); } } diff --git a/spot/twaalgos/dot.cc b/spot/twaalgos/dot.cc index 3ee7174d1..eed5688f7 100644 --- a/spot/twaalgos/dot.cc +++ b/spot/twaalgos/dot.cc @@ -39,6 +39,7 @@ #include #include +using namespace std::string_literals; namespace spot { @@ -176,7 +177,7 @@ namespace spot // Prevent infinite recursions... if (orig == def.c_str()) throw std::runtime_error - (std::string("SPOT_DOTDEFAULT should not contain '.'")); + ("SPOT_DOTDEFAULT should not contain '.'"); if (!def.empty()) parse_opts(def.c_str()); break; @@ -312,7 +313,7 @@ namespace spot break; default: throw std::runtime_error - (std::string("unknown option for print_dot(): ") + c); + ("unknown option for print_dot(): "s + c); } if (opt_color_sets_ && !opt_latex_) opt_html_labels_ = true; diff --git a/spot/twaalgos/hoa.cc b/spot/twaalgos/hoa.cc index a992644cb..0a97c0f75 100644 --- a/spot/twaalgos/hoa.cc +++ b/spot/twaalgos/hoa.cc @@ -32,6 +32,8 @@ #include #include +using namespace std::string_literals; + namespace spot { namespace @@ -318,8 +320,7 @@ namespace spot verbose = true; break; default: - throw std::runtime_error - (std::string("unknown option for print_hoa(): ") + c); + throw std::runtime_error("unknown option for print_hoa(): "s + c); } } diff --git a/spot/twaalgos/lbtt.cc b/spot/twaalgos/lbtt.cc index f7a0dda7f..70750eaff 100644 --- a/spot/twaalgos/lbtt.cc +++ b/spot/twaalgos/lbtt.cc @@ -31,6 +31,8 @@ #include "spot/priv/accmap.hh" #include +using namespace std::string_literals; + namespace spot { namespace @@ -142,8 +144,7 @@ namespace spot sba = false; break; default: - throw std::runtime_error - (std::string("unknown option for print_lbtt(): ") + c); + throw std::runtime_error("unknown option for print_lbtt(): "s + c); } lbtt_bfs b(g, os, sba); diff --git a/spot/twaalgos/neverclaim.cc b/spot/twaalgos/neverclaim.cc index bd838f436..674cfe49a 100644 --- a/spot/twaalgos/neverclaim.cc +++ b/spot/twaalgos/neverclaim.cc @@ -29,6 +29,8 @@ #include #include +using namespace std::string_literals; + namespace spot { namespace @@ -61,8 +63,7 @@ namespace spot break; default: throw std::runtime_error - (std::string("unknown option for print_never_claim(): ") - + c); + ("unknown option for print_never_claim(): "s + c); } } diff --git a/spot/twaalgos/strength.cc b/spot/twaalgos/strength.cc index 42cc94251..6e39b06e5 100644 --- a/spot/twaalgos/strength.cc +++ b/spot/twaalgos/strength.cc @@ -23,6 +23,8 @@ #include #include +using namespace std::string_literals; + namespace spot { namespace @@ -206,7 +208,7 @@ namespace spot { if (keep_opt == nullptr || *keep_opt == 0) throw std::runtime_error - (std::string("option for decompose_scc() should not be empty")); + ("option for decompose_scc() should not be empty"); enum strength { Ignore = 0, @@ -247,7 +249,7 @@ namespace spot if ((long unsigned) scc >= n) { throw std::runtime_error - (std::string("decompose_scc(): there is no SCC ") + ("decompose_scc(): there is no SCC "s + std::to_string(scc) + " in this automaton"); } keep_opt = endptr; @@ -272,7 +274,7 @@ namespace spot if (j != scc + 1) { throw std::runtime_error - (std::string("decompose_scc(): there is no SCC 'a") + ("decompose_scc(): there is no SCC 'a"s + std::to_string(scc) + "' in this automaton"); } keep_opt = endptr; @@ -289,7 +291,7 @@ namespace spot break; default: throw std::runtime_error - (std::string("unknown option for decompose_scc(): ") + c); + ("unknown option for decompose_scc(): "s + c); } auto p = aut->acc().unsat_mark(); diff --git a/spot/twaalgos/word.cc b/spot/twaalgos/word.cc index cd117d898..ce5bd5861 100644 --- a/spot/twaalgos/word.cc +++ b/spot/twaalgos/word.cc @@ -25,6 +25,8 @@ #include #include +using namespace std::string_literals; + namespace spot { twa_word::twa_word(const twa_run_ptr& run) @@ -185,7 +187,7 @@ namespace spot }; // Parse the prefix part. Can be empty. - while (word.substr(i, 6) != std::string("cycle{")) + while (word.substr(i, 6) != "cycle{"s) { ind = skip_next_formula(word, i); if (ind == std::string::npos)