<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">[Some necromancy here...]</div><div class=""><br class=""></div><div class="">This commit effectively reverted r173361 and r173825, breaking UNIX conformance for our c99 wrapper.</div><div class=""><br class=""></div><div class="">See:</div><div class=""><div class=""><a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html" class="">http://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html</a></div><div class=""><blockquote type="cite" class="">When c99 encounters a compilation error that causes an object file not to be created, it shall write a diagnostic to standard error and continue to compile other source code operands, but it shall not perform the link phase and it shall return a non-zero exit status.<br class=""></blockquote></div></div><div class=""><br class=""></div><div class="">We had a test, but this commit changed that as well (I suppose it could have been better documented).</div><div class=""><br class=""></div><div class="">How easily could this be restricted to only affect CUDA jobs?</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Feb 24, 2016, at 13:49, Justin Lebar via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Author: jlebar<br class="">Date: Wed Feb 24 15:49:28 2016<br class="">New Revision: 261774<br class=""><br class="">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=261774&view=rev" class="">http://llvm.org/viewvc/llvm-project?rev=261774&view=rev</a><br class="">Log:<br class="">Bail on compilation as soon as a job fails.<br class=""><br class="">Summary:<br class="">(Re-land of r260448, which was reverted in r260522 due to a test failure<br class="">in Driver/output-file-cleanup.c that only showed up in fresh builds.)<br class=""><br class="">Previously we attempted to be smart; if one job failed, we'd run all<br class="">jobs that didn't depend on the failing job.<br class=""><br class="">Problem is, this doesn't work well for e.g. CUDA compilation without<br class="">-save-temps.  In this case, the device-side and host-side Assemble<br class="">actions (which actually are responsible for preprocess, compile,<br class="">backend, and assemble, since we're not saving temps) are necessarily<br class="">distinct.  So our clever heuristic doesn't help us, and we repeat every<br class="">error message once for host and once for each device arch.<br class=""><br class="">The main effect of this change, other than fixing CUDA, is that if you<br class="">pass multiple cc files to one instance of clang and you get a compile<br class="">error, we'll stop when the first cc1 job fails.<br class=""><br class="">Reviewers: echristo<br class=""><br class="">Subscribers: cfe-commits, jhen, echristo, tra, rafael<br class=""><br class="">Differential Revision: <a href="http://reviews.llvm.org/D17217" class="">http://reviews.llvm.org/D17217</a><br class=""><br class="">Modified:<br class="">    cfe/trunk/lib/Driver/Compilation.cpp<br class="">    cfe/trunk/test/Driver/output-file-cleanup.c<br class=""><br class="">Modified: cfe/trunk/lib/Driver/Compilation.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=261774&r1=261773&r2=261774&view=diff" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=261774&r1=261773&r2=261774&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/lib/Driver/Compilation.cpp (original)<br class="">+++ cfe/trunk/lib/Driver/Compilation.cpp Wed Feb 24 15:49:28 2016<br class="">@@ -163,39 +163,17 @@ int Compilation::ExecuteCommand(const Co<br class="">   return ExecutionFailed ? 1 : Res;<br class=""> }<br class=""><br class="">-typedef SmallVectorImpl< std::pair<int, const Command *> > FailingCommandList;<br class="">-<br class="">-static bool ActionFailed(const Action *A,<br class="">-                         const FailingCommandList &FailingCommands) {<br class="">-<br class="">-  if (FailingCommands.empty())<br class="">-    return false;<br class="">-<br class="">-  for (FailingCommandList::const_iterator CI = FailingCommands.begin(),<br class="">-         CE = FailingCommands.end(); CI != CE; ++CI)<br class="">-    if (A == &(CI->second->getSource()))<br class="">-      return true;<br class="">-<br class="">-  for (const Action *AI : A->inputs())<br class="">-    if (ActionFailed(AI, FailingCommands))<br class="">-      return true;<br class="">-<br class="">-  return false;<br class="">-}<br class="">-<br class="">-static bool InputsOk(const Command &C,<br class="">-                     const FailingCommandList &FailingCommands) {<br class="">-  return !ActionFailed(&C.getSource(), FailingCommands);<br class="">-}<br class="">-<br class="">-void Compilation::ExecuteJobs(const JobList &Jobs,<br class="">-                              FailingCommandList &FailingCommands) const {<br class="">+void Compilation::ExecuteJobs(<br class="">+    const JobList &Jobs,<br class="">+    SmallVectorImpl<std::pair<int, const Command *>> &FailingCommands) const {<br class="">   for (const auto &Job : Jobs) {<br class="">-    if (!InputsOk(Job, FailingCommands))<br class="">-      continue;<br class="">     const Command *FailingCommand = nullptr;<br class="">-    if (int Res = ExecuteCommand(Job, FailingCommand))<br class="">+    if (int Res = ExecuteCommand(Job, FailingCommand)) {<br class="">       FailingCommands.push_back(std::make_pair(Res, FailingCommand));<br class="">+      // Bail as soon as one command fails, so we don't output duplicate error<br class="">+      // messages if we die on e.g. the same file.<br class="">+      return;<br class="">+    }<br class="">   }<br class=""> }<br class=""><br class=""><br class="">Modified: cfe/trunk/test/Driver/output-file-cleanup.c<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/output-file-cleanup.c?rev=261774&r1=261773&r2=261774&view=diff" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/output-file-cleanup.c?rev=261774&r1=261773&r2=261774&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/test/Driver/output-file-cleanup.c (original)<br class="">+++ cfe/trunk/test/Driver/output-file-cleanup.c Wed Feb 24 15:49:28 2016<br class="">@@ -38,6 +38,9 @@ invalid C code<br class=""> // RUN: test -f %t1.s<br class=""> // RUN: test ! -f %t2.s<br class=""><br class="">+// When given multiple .c files to compile, clang compiles them in order until<br class="">+// it hits an error, at which point it stops.<br class="">+//<br class=""> // RUN: touch %t1.c<br class=""> // RUN: echo "invalid C code" > %t2.c<br class=""> // RUN: touch %t3.c<br class="">@@ -46,6 +49,6 @@ invalid C code<br class=""> // RUN: cd %T && not %clang -S %t1.c %t2.c %t3.c %t4.c %t5.c<br class=""> // RUN: test -f %t1.s<br class=""> // RUN: test ! -f %t2.s<br class="">-// RUN: test -f %t3.s<br class="">+// RUN: test ! -f %t3.s<br class=""> // RUN: test ! -f %t4.s<br class="">-// RUN: test -f %t5.s<br class="">+// RUN: test ! -f %t5.s<br class=""><br class=""><br class="">_______________________________________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits<br class=""></div></div></blockquote></div><br class=""></div></body></html>