aboutsummaryrefslogtreecommitdiff
path: root/build2/target.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-12-16 14:14:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-12-16 14:14:15 +0200
commit530e8914ba00ce0e7ee89ba30d2b88f2c09f43c9 (patch)
tree0ca06c48d30ae06d8407da34bd02c57140b71062 /build2/target.cxx
parent44e1022f8141bd57756c2be4277c728ca7443eb3 (diff)
Split stream verbosity into components (path, extension)
Use to make sure structured result output always contains absolute target path.
Diffstat (limited to 'build2/target.cxx')
-rw-r--r--build2/target.cxx26
1 files changed, 15 insertions, 11 deletions
diff --git a/build2/target.cxx b/build2/target.cxx
index 99c002b..90b2511 100644
--- a/build2/target.cxx
+++ b/build2/target.cxx
@@ -307,7 +307,7 @@ namespace build2
r << "assuming target ";
to_stream (r.os,
target_key {&t.type (), &t.dir, &t.out, &t.name, ext},
- 2); // Always print the extension.
+ stream_verb_max); // Always print the extension.
r << " is the same as the one with ";
if (!k.ext)
@@ -382,7 +382,7 @@ namespace build2
to_stream (
r.os,
target_key {&t->type (), &t->dir, &t->out, &t->name, ext},
- 2); // Always print the extension.
+ stream_verb_max); // Always print the extension.
r << " is the same as the one with ";
if (!e)
@@ -416,9 +416,11 @@ namespace build2
}
ostream&
- to_stream (ostream& os, const target_key& k, uint16_t ev)
+ to_stream (ostream& os, const target_key& k, optional<stream_verbosity> osv)
{
- uint16_t dv (stream_verb (os)); // Directory verbosity.
+ stream_verbosity sv (osv ? *osv : stream_verb (os));
+ uint16_t dv (sv.path);
+ uint16_t ev (sv.extension);
// If the name is empty, then we want to print the last component of the
// directory inside {}, e.g., dir{bar/}, not bar/dir{}.
@@ -427,12 +429,12 @@ namespace build2
// Note: relative() returns empty for './'.
//
- const dir_path& rd (dv < 2 ? relative (*k.dir) : *k.dir); // Relative.
+ const dir_path& rd (dv < 1 ? relative (*k.dir) : *k.dir); // Relative.
const dir_path& pd (n ? rd : rd.directory ()); // Parent.
if (!pd.empty ())
{
- if (dv < 2)
+ if (dv < 1)
os << diag_relative (pd);
else
os << pd.representation ();
@@ -472,7 +474,7 @@ namespace build2
//
if (!k.out->empty ())
{
- if (dv < 2)
+ if (dv < 1)
{
// Don't print '@./'.
//
@@ -666,15 +668,17 @@ namespace build2
void
target_print_0_ext_verb (ostream& os, const target_key& k)
{
- uint16_t v (stream_verb (os));
- to_stream (os, k, v < 2 ? 0 : v); // Remap 1 to 0.
+ stream_verbosity sv (stream_verb (os));
+ if (sv.extension == 1) sv.extension = 0; // Remap 1 to 0.
+ to_stream (os, k, sv);
}
void
target_print_1_ext_verb (ostream& os, const target_key& k)
{
- uint16_t v (stream_verb (os));
- to_stream (os, k, v < 1 ? 1 : v); // Remap 0 to 1.
+ stream_verbosity sv (stream_verb (os));
+ if (sv.extension == 0) sv.extension = 1; // Remap 0 to 1.
+ to_stream (os, k, sv);
}
// type info