Make FakeCppCompileAction fail if its source file doesn't compile without any extra defines.

PiperOrigin-RevId: 153039146
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
index 26b3fc5..9fac16b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
@@ -37,7 +37,6 @@
 import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.FeatureConfiguration;
 import com.google.devtools.build.lib.util.Preconditions;
 import com.google.devtools.build.lib.util.ShellEscaper;
-import com.google.devtools.build.lib.util.io.FileOutErr;
 import com.google.devtools.build.lib.vfs.FileSystemUtils;
 import com.google.devtools.build.lib.vfs.Path;
 import com.google.devtools.build.lib.vfs.PathFragment;
@@ -141,19 +140,10 @@
     CppCompileActionContext context = executor.getContext(actionContext);
     CppCompileActionContext.Reply reply = null;
     try {
-      // We delegate stdout/stderr to nowhere, i.e. same as redirecting to /dev/null.
-      reply = context.execWithReply(
-          this, actionExecutionContext.withFileOutErr(new FileOutErr()));
+      reply = context.execWithReply(this, actionExecutionContext);
     } catch (ExecException e) {
-      // We ignore failures here (other than capturing the Distributor reply).
-      // The compilation may well fail (that's the whole point of negative compilation tests).
-      // We execute it here just for the side effect of generating the ".d" file.
-      reply = context.getReplyFromException(e, this);
-      if (reply == null) {
-        // This can only happen if the ExecException does not come from remote execution.
-        throw e.toActionExecutionException("Fake C++ Compilation of rule '"
-            + getOwner().getLabel() + "'", executor.getVerboseFailures(), this);
-      }
+      throw e.toActionExecutionException("C++ compilation of rule '" + getOwner().getLabel() + "'",
+          executor.getVerboseFailures(), this);
     }
     IncludeScanningContext scanningContext = executor.getContext(IncludeScanningContext.class);
     Path execRoot = executor.getExecRoot();
@@ -249,9 +239,8 @@
           + "mkdir -p " + outputPrefix + "$(dirname " + outputFile.getExecPath() + ")"
           + " && " + argv + "\n");
     } catch (IOException e) {
-      throw new ActionExecutionException("failed to create fake compile command for rule '" +
-                                         getOwner().getLabel() + ": " + e.getMessage(),
-                                         this, false);
+      throw new ActionExecutionException("failed to create fake compile command for rule '"
+          + getOwner().getLabel() + ": " + e.getMessage(), this, false);
     }
   }
 
@@ -261,7 +250,9 @@
   }
 
   @Override
-  public String getMnemonic() { return "FakeCppCompile"; }
+  public String getMnemonic() {
+    return "FakeCppCompile";
+  }
 
   @Override
   public ResourceSet estimateResourceConsumptionLocal() {