From 5af9070fda0dba591264ed675920efcfd62e81bc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 8 Apr 2015 16:09:31 +0200 Subject: Distinguish between undefined and null variables --- build/cxx/module.cxx | 60 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 22 deletions(-) (limited to 'build/cxx/module.cxx') diff --git a/build/cxx/module.cxx b/build/cxx/module.cxx index 2bfdc41..e29d311 100644 --- a/build/cxx/module.cxx +++ b/build/cxx/module.cxx @@ -104,41 +104,57 @@ namespace build // // These are optional so all we need to do is "import" them // into the root scope if they were specified on the command - // line and set them to empty if unspecified (the last part + // line and set them to NULL if unspecified (the last part // is important to distinguish between the "configured as - // undefined" and "not configured" cases). + // unspecified" and "not configured" cases). // - if (auto val = root["config.cxx.poptions"]) { - if (val.scope == global_scope) - root.variables["config.cxx.poptions"] = val; + auto v (root["config.cxx.poptions"]); + + if (v.defined ()) + { + if (v.scope == global_scope) + root.variables["config.cxx.poptions"] = v; + } + else + root.variables["config.cxx.poptions"]; // Set to NULL. } - else - root.variables["config.cxx.poptions"]; // Undefined. - if (auto val = root["config.cxx.coptions"]) { - if (val.scope == global_scope) - root.variables["config.cxx.coptions"] = val; + auto v (root["config.cxx.coptions"]); + + if (v.defined ()) + { + if (v.scope == global_scope) + root.variables["config.cxx.coptions"] = v; + } + else + root.variables["config.cxx.coptions"]; // Set to NULL. } - else - root.variables["config.cxx.coptions"]; // Undefined. - if (auto val = root["config.cxx.loptions"]) { - if (val.scope == global_scope) - root.variables["config.cxx.loptions"] = val; + auto v (root["config.cxx.loptions"]); + + if (v.defined ()) + { + if (v.scope == global_scope) + root.variables["config.cxx.loptions"] = v; + } + else + root.variables["config.cxx.loptions"]; // Set to NULL. } - else - root.variables["config.cxx.loptions"]; // Undefined. - if (auto val = root["config.cxx.libs"]) { - if (val.scope == global_scope) - root.variables["config.cxx.libs"] = val; + auto v (root["config.cxx.libs"]); + + if (v.defined ()) + { + if (v.scope == global_scope) + root.variables["config.cxx.libs"] = v; + } + else + root.variables["config.cxx.libs"]; // Set to NULL. } - else - root.variables["config.cxx.libs"]; // Undefined. } } } -- cgit v1.1