From ceaad6480139e3c68af2e3d2dbe78588fcdc034f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 27 Oct 2022 16:25:42 +0200 Subject: Suppress (potential) bogus GCC 12 -Wrestrict warnings --- bpkg/cfg-create.cxx | 2 +- bpkg/database.cxx | 2 +- bpkg/fetch-git.cxx | 36 ++++++++++++++++++------------------ bpkg/fetch.cxx | 2 +- bpkg/manifest-utility.cxx | 6 +++--- bpkg/package.cxx | 8 ++++---- bpkg/pkg-build-collect.cxx | 2 +- bpkg/pkg-build.cxx | 4 ++-- bpkg/pkg-checkout.cxx | 2 +- bpkg/pkg-configure.cxx | 4 ++-- bpkg/pkg-verify.cxx | 4 ++-- bpkg/rep-fetch.cxx | 4 ++-- 12 files changed, 38 insertions(+), 38 deletions(-) diff --git a/bpkg/cfg-create.cxx b/bpkg/cfg-create.cxx index 86ce5da..f125e43 100644 --- a/bpkg/cfg-create.cxx +++ b/bpkg/cfg-create.cxx @@ -135,7 +135,7 @@ namespace bpkg // Run quiet. Use path representation to get canonical trailing slash. // - run_b (o, verb_b::quiet, vars, "create(" + params + ")"); + run_b (o, verb_b::quiet, vars, "create(" + params + ')'); } // Create .bpkg/ and its subdirectories. diff --git a/bpkg/database.cxx b/bpkg/database.cxx index 5754fae..6b135fc 100644 --- a/bpkg/database.cxx +++ b/bpkg/database.cxx @@ -467,7 +467,7 @@ namespace bpkg auto drop = [this] (const char* table, const char* column) { execute (std::string ("ALTER TABLE \"main\".") + table + - " DROP COLUMN \"" + column + "\""); + " DROP COLUMN \"" + column + '"'); }; // @@ TMP See migrate_v13() for details. diff --git a/bpkg/fetch-git.cxx b/bpkg/fetch-git.cxx index e2bfb2d..79567e6 100644 --- a/bpkg/fetch-git.cxx +++ b/bpkg/fetch-git.cxx @@ -1736,7 +1736,7 @@ namespace bpkg { auto bad = [&l] () { - throw runtime_error ("invalid submodule option '" + l + "'"); + throw runtime_error ("invalid submodule option '" + l + '\''); }; // The submodule configuration option line is NULL-terminated and @@ -1783,7 +1783,7 @@ namespace bpkg catch (const invalid_path& e) { if (pr.wait ()) - failure ("invalid submodule directory path '" + e.path + "'"); + failure ("invalid submodule directory path '" + e.path + '\''); // Fall through. } @@ -1842,7 +1842,7 @@ namespace bpkg { auto bad = [&l] () { - throw runtime_error ("invalid file description '" + l + "'"); + throw runtime_error ("invalid file description '" + l + '\''); }; // The line describing a file is NULL-terminated and has the @@ -1889,7 +1889,7 @@ namespace bpkg catch (const invalid_path& e) { if (pr.wait ()) - failure ("invalid submodule directory path '" + e.path + "'"); + failure ("invalid submodule directory path '" + e.path + '\''); // Fall through. } @@ -1980,7 +1980,7 @@ namespace bpkg l4 ([&]{trace << "submodule: " << l;}); if (!(l.size () > 50 && l[48] == '0' && l[49] == '\t')) - throw runtime_error ("invalid submodule description '" + l + "'"); + throw runtime_error ("invalid submodule description '" + l + '\''); dir_path d (string (l, 50)); @@ -2014,7 +2014,7 @@ namespace bpkg catch (const invalid_path& e) { if (pr.wait ()) - failure ("invalid submodule path '" + e.path + "'"); + failure ("invalid submodule path '" + e.path + '\''); // Fall through. } @@ -2211,7 +2211,7 @@ namespace bpkg catch (const invalid_path& e) { failure ("invalid submodule '" + sm.name + "' repository path '" + - e.path + "'"); + e.path + '\''); } catch (const invalid_argument& e) { @@ -2452,7 +2452,7 @@ namespace bpkg // 100644 165b42ec7a10fb6dd4a60b756fa1966c1065ef85 0 README // if (!(l.size () > 50 && l[48] == '0' && l[49] == '\t')) - throw runtime_error ("invalid file description '" + l + "'"); + throw runtime_error ("invalid file description '" + l + '\''); // For symlinks permission bits are always zero, so we can match the // mode as a string. @@ -2475,7 +2475,7 @@ namespace bpkg catch (const invalid_path& e) { if (pr.wait ()) - failure ("invalid repository symlink path '" + e.path + "'"); + failure ("invalid repository symlink path '" + e.path + '\''); // Fall through. } @@ -2558,7 +2558,7 @@ namespace bpkg catch (const invalid_path& e) { failure ("invalid target path '" + e.path + "' for symlink '" + - lp.string () + "'", + lp.string () + '\'', &e); } @@ -2577,7 +2577,7 @@ namespace bpkg // if (tp.absolute ()) failure ("absolute target path '" + tp.string () + "' for symlink '" + - lp.string () + "'"); + lp.string () + '\''); // Verify that the symlink target path refers inside the top repository // directory. @@ -2666,7 +2666,7 @@ namespace bpkg // if (r) failure ("unexpected real symlink in submodule '" + - sm.path.string () + "'"); + sm.path.string () + '\''); return nullopt; } @@ -2740,14 +2740,14 @@ namespace bpkg if (e.second.type == entry_type::symlink) { if (r) - failure ("unexpected real symlink '" + l.string () + "'"); + failure ("unexpected real symlink '" + l.string () + '\''); return nullopt; } } catch (const system_error& e) { - failure ("unable to stat symlink '" + l.string () + "'", &e); + failure ("unable to stat symlink '" + l.string () + '\'', &e); } // Read the symlink target path. @@ -2762,7 +2762,7 @@ namespace bpkg catch (const invalid_path& e) { failure ("invalid target path '" + e.path + "' for symlink '" + - l.string () + "'", + l.string () + '\'', &e); } catch (const io_error& e) @@ -2826,7 +2826,7 @@ namespace bpkg catch (const system_error& e) { failure ("unable to stat target '" + t.string () + - "' for symlink '" + l.string () + "'", + "' for symlink '" + l.string () + '\'', &e); } @@ -2844,7 +2844,7 @@ namespace bpkg { failure (string ("unable to create ") + (dir_target ? "junction" : "hardlink") + " '" + - l.string () + "' with target '" + t.string () + "'", + l.string () + "' with target '" + t.string () + '\'', &e); } @@ -2883,7 +2883,7 @@ namespace bpkg catch (const system_error& e) { failure ("unable to remove hardlink, symlink, or junction '" + - l.string () + "'", + l.string () + '\'', &e); } } diff --git a/bpkg/fetch.cxx b/bpkg/fetch.cxx index 00461e9..5ecddbb 100644 --- a/bpkg/fetch.cxx +++ b/bpkg/fetch.cxx @@ -99,7 +99,7 @@ namespace bpkg const string& ua (user_agent.empty () ? BPKG_USER_AGENT " wget/" + to_string (wget_major) + - "." + to_string (wget_minor) + '.' + to_string (wget_minor) : user_agent); cstrings args { diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx index d6a0fd9..5bd273d 100644 --- a/bpkg/manifest-utility.cxx +++ b/bpkg/manifest-utility.cxx @@ -474,7 +474,7 @@ namespace bpkg for (const path& p: bps) { path f (bd / p); - f += "." + e; + f += '.' + e; append_file (f); } @@ -610,7 +610,7 @@ namespace bpkg "package directory"); if (!erp) - e += " " + d.string (); + e += ' ' + d.string (); throw runtime_error (e); } @@ -642,7 +642,7 @@ namespace bpkg string e ("unable to find bootstrap.build file in package directory"); if (!erp) - e += " " + d.string (); + e += ' ' + d.string (); throw runtime_error (e); } diff --git a/bpkg/package.cxx b/bpkg/package.cxx index 6cd555e..fe04248 100644 --- a/bpkg/package.cxx +++ b/bpkg/package.cxx @@ -211,7 +211,7 @@ namespace bpkg // Quote the result as it contains the space character. // - return "'" + name.string () + ' ' + constraint->string () + "'"; + return '\'' + name.string () + ' ' + constraint->string () + '\''; } // selected_package @@ -279,7 +279,7 @@ namespace bpkg if (s == "user") return config_source::user; else if (s == "dependent") return config_source::dependent; else if (s == "reflect") return config_source::reflect; - else throw invalid_argument ("invalid config source '" + s + "'"); + else throw invalid_argument ("invalid config source '" + s + '\''); } shared_ptr @@ -464,7 +464,7 @@ namespace bpkg else if (s == "fetched") return package_state::fetched; else if (s == "unpacked") return package_state::unpacked; else if (s == "configured") return package_state::configured; - else throw invalid_argument ("invalid package state '" + s + "'"); + else throw invalid_argument ("invalid package state '" + s + '\''); } // substate @@ -486,7 +486,7 @@ namespace bpkg { if (s == "none") return package_substate::none; else if (s == "system") return package_substate::system; - else throw invalid_argument ("invalid package substate '" + s + "'"); + else throw invalid_argument ("invalid package substate '" + s + '\''); } // certificate diff --git a/bpkg/pkg-build-collect.cxx b/bpkg/pkg-build-collect.cxx index e7f5c80..244267b 100644 --- a/bpkg/pkg-build-collect.cxx +++ b/bpkg/pkg-build-collect.cxx @@ -4240,7 +4240,7 @@ namespace bpkg size_t depth (pcfg != nullptr ? pcfg->depth : 0); - string t ("collect_build_postponed (" + to_string (depth) + ")"); + string t ("collect_build_postponed (" + to_string (depth) + ')'); tracer trace (t.c_str ()); string trace_suffix; diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 58bb793..78ed73d 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -131,7 +131,7 @@ namespace bpkg try { - return version_constraint ("~" + vs); + return version_constraint ('~' + vs); } // Note that the only possible reason for invalid_argument exception to // be thrown is that minor version reached the 99999 limit (see @@ -3534,7 +3534,7 @@ namespace bpkg l5 ([&]{trace << "collection failed due to " << e.description << (e.package != nullptr - ? " (" + e.package->string () + ")" + ? " (" + e.package->string () + ')' : empty_string) << ", retry from scratch";}); diff --git a/bpkg/pkg-checkout.cxx b/bpkg/pkg-checkout.cxx index 2a3f508..b4d93f0 100644 --- a/bpkg/pkg-checkout.cxx +++ b/bpkg/pkg-checkout.cxx @@ -311,7 +311,7 @@ namespace bpkg verb_b::progress, "--no-external-modules", "!config.dist.bootstrap=true", - "config.dist.root='" + ord.representation () + "'", + "config.dist.root='" + ord.representation () + '\'', bspec); mc = package_checksum (o, d, nullptr /* package_info */); diff --git a/bpkg/pkg-configure.cxx b/bpkg/pkg-configure.cxx index ae5aafd..20a2567 100644 --- a/bpkg/pkg-configure.cxx +++ b/bpkg/pkg-configure.cxx @@ -265,7 +265,7 @@ namespace bpkg // dir_path od (sp->effective_out_root (pdb.config)); vars.push_back ("config.import." + sp->name.variable () + - "='" + od.representation () + "'"); + "='" + od.representation () + '\''); } } } @@ -362,7 +362,7 @@ namespace bpkg dir_path out_root ( p->external () ? c / dir_path (p->name.string ()) - : c / dir_path (p->name.string () + "-" + p->version.string ())); + : c / dir_path (p->name.string () + '-' + p->version.string ())); l4 ([&]{trace << "src_root: " << src_root << ", " << "out_root: " << out_root;}); diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx index 6d5a2fe..0541f1b 100644 --- a/bpkg/pkg-verify.cxx +++ b/bpkg/pkg-verify.cxx @@ -202,7 +202,7 @@ namespace bpkg { // Verify package archive/directory is -. // - dir_path ed (m.name.string () + "-" + m.version.string ()); + dir_path ed (m.name.string () + '-' + m.version.string ()); if (pd != ed) { @@ -509,7 +509,7 @@ namespace bpkg // not clear why we should enforce it in this case (i.e., the user // provides us with a package directory). // - // dir_path ed (m.name + "-" + m.version.string ()); + // dir_path ed (m.name + '-' + m.version.string ()); // // if (d.leaf () != ed) // { diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx index ac5b3b0..30c429f 100644 --- a/bpkg/rep-fetch.cxx +++ b/bpkg/rep-fetch.cxx @@ -410,7 +410,7 @@ namespace bpkg fail << name << " manifest value in " << pkg / manifest_file << " references empty file " << rp << info << "repository " << rl - << (!fragment.empty () ? " " + fragment : ""); + << (!fragment.empty () ? ' ' + fragment : ""); return s; } @@ -420,7 +420,7 @@ namespace bpkg << name << " manifest value in " << pkg / manifest_file << ": " << e << info << "repository " << rl - << (!fragment.empty () ? " " + fragment : "") << endf; + << (!fragment.empty () ? ' ' + fragment : "") << endf; } } -- cgit v1.1