From 2a4f52c46f2081aaeb2664e8026d3d067142e3d5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 15 Feb 2016 07:18:34 +0200 Subject: Skip until end of -M output instead of just closing pipe Clang 3.7.0 on Fedora didn't like that. --- build2/cxx/compile.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'build2/cxx/compile.cxx') 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 #include +#include // numeric_limits #include // exit() #include @@ -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::max ()); is.close (); // We assume the child process issued some diagnostics. -- cgit v1.1