aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-06-19 08:38:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-06-19 08:38:56 +0200
commitcde3ea58802c700ed8fd3b11e46eb973a7018a12 (patch)
tree03038c64f62b30b56334e7988e6add370520c895
parenta5b95ad0d6ee18f2deb9e98e3058efd12bf0f492 (diff)
Improve diagnostics
-rw-r--r--build2/bash/init.cxx2
-rw-r--r--build2/bin/init.cxx26
-rw-r--r--build2/c/init.cxx8
-rw-r--r--build2/cc/common.cxx8
-rw-r--r--build2/cc/compile-rule.cxx10
-rw-r--r--build2/cc/init.cxx10
-rw-r--r--build2/cc/module.cxx2
-rw-r--r--build2/cli/init.cxx6
-rw-r--r--build2/config/init.cxx2
-rw-r--r--build2/config/operation.cxx2
-rw-r--r--build2/cxx/init.cxx8
-rw-r--r--build2/dist/init.cxx2
-rw-r--r--build2/file.cxx4
-rw-r--r--build2/in/init.cxx4
-rw-r--r--build2/install/init.cxx2
-rw-r--r--build2/parser.cxx2
-rw-r--r--build2/scope.hxx6
-rw-r--r--build2/test/init.cxx2
-rw-r--r--build2/version/init.cxx2
19 files changed, 59 insertions, 49 deletions
diff --git a/build2/bash/init.cxx b/build2/bash/init.cxx
index 9df16b4..6812f2b 100644
--- a/build2/bash/init.cxx
+++ b/build2/bash/init.cxx
@@ -34,7 +34,7 @@ namespace build2
const variable_map&)
{
tracer trace ("bash::init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// Load in.base (in.* varibales, in{} target type).
//
diff --git a/build2/bin/init.cxx b/build2/bin/init.cxx
index 31431a3..3a91646 100644
--- a/build2/bin/init.cxx
+++ b/build2/bin/init.cxx
@@ -47,7 +47,7 @@ namespace build2
const variable_map&)
{
tracer trace ("bin::vars_init");
- l5 ([&]{trace << "for " << rs.out_path ();});
+ l5 ([&]{trace << "for " << rs;});
assert (first);
@@ -139,7 +139,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("bin::config_init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// We only support root loading (which means there can only be one).
//
@@ -382,7 +382,7 @@ namespace build2
{
diag_record dr (text);
- dr << "bin " << project (rs) << '@' << rs.out_path () << '\n'
+ dr << "bin " << project (rs) << '@' << rs << '\n'
<< " target " << cast<target_triplet> (rs["bin.target"]);
if (auto l = rs["bin.pattern"])
@@ -404,7 +404,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("bin::init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// Load bin.config.
//
@@ -558,7 +558,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("bin::ar_config_init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// Make sure bin.config is loaded.
//
@@ -643,7 +643,7 @@ namespace build2
diag_record dr (text);
{
- dr << "bin.ar " << project (rs) << '@' << rs.out_path () << '\n'
+ dr << "bin.ar " << project (rs) << '@' << rs << '\n'
<< " ar " << ari.ar_path << '\n'
<< " id " << ari.ar_id << '\n'
<< " version " << ari.ar_version.string () << '\n'
@@ -711,7 +711,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("bin::ar_init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// Make sure the bin core and ar.config are loaded.
//
@@ -734,7 +734,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("bin::ld_config_init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// Make sure bin.config is loaded.
//
@@ -785,7 +785,7 @@ namespace build2
//
if (verb >= (p.second ? 2 : 3))
{
- text << "bin.ld " << project (rs) << '@' << rs.out_path () << '\n'
+ text << "bin.ld " << project (rs) << '@' << rs << '\n'
<< " ld " << ldi.path << '\n'
<< " id " << ldi.id << '\n'
<< " signature " << ldi.signature << '\n'
@@ -811,7 +811,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("bin::ld_init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// Make sure the bin core and ld.config are loaded.
//
@@ -847,7 +847,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("bin::rc_config_init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// Make sure bin.config is loaded.
//
@@ -898,7 +898,7 @@ namespace build2
//
if (verb >= (p.second ? 2 : 3))
{
- text << "bin.rc " << project (rs) << '@' << rs.out_path () << '\n'
+ text << "bin.rc " << project (rs) << '@' << rs << '\n'
<< " rc " << rci.path << '\n'
<< " id " << rci.id << '\n'
<< " signature " << rci.signature << '\n'
@@ -924,7 +924,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("bin::rc_init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// Make sure the bin core and rc.config are loaded.
//
diff --git a/build2/c/init.cxx b/build2/c/init.cxx
index 438cd3b..0f74539 100644
--- a/build2/c/init.cxx
+++ b/build2/c/init.cxx
@@ -87,7 +87,7 @@ namespace build2
*v == "17") && cver < 17)) // Since VS2012/11.0.
{
fail << "C" << *v << " is not supported by " << ci.signature <<
- info << "required by " << project (rs) << '@' << rs.out_path ();
+ info << "required by " << project (rs) << '@' << rs;
}
}
break;
@@ -132,7 +132,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("c::guess_init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// We only support root loading (which means there can only be one).
//
@@ -257,7 +257,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("c::config_init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// We only support root loading (which means there can only be one).
//
@@ -297,7 +297,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("c::init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// We only support root loading (which means there can only be one).
//
diff --git a/build2/cc/common.cxx b/build2/cc/common.cxx
index 1bfb354..b4b0a6d 100644
--- a/build2/cc/common.cxx
+++ b/build2/cc/common.cxx
@@ -971,7 +971,7 @@ namespace build2
// Extract user-supplied search paths (i.e., -L, /LIBPATH).
//
- auto extract = [&r, this] (const value& val, const variable& what)
+ auto extract = [&bs, &r, this] (const value& val, const variable& var)
{
const auto& v (cast<strings> (val));
@@ -1012,8 +1012,10 @@ namespace build2
}
catch (const invalid_path& e)
{
- fail << "invalid path '" << e.path << "' in option '" << o
- << "' in variable " << what;
+ fail << "invalid directory '" << e.path << "'"
+ << " in option '" << o << "'"
+ << " in variable " << var
+ << " for scope " << bs;
}
// Ignore relative paths. Or maybe we should warn?
diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx
index 2edb8cc..1ea3800 100644
--- a/build2/cc/compile-rule.cxx
+++ b/build2/cc/compile-rule.cxx
@@ -1293,16 +1293,18 @@ namespace build2
}
catch (const invalid_path& e)
{
- fail << "invalid -I directory " << e.path
- << " in variable " << var.name
+ fail << "invalid directory '" << e.path << "'"
+ << " in option '" << o << "'"
+ << " in variable " << var
<< " for target " << t;
}
l6 ([&]{trace << "-I " << d;});
if (d.relative ())
- fail << "relative -I directory " << d
- << " in variable " << var.name
+ fail << "relative directory " << d
+ << " in option '" << o << "'"
+ << " in variable " << var
<< " for target " << t;
// If the directory is not normalized, we can complain or normalize
diff --git a/build2/cc/init.cxx b/build2/cc/init.cxx
index d9c1371..4223d84 100644
--- a/build2/cc/init.cxx
+++ b/build2/cc/init.cxx
@@ -67,7 +67,7 @@ namespace build2
const variable_map&)
{
tracer trace ("cc::core_vars_init");
- l5 ([&]{trace << "for " << rs.out_path ();});
+ l5 ([&]{trace << "for " << rs;});
assert (first);
@@ -160,7 +160,7 @@ namespace build2
const variable_map& h)
{
tracer trace ("cc::core_guess_init");
- l5 ([&]{trace << "for " << rs.out_path ();});
+ l5 ([&]{trace << "for " << rs;});
assert (first);
@@ -225,7 +225,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("cc::core_config_init");
- l5 ([&]{trace << "for " << rs.out_path ();});
+ l5 ([&]{trace << "for " << rs;});
assert (first);
@@ -339,7 +339,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("cc::core_init");
- l5 ([&]{trace << "for " << rs.out_path ();});
+ l5 ([&]{trace << "for " << rs;});
assert (first);
@@ -397,7 +397,7 @@ namespace build2
const location& loc,
const variable_map& hints)
{
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// We only support root loading (which means there can only be one).
//
diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx
index 436688a..aa775ae 100644
--- a/build2/cc/module.cxx
+++ b/build2/cc/module.cxx
@@ -423,7 +423,7 @@ namespace build2
diag_record dr (text);
{
- dr << x << ' ' << project (rs) << '@' << rs.out_path () << '\n'
+ dr << x << ' ' << project (rs) << '@' << rs << '\n'
<< " " << left << setw (11) << x << ci.path << '\n'
<< " id " << ci.id << '\n'
<< " version " << ci.version.string << '\n'
diff --git a/build2/cli/init.cxx b/build2/cli/init.cxx
index acbbb33..35ef04e 100644
--- a/build2/cli/init.cxx
+++ b/build2/cli/init.cxx
@@ -35,7 +35,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("cli::config_init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
assert (hints.empty ()); // We don't known any hints.
@@ -263,7 +263,7 @@ namespace build2
if (verb >= (nv ? 2 : 3))
{
diag_record dr (text);
- dr << "cli " << project (rs) << '@' << rs.out_path () << '\n';
+ dr << "cli " << project (rs) << '@' << rs << '\n';
if (conf)
dr << " cli " << pp << '\n'
@@ -306,7 +306,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("cli::init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// Make sure the cxx module has been loaded since we need its targets
// types (?xx{}). Note that we don't try to load it ourselves because of
diff --git a/build2/config/init.cxx b/build2/config/init.cxx
index 9c50335..7b518ab 100644
--- a/build2/config/init.cxx
+++ b/build2/config/init.cxx
@@ -27,7 +27,7 @@ namespace build2
{
tracer trace ("config::boot");
- l5 ([&]{trace << "for " << rs.out_path ();});
+ l5 ([&]{trace << "for " << rs;});
const string& mname (current_mname);
const string& oname (current_oname);
diff --git a/build2/config/operation.cxx b/build2/config/operation.cxx
index 7d6fc74..f857330 100644
--- a/build2/config/operation.cxx
+++ b/build2/config/operation.cxx
@@ -225,7 +225,7 @@ namespace build2
dr << warn (loc) << "saving previously inherited variable "
<< var;
- dr << info (loc) << "because project " << r->out_path ()
+ dr << info (loc) << "because project " << *r
<< " no longer uses it in its configuration";
if (verb >= 2)
diff --git a/build2/cxx/init.cxx b/build2/cxx/init.cxx
index 92d5da8..25b6c0d 100644
--- a/build2/cxx/init.cxx
+++ b/build2/cxx/init.cxx
@@ -129,7 +129,7 @@ namespace build2
if (!sup)
fail << "C++" << *v << " is not supported by " << ci.signature <<
- info << "required by " << project (rs) << '@' << rs.out_path ();
+ info << "required by " << project (rs) << '@' << rs;
if (mj > 19 || (mj == 19 && mi >= 11)) // 15.3
{
@@ -357,7 +357,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("cxx::guess_init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// We only support root loading (which means there can only be one).
//
@@ -506,7 +506,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("cxx::config_init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// We only support root loading (which means there can only be one).
//
@@ -554,7 +554,7 @@ namespace build2
const variable_map& hints)
{
tracer trace ("cxx::init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// We only support root loading (which means there can only be one).
//
diff --git a/build2/dist/init.cxx b/build2/dist/init.cxx
index dabaf45..56f676a 100644
--- a/build2/dist/init.cxx
+++ b/build2/dist/init.cxx
@@ -28,7 +28,7 @@ namespace build2
{
tracer trace ("dist::boot");
- l5 ([&]{trace << "for " << rs.out_path ();});
+ l5 ([&]{trace << "for " << rs;});
// Register the meta-operation.
//
diff --git a/build2/file.cxx b/build2/file.cxx
index f75dd3f..8c7c74c 100644
--- a/build2/file.cxx
+++ b/build2/file.cxx
@@ -1247,7 +1247,7 @@ namespace build2
{
tracer trace ("import");
- l5 ([&]{trace << target << " from " << ibase.out_path ();});
+ l5 ([&]{trace << target << " from " << ibase;});
// If there is no project specified for this target, then our run will be
// short and sweet: we simply return it as empty-project-qualified and
@@ -1368,7 +1368,7 @@ namespace build2
//
for (scope* r (&iroot);; r = r->parent_scope ()->root_scope ())
{
- l5 ([&]{trace << "looking in " << r->out_path ();});
+ l5 ([&]{trace << "looking in " << *r;});
// First check the amalgamation itself.
//
diff --git a/build2/in/init.cxx b/build2/in/init.cxx
index dbbb4c1..1bd93e1 100644
--- a/build2/in/init.cxx
+++ b/build2/in/init.cxx
@@ -30,7 +30,7 @@ namespace build2
const variable_map&)
{
tracer trace ("in::base_init");
- l5 ([&]{trace << "for " << rs.out_path ();});
+ l5 ([&]{trace << "for " << rs;});
assert (first);
@@ -81,7 +81,7 @@ namespace build2
const variable_map&)
{
tracer trace ("in::init");
- l5 ([&]{trace << "for " << bs.out_path ();});
+ l5 ([&]{trace << "for " << bs;});
// Load in.base.
//
diff --git a/build2/install/init.cxx b/build2/install/init.cxx
index 3c2b0d1..06bef86 100644
--- a/build2/install/init.cxx
+++ b/build2/install/init.cxx
@@ -132,7 +132,7 @@ namespace build2
boot (scope& rs, const location&, unique_ptr<module_base>&)
{
tracer trace ("install::boot");
- l5 ([&]{trace << "for " << rs.out_path ();});
+ l5 ([&]{trace << "for " << rs;});
// Register install function family if this is the first instance of the
// install modules.
diff --git a/build2/parser.cxx b/build2/parser.cxx
index f422c2f..1542cf6 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -5389,7 +5389,7 @@ namespace build2
l5 ([&]
{
if (root_ != nullptr)
- trace << "switching to root scope " << root_->out_path ();
+ trace << "switching to root scope " << *root_;
else
trace << "switching to out of project scope";
});
diff --git a/build2/scope.hxx b/build2/scope.hxx
index 83396b4..afd294e 100644
--- a/build2/scope.hxx
+++ b/build2/scope.hxx
@@ -361,6 +361,12 @@ namespace build2
// NULL means no strong amalgamtion.
};
+ inline ostream&
+ operator<< (ostream& os, const scope& s)
+ {
+ return os << s.out_path ().string (); // Always absolute.
+ }
+
// Temporary scope. The idea is to be able to create a temporary scope in
// order not to change the variables in the current scope. Such a scope is
// not entered in to the scope map. As a result it can only be used as a
diff --git a/build2/test/init.cxx b/build2/test/init.cxx
index aa2533a..342add7 100644
--- a/build2/test/init.cxx
+++ b/build2/test/init.cxx
@@ -27,7 +27,7 @@ namespace build2
{
tracer trace ("test::boot");
- l5 ([&]{trace << "for " << rs.out_path ();});
+ l5 ([&]{trace << "for " << rs;});
// Register our operations.
//
diff --git a/build2/version/init.cxx b/build2/version/init.cxx
index c4a0444..77fb35d 100644
--- a/build2/version/init.cxx
+++ b/build2/version/init.cxx
@@ -36,7 +36,7 @@ namespace build2
boot (scope& rs, const location& l, unique_ptr<module_base>& mod)
{
tracer trace ("version::boot");
- l5 ([&]{trace << "for " << rs.out_path ();});
+ l5 ([&]{trace << "for " << rs;});
// Extract the version from the manifest file. As well as summary and
// url while at it.