Browse Source

cpplint: only print diagnostics to console if there are errors

Fixes: #18781
jasjuang 6 years ago
parent
commit
c834c47dfc
1 changed files with 6 additions and 3 deletions
  1. 6 3
      Source/cmcmd.cxx

+ 6 - 3
Source/cmcmd.cxx

@@ -270,9 +270,12 @@ static int HandleCppLint(const std::string& runCmd,
               << "\n";
     return 1;
   }
-  std::cerr << "Warning: cpplint diagnostics:\n";
-  // Output the output from cpplint to stderr
-  std::cerr << stdOut;
+  if (!stdOut.empty()) {
+    std::cerr << "Warning: cpplint diagnostics:\n";
+    // Output the output from cpplint to stderr
+    std::cerr << stdOut;
+  }
+
   // always return 0 so the build can continue as cpplint returns non-zero
   // for any warning
   return 0;