diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-08-03 14:15:41 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-08-03 14:15:41 +0200 |
commit | 8a9b868f9e588db265ac7aeb30070b2cd0859c35 (patch) | |
tree | 497ad58332ddbfcb5cb7279f839d04b3c39082fc | |
parent | e5eedce2b8db0c141b141cdf6b4f7bc121e7c16a (diff) |
Issue diagnostics instead of asserting on variable type/visibility change
-rw-r--r-- | build2/variable.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/build2/variable.cxx b/build2/variable.cxx index fbdedb3..1bfd21c 100644 --- a/build2/variable.cxx +++ b/build2/variable.cxx @@ -1004,13 +1004,15 @@ namespace build2 bool ut (t != nullptr && var.type != t); bool uv (v != nullptr && var.visibility != *v); - // In the global pool existing variables can only be updated during - // the same load generation or during serial execution. + // In the global pool existing variables can only be updated during the + // same load generation or during serial execution. // - assert (!global_ || - !(ut || uv) || - load_generation == 0 || - var.generation == load_generation); + if (global_ && + load_generation != 0 && + load_generation != var.generation && + (ut || uv)) + fail << "variable " << var.name << " already defined with different " + << (ut ? (uv ? "type and visibility" : "type") : "visibility"); // Update type? // |