From 6b9dbfaaf2b3dfdf3627b57c7f15c6a3cd105f35 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 27 Oct 2022 15:57:19 +0200 Subject: Suppress (potential) bogus GCC 12 -Wrestrict warnings --- libbuild2/bash/rule.cxx | 4 ++-- libbuild2/cc/compile-rule.cxx | 6 +++--- libbuild2/cc/guess.cxx | 2 +- libbuild2/functions-builtin.cxx | 2 +- libbuild2/functions-regex.cxx | 8 ++++---- libbuild2/functions-string.cxx | 4 ++-- libbuild2/parser.cxx | 2 +- libbuild2/test/script/script.cxx | 2 +- libbuild2/variable.cxx | 6 +++--- libbuild2/variable.txx | 2 +- libbuild2/version/rule.cxx | 12 ++++++------ 11 files changed, 25 insertions(+), 25 deletions(-) (limited to 'libbuild2') diff --git a/libbuild2/bash/rule.cxx b/libbuild2/bash/rule.cxx index 6e287e0..29c6a2a 100644 --- a/libbuild2/bash/rule.cxx +++ b/libbuild2/bash/rule.cxx @@ -406,7 +406,7 @@ namespace build2 "source \"$(dirname" " \"$(readlink -f" " \"${BASH_SOURCE[0]}\")\")/" - + iip.string () + "\""; + + iip.string () + '"'; } else { @@ -427,7 +427,7 @@ namespace build2 return "source \"$(dirname" " \"${BASH_SOURCE[0]}\")/" - + o + iip.string () + "\""; + + o + iip.string () + '"'; } } else diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index 8d507e7..3a750a1 100644 --- a/libbuild2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -175,7 +175,7 @@ namespace build2 if (s == "includes") return preprocessed::includes; if (s == "modules") return preprocessed::modules; if (s == "all") return preprocessed::all; - throw invalid_argument ("invalid preprocessed value '" + s + "'"); + throw invalid_argument ("invalid preprocessed value '" + s + '\''); } // Return true if the compiler supports -isystem (GCC class) or @@ -2659,7 +2659,7 @@ namespace build2 rs = !exists ? string ("INCLUDE") : ("ERROR unable to update header '" + - (ht != nullptr ? ht->path () : f).string () + "'"); + (ht != nullptr ? ht->path () : f).string () + '\''); bad_error = true; break; @@ -2737,7 +2737,7 @@ namespace build2 } catch (const failed&) { - rs = "ERROR unable to update header unit '" + hp + "'"; + rs = "ERROR unable to update header unit '" + hp + '\''; bad_error = true; break; } diff --git a/libbuild2/cc/guess.cxx b/libbuild2/cc/guess.cxx index 23c0b70..e851ea8 100644 --- a/libbuild2/cc/guess.cxx +++ b/libbuild2/cc/guess.cxx @@ -106,7 +106,7 @@ namespace build2 else if (id.compare (0, p, "icc" ) == 0) type = compiler_type::icc; else throw invalid_argument ( - "invalid compiler type '" + string (id, 0, p) + "'"); + "invalid compiler type '" + string (id, 0, p) + '\''); if (p != string::npos) { diff --git a/libbuild2/functions-builtin.cxx b/libbuild2/functions-builtin.cxx index f85c342..6bf2264 100644 --- a/libbuild2/functions-builtin.cxx +++ b/libbuild2/functions-builtin.cxx @@ -26,7 +26,7 @@ namespace build2 if (s == "dedup") r = true; else - throw invalid_argument ("invalid flag '" + s + "'"); + throw invalid_argument ("invalid flag '" + s + '\''); } } return r; diff --git a/libbuild2/functions-regex.cxx b/libbuild2/functions-regex.cxx index 2f0d122..f0fee8d 100644 --- a/libbuild2/functions-regex.cxx +++ b/libbuild2/functions-regex.cxx @@ -69,7 +69,7 @@ namespace build2 else if (s == "return_subs") subs = true; else - throw invalid_argument ("invalid flag '" + s + "'"); + throw invalid_argument ("invalid flag '" + s + '\''); } } @@ -129,7 +129,7 @@ namespace build2 else if (s == "return_subs") subs = true; else - throw invalid_argument ("invalid flag '" + s + "'"); + throw invalid_argument ("invalid flag '" + s + '\''); } } @@ -192,7 +192,7 @@ namespace build2 else if (s == "format_no_copy") mf |= regex_constants::format_no_copy; else - throw invalid_argument ("invalid flag '" + s + "'"); + throw invalid_argument ("invalid flag '" + s + '\''); } } @@ -411,7 +411,7 @@ namespace build2 if (s == "icase") r |= regex::icase; else - throw invalid_argument ("invalid flag '" + s + "'"); + throw invalid_argument ("invalid flag '" + s + '\''); } } diff --git a/libbuild2/functions-string.cxx b/libbuild2/functions-string.cxx index a41449a..f5d7cb1 100644 --- a/libbuild2/functions-string.cxx +++ b/libbuild2/functions-string.cxx @@ -21,7 +21,7 @@ namespace build2 if (s == "icase") ic = true; else - throw invalid_argument ("invalid flag '" + s + "'"); + throw invalid_argument ("invalid flag '" + s + '\''); } } @@ -140,7 +140,7 @@ namespace build2 else if (s == "dedup") dd = true; else - throw invalid_argument ("invalid flag '" + s + "'"); + throw invalid_argument ("invalid flag '" + s + '\''); } } diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx index 76317fe..ed3b144 100644 --- a/libbuild2/parser.cxx +++ b/libbuild2/parser.cxx @@ -3260,7 +3260,7 @@ namespace build2 report = move (v); else throw invalid_argument ( - "expected 'false' or format name instead of '" + v + "'"); + "expected 'false' or format name instead of '" + v + '\''); } catch (const invalid_argument& e) { diff --git a/libbuild2/test/script/script.cxx b/libbuild2/test/script/script.cxx index bbe5326..05dc7b0 100644 --- a/libbuild2/test/script/script.cxx +++ b/libbuild2/test/script/script.cxx @@ -502,7 +502,7 @@ namespace build2 if (p == string::npos) { - v = "'" + v + "'"; + v = '\'' + v + '\''; continue; } diff --git a/libbuild2/variable.cxx b/libbuild2/variable.cxx index dabddca..0017633 100644 --- a/libbuild2/variable.cxx +++ b/libbuild2/variable.cxx @@ -451,11 +451,11 @@ namespace build2 m = "invalid " + t + " value "; if (n.simple ()) - m += "'" + n.value + "'"; + m += '\'' + n.value + '\''; else if (n.directory ()) - m += "'" + n.dir.representation () + "'"; + m += '\'' + n.dir.representation () + '\''; else - m += "name '" + to_string (n) + "'"; + m += "name '" + to_string (n) + '\''; } throw invalid_argument (m); diff --git a/libbuild2/variable.txx b/libbuild2/variable.txx index d75befb..fda3486 100644 --- a/libbuild2/variable.txx +++ b/libbuild2/variable.txx @@ -492,7 +492,7 @@ namespace build2 if (n.pair != '@') throw invalid_argument ( - string ("invalid pair character: '") + n.pair + "'"); + string ("invalid pair character: '") + n.pair + '\''); } v.push_back (value_traits::convert (move (n), r)); diff --git a/libbuild2/version/rule.cxx b/libbuild2/version/rule.cxx index f810ce7..98dc2da 100644 --- a/libbuild2/version/rule.cxx +++ b/libbuild2/version/rule.cxx @@ -241,13 +241,13 @@ namespace build2 if (mav->snapshot ()) { - r += (p ? "(" : ""); + if (p) r += '('; r += cmp (vm, " < ", mav->version) + " || ("; r += cmp (vm, " == ", mav->version) + " && "; - r += cmp (sm, (mao ? " < " : " <= "), mav->snapshot_sn) + ")"; + r += cmp (sm, (mao ? " < " : " <= "), mav->snapshot_sn) + ')'; - r += (p ? ")" : ""); + if (p) r += ')'; } else r = cmp (vm, (mao ? " < " : " <= "), mav->version); @@ -261,13 +261,13 @@ namespace build2 if (miv->snapshot ()) { - r += (p ? "(" : ""); + if (p) r += '('; r += cmp (vm, " > ", miv->version) + " || ("; r += cmp (vm, " == ", miv->version) + " && "; - r += cmp (sm, (mio ? " > " : " >= "), miv->snapshot_sn) + ")"; + r += cmp (sm, (mio ? " > " : " >= "), miv->snapshot_sn) + ')'; - r += (p ? ")" : ""); + if (p) r += ')'; } else r = cmp (vm, (mio ? " > " : " >= "), miv->version); -- cgit v1.1