aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-02-15 07:18:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-02-15 07:18:34 +0200
commit2a4f52c46f2081aaeb2664e8026d3d067142e3d5 (patch)
tree3700883b0e1862c6fa54f6fe58d161ffd36274d6
parent97779063df86fa8451c62c97139411ad78f75012 (diff)
Skip until end of -M output instead of just closing pipe
Clang 3.7.0 on Fedora didn't like that.
-rw-r--r--build2/cxx/compile.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx
index 22a25cb..bc1681b 100644
--- a/build2/cxx/compile.cxx
+++ b/build2/cxx/compile.cxx
@@ -5,6 +5,7 @@
#include <build2/cxx/compile>
#include <map>
+#include <limits> // numeric_limits
#include <cstdlib> // exit()
#include <butl/process>
@@ -673,10 +674,14 @@ namespace build2
}
}
- // We may not have read all the output (e.g., due to a restart),
- // so close the file descriptor before waiting to avoid blocking
- // the other end.
+ // We may not have read all the output (e.g., due to a restart).
+ // Before we used to just close the file descriptor to signal to the
+ // other end that we are not interested in the rest. This works fine
+ // with GCC but Clang (3.7.0) finds this impolite and complains,
+ // loudly (broken pipe). So now we are going to skip until the end.
//
+ if (!is.eof ())
+ is.ignore (numeric_limits<streamsize>::max ());
is.close ();
// We assume the child process issued some diagnostics.