aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-07-27 02:30:09 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-07-27 02:30:09 +0300
commit24f74ea70a19ccd7bcb489853fc73a972ab8638f (patch)
tree484c10305b5f7e75686b127b48e7e0e380c76f00
parent2880831f78dba2fca9ec72dd63d4fd7cfb9ac445 (diff)
Fix to print to diagnostics stream instead of std::cerr
-rw-r--r--build2/cc/compile.cxx14
-rw-r--r--build2/cc/link.cxx7
-rw-r--r--build2/cc/msvc.cxx6
-rw-r--r--build2/diagnostics.hxx2
4 files changed, 12 insertions, 17 deletions
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx
index b65cee7..805ad82 100644
--- a/build2/cc/compile.cxx
+++ b/build2/cc/compile.cxx
@@ -5,8 +5,6 @@
#include <build2/cc/compile.hxx>
#include <cstdlib> // exit()
-#include <iostream> // cerr
-
#include <build2/depdb.hxx>
#include <build2/scope.hxx>
#include <build2/context.hxx>
@@ -2240,13 +2238,13 @@ namespace build2
// we need to copy the diagnostics for the user to see.
//
// Note that the eof check is important: if the stream is at
- // eof, this and all subsequent writes to cerr will fail (and
- // you won't see a thing).
+ // eof, this and all subsequent writes to the diagnostics stream
+ // will fail (and you won't see a thing).
//
if (bad_error &&
cid == compiler_id::msvc &&
is.peek () != ifdstream::traits_type::eof ())
- cerr << is.rdbuf ();
+ diag_stream_lock () << is.rdbuf ();
is.close ();
@@ -3721,11 +3719,11 @@ namespace build2
// If anything remains in the stream, send it all to stderr. Note
// that the eof check is important: if the stream is at eof, this
- // and all subsequent writes to cerr will fail (and you won't see
- // a thing).
+ // and all subsequent writes to the diagnostics stream will fail
+ // (and you won't see a thing).
//
if (is.peek () != ifdstream::traits_type::eof ())
- cerr << is.rdbuf ();
+ diag_stream_lock () << is.rdbuf ();
is.close ();
}
diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx
index a91fa1e..b113adb 100644
--- a/build2/cc/link.cxx
+++ b/build2/cc/link.cxx
@@ -6,7 +6,6 @@
#include <map>
#include <cstdlib> // exit()
-#include <iostream> // cerr
#include <libbutl/path-map.hxx>
#include <libbutl/filesystem.hxx> // file_exists()
@@ -1713,11 +1712,11 @@ namespace build2
// If anything remains in the stream, send it all to stderr. Note
// that the eof check is important: if the stream is at eof, this
- // and all subsequent writes to cerr will fail (and you won't see
- // a thing).
+ // and all subsequent writes to the diagnostics stream will fail
+ // (and you won't see a thing).
//
if (is.peek () != ifdstream::traits_type::eof ())
- cerr << is.rdbuf ();
+ diag_stream_lock () << is.rdbuf ();
is.close ();
}
diff --git a/build2/cc/msvc.cxx b/build2/cc/msvc.cxx
index b00b8a9..993065d 100644
--- a/build2/cc/msvc.cxx
+++ b/build2/cc/msvc.cxx
@@ -2,8 +2,6 @@
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <iostream> // cerr
-
#include <build2/scope.hxx>
#include <build2/target.hxx>
#include <build2/context.hxx>
@@ -54,7 +52,7 @@ namespace build2
//
string l;
if (getline (is, l) && l != src.leaf ().string ())
- cerr << l << endl;
+ diag_stream_lock () << l << endl;
}
void
@@ -80,7 +78,7 @@ namespace build2
// can't quite reproduce it.
//
- cerr << l << endl;
+ diag_stream_lock () << l << endl;
break;
}
}
diff --git a/build2/diagnostics.hxx b/build2/diagnostics.hxx
index 1b8f370..40ddd0c 100644
--- a/build2/diagnostics.hxx
+++ b/build2/diagnostics.hxx
@@ -111,7 +111,7 @@ namespace build2
// Diagnostic facility, base infrastructure.
//
- using butl::diag_lock;
+ using butl::diag_stream_lock;
using butl::diag_stream;
using butl::diag_epilogue;