diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2016-11-03 15:58:11 +0300 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-04 09:26:37 +0200 |
commit | 57c7577fa91ffc024e5c696a91abe19f5547a787 (patch) | |
tree | 410a09a2d1ebf6da5e770b644c7a1806f2d1aef9 | |
parent | d933699b4dd106c227f8d07a2471d5f39f1c82af (diff) |
Fix Clang and VC warnings
-rw-r--r-- | build2/bin/target | 6 | ||||
-rw-r--r-- | build2/test/script/runner.cxx | 6 | ||||
-rw-r--r-- | build2/test/script/script.cxx | 2 | ||||
-rw-r--r-- | tests/test/script/runner/driver.cxx | 7 |
4 files changed, 16 insertions, 5 deletions
diff --git a/build2/bin/target b/build2/bin/target index 0a324a5..caf96f4 100644 --- a/build2/bin/target +++ b/build2/bin/target @@ -105,7 +105,11 @@ namespace build2 public: static const target_type static_type; - virtual const target_type& dynamic_type () const {return static_type;} + + virtual const target_type& dynamic_type () const override + { + return static_type; + } }; // Windows import library. diff --git a/build2/test/script/runner.cxx b/build2/test/script/runner.cxx index 29f7a37..b071cf3 100644 --- a/build2/test/script/runner.cxx +++ b/build2/test/script/runner.cxx @@ -526,7 +526,11 @@ namespace build2 // stderr (if cached), print the proper diagnostics and fail. // optional<process::status_type> status (move (pr.status)); - bool valid_status (status && *status >= 0 && *status < 256); + + // Comparison *status >= 0 causes "always true" warning on Windows + // where process::status_type is defined as uint32_t. + // + bool valid_status (status && *status + 1 > 0 && *status < 256); bool eq (c.exit.comparison == exit_comparison::eq); bool correct_status (valid_status && diff --git a/build2/test/script/script.cxx b/build2/test/script/script.cxx index e453d44..2679cb7 100644 --- a/build2/test/script/script.cxx +++ b/build2/test/script/script.cxx @@ -433,7 +433,7 @@ namespace build2 if (const value* v = p->vars.find (var)) return lookup (v, &p->vars); } - while (p->parent != nullptr ? (p = p->parent) : nullptr); + while ((p->parent != nullptr ? (p = p->parent) : nullptr) != nullptr); // Switch to the corresponding buildfile variable. Note that we don't // want to insert a new variable into the pool (we might be running diff --git a/tests/test/script/runner/driver.cxx b/tests/test/script/runner/driver.cxx index 10d5857..a82b083 100644 --- a/tests/test/script/runner/driver.cxx +++ b/tests/test/script/runner/driver.cxx @@ -38,17 +38,20 @@ main (int argc, char* argv[]) auto toi = [] (const string& s) -> int { + int r (-1); + try { size_t n; - int r (stoi (s, &n)); + r = stoi (s, &n); assert (n == s.size ()); - return r; } catch (const exception&) { assert (false); } + + return r; }; if (o == "-i") |