From 8a9b868f9e588db265ac7aeb30070b2cd0859c35 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 3 Aug 2017 14:15:41 +0200 Subject: Issue diagnostics instead of asserting on variable type/visibility change --- build2/variable.cxx | 14 ++++++++------ 1 file 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? // -- cgit v1.1