aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-10-27 15:52:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-10-27 16:06:26 +0200
commitbc6050a7b42581f0d4fbbe3f4b38b7ed02239d72 (patch)
treeafa63befc8013387c8eabee22f53092330be82b3
parent95ee62c4079e68d9b2444b490cfb68c703023ab8 (diff)
Suppress bogus GCC 12 -Wrestrict warning
-rw-r--r--libbutl/b.cxx4
-rw-r--r--libbutl/command.cxx8
-rw-r--r--libbutl/path.cxx4
-rw-r--r--tests/standard-version/driver.cxx4
-rw-r--r--tests/timestamp/driver.cxx6
5 files changed, 13 insertions, 13 deletions
diff --git a/libbutl/b.cxx b/libbutl/b.cxx
index 74a430c..ee5c8a5 100644
--- a/libbutl/b.cxx
+++ b/libbutl/b.cxx
@@ -87,7 +87,7 @@ namespace butl
// Note that quoting is essential here.
//
for (const dir_path& p: projects)
- ps.push_back ("'" + p.representation () + "'");
+ ps.push_back ('\'' + p.representation () + '\'');
pr = process_start_callback (
cmd_callback ? cmd_callback : [] (const char* const*, size_t) {},
@@ -297,7 +297,7 @@ namespace butl
assert (!pr.wait ());
throw b_error (
- string ("process ") + pp.recall_string () + " " + to_string (*pr.exit),
+ string ("process ") + pp.recall_string () + ' ' + to_string (*pr.exit),
move (pr.exit));
}
catch (const process_error& e)
diff --git a/libbutl/command.cxx b/libbutl/command.cxx
index 6f8c0f1..2df52dd 100644
--- a/libbutl/command.cxx
+++ b/libbutl/command.cxx
@@ -51,7 +51,7 @@ namespace butl
//
if (p == string::npos)
throw invalid_argument (string ("unmatched substitution character '") +
- open + "'");
+ open + '\'');
if (p == sp)
throw invalid_argument ("empty substitution variable");
@@ -60,12 +60,12 @@ namespace butl
if (vn.find_first_of (" \t") != string::npos)
throw invalid_argument ("whitespace in substitution variable '" +
- vn + "'");
+ vn + '\'');
// Find the variable and append its value or fail if it's unknown.
//
if (!sc (vn, r))
- throw invalid_argument ("unknown substitution variable '" + vn + "'");
+ throw invalid_argument ("unknown substitution variable '" + vn + '\'');
}
// Append the source string tail following the last substitution.
@@ -168,7 +168,7 @@ namespace butl
catch (const invalid_path& e)
{
throw invalid_argument ("invalid stdout redirect file path '" +
- e.path + "'");
+ e.path + '\'');
}
if (redir->empty ())
diff --git a/libbutl/path.cxx b/libbutl/path.cxx
index e4f373e..bd66f13 100644
--- a/libbutl/path.cxx
+++ b/libbutl/path.cxx
@@ -184,8 +184,8 @@ namespace butl
using std::to_string;
return prefix
- + "-" + to_string (process::current_id ())
- + "-" + to_string (temp_name_count++);
+ + '-' + to_string (process::current_id ())
+ + '-' + to_string (temp_name_count++);
}
template <>
diff --git a/tests/standard-version/driver.cxx b/tests/standard-version/driver.cxx
index 29cad54..4bddf08 100644
--- a/tests/standard-version/driver.cxx
+++ b/tests/standard-version/driver.cxx
@@ -83,7 +83,7 @@ version (const string& s,
if (v.minor () != 99999)
{
- standard_version_constraint c1 ("~" + s);
+ standard_version_constraint c1 ('~' + s);
standard_version_constraint c2 ('[' + s + ' ' + max_ver ('~') + ')');
assert (c1 == c2);
}
@@ -91,7 +91,7 @@ version (const string& s,
if ((v.major () == 0 && v.minor () != 99999) ||
(v.major () != 0 && v.major () != 99999))
{
- standard_version_constraint c1 ("^" + s);
+ standard_version_constraint c1 ('^' + s);
standard_version_constraint c2 ('[' + s + ' ' + max_ver ('^') + ')');
assert (c1 == c2);
}
diff --git a/tests/timestamp/driver.cxx b/tests/timestamp/driver.cxx
index 11f328a..956b295 100644
--- a/tests/timestamp/driver.cxx
+++ b/tests/timestamp/driver.cxx
@@ -178,15 +178,15 @@ main ()
assert (parse (".384902285 Feb 21 19:31:10 2016",
"%[.N] %b %d %H:%M:%S %Y",
- "." + ns (384902285) + " Feb 21 19:31:10 2016"));
+ '.' + ns (384902285) + " Feb 21 19:31:10 2016"));
assert (parse (".384902285 2016-02-21 19:31:10",
"%[.N] %Y-%m-%d %H:%M:%S",
- "." + ns (384902285) + " 2016-02-21 19:31:10"));
+ '.' + ns (384902285) + " 2016-02-21 19:31:10"));
assert (parse (".3849022852016-02-21 19:31:10",
"%[.N]%Y-%m-%d %H:%M:%S",
- "." + ns (384902285) + "2016-02-21 19:31:10"));
+ '.' + ns (384902285) + "2016-02-21 19:31:10"));
assert (parse ("Feb 1 2016", "%b %e %Y", "Feb 1 2016"));
assert (parse ("Feb 11 2016", "%b %e %Y", "Feb 11 2016"));