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

modernize std::string("foo") into "foo"s

* spot/ltsmin/ltsmin.cc, spot/misc/tmpfile.cc,
spot/parseaut/parseaut.yy, spot/taalgos/dot.cc, spot/tl/hierarchy.cc,
spot/tl/unabbrev.cc, spot/twa/acc.cc, spot/twa/twagraph.cc,
spot/twaalgos/dot.cc, spot/twaalgos/hoa.cc, spot/twaalgos/lbtt.cc,
spot/twaalgos/neverclaim.cc, spot/twaalgos/strength.cc,
spot/twaalgos/word.cc: Replace std::string("foo") by "foo"s, and
include namespace std::string_literals.
parent 832ee81f
Pipeline #2988 passed with stages
in 246 minutes and 37 seconds
......@@ -38,6 +38,8 @@
#include <spot/misc/intvcomp.hh>
#include <spot/misc/intvcmp2.hh>
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<void**>(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 + "'.");
};
......
// -*- 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 <unistd.h>
#include <string.h>
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;
......
......@@ -43,6 +43,8 @@
#include <spot/tl/parse.hh>
#include <spot/twaalgos/alternation.hh>
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 (...)
{
......
......@@ -27,6 +27,8 @@
#include <cstdlib>
#include <cstring>
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);
}
}
......
......@@ -32,6 +32,7 @@
#include <spot/twaalgos/totgba.hh>
#include <spot/twaalgos/cobuchi.hh>
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)
......
......@@ -21,6 +21,8 @@
#include "config.h"
#include <spot/tl/unabbrev.hh>
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);
}
}
......
......@@ -30,6 +30,8 @@
#include <spot/misc/minato.hh>
#include <spot/misc/random.hh>
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;
......
......@@ -26,6 +26,8 @@
#include <vector>
#include <deque>
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] +"'");
}
}
......
......@@ -39,6 +39,7 @@
#include <ctype.h>
#include <utility>
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;
......
......@@ -32,6 +32,8 @@
#include <spot/tl/formula.hh>
#include <spot/kripke/fairkripke.hh>
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);
}
}
......
......@@ -31,6 +31,8 @@
#include "spot/priv/accmap.hh"
#include <spot/tl/print.hh>
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);
......
......@@ -29,6 +29,8 @@
#include <spot/tl/print.hh>
#include <spot/twa/formula2bdd.hh>
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);
}
}
......
......@@ -23,6 +23,8 @@
#include <spot/twaalgos/isweakscc.hh>
#include <spot/twaalgos/mask.hh>
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();
......
......@@ -25,6 +25,8 @@
#include <spot/tl/simplify.hh>
#include <spot/tl/apcollect.hh>
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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment