Re: [cmake-developers] Autogen message cleanups

2016-04-25 Thread Brad King
On 04/24/2016 09:55 AM, Sebastian Holtermann wrote:
> Two more autogen patches with message cleanups/tweaks.

Thanks!  Applied:

 Autogen: Message cleanups: Compose messages in std::stringstream
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9b58190c

 Autogen: Message tweaks: Compiler type (moc/qrc/ui) added to progress messages
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9647af3f

I ran `s/msg/err/g` on the hunks of the first patch in order to
avoid shadowing other `msg` locals in a few places.

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


[cmake-developers] Autogen message cleanups

2016-04-24 Thread Sebastian Holtermann

Two more autogen patches with message cleanups/tweaks.

-Sebastian
>From 0c044ee28d3c27c380e7c9bf6ab3978746ed4049 Mon Sep 17 00:00:00 2001
From: Sebastian Holtermann 
Date: Sun, 24 Apr 2016 15:00:26 +0200
Subject: [PATCH 1/2] Autogen: Message cleanups: Compose messages in
 std::stringstream

To avoid Race conditions with other processes writing to stdout/stderr compose
the whole message in a std::stringstream then submit the single complete message.
---
 Source/cmQtAutoGeneratorInitializer.cxx |  12 +-
 Source/cmQtAutoGenerators.cxx   | 262 +++-
 Source/cmQtAutoGenerators.h |   5 +-
 3 files changed, 170 insertions(+), 109 deletions(-)

diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index ea9ea7c..f89a235 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -592,8 +592,10 @@ static std::string ListQt5RccInputs(cmSourceFile* sf,
 , 0, cmSystemTools::OUTPUT_NONE);
   if (!result || retVal)
 {
-std::cerr << "AUTOGEN: error: Rcc list process for " << sf->GetFullPath()
-  << " failed:\n" << rccStdOut << "\n" << rccStdErr << std::endl;
+std::stringstream msg;
+msg << "AUTOGEN: error: Rcc list process for " << sf->GetFullPath()
+<< " failed:\n" << rccStdOut << "\n" << rccStdErr << std::endl;
+std::cerr << msg.str();
 return std::string();
 }
 
@@ -623,8 +625,10 @@ static std::string ListQt5RccInputs(cmSourceFile* sf,
   std::string::size_type pos = eline.find(searchString);
   if (pos == std::string::npos)
 {
-std::cerr << "AUTOGEN: error: Rcc lists unparsable output "
-  << eline << std::endl;
+std::stringstream msg;
+msg << "AUTOGEN: error: Rcc lists unparsable output "
+<< eline << std::endl;
+std::cerr << msg.str();
 return std::string();
 }
   pos += searchString.length();
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 3c6db2d..5345ca4 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -549,7 +549,9 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
 const std::string  = *it;
 if (this->Verbose)
   {
-  std::cout << "AUTOGEN: Checking " << absFilename << std::endl;
+  std::stringstream msg;
+  msg << "AUTOGEN: Checking " << absFilename << std::endl;
+  this->LogInfo(msg.str());
   }
 if (this->RelaxedMode)
   {
@@ -577,7 +579,9 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
   const std::string  = *it;
   if (this->Verbose)
 {
-std::cout << "AUTOGEN: Checking " << absFilename << std::endl;
+std::stringstream msg;
+msg << "AUTOGEN: Checking " << absFilename << std::endl;
+this->LogInfo(msg.str());
 }
   this->ParseForUic(absFilename, includedUis);
   }
@@ -607,17 +611,20 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
 
   if (this->RunMocFailed)
 {
-std::cerr << "moc failed..." << std::endl;
+std::stringstream msg; msg << "moc failed..." << std::endl;
+this->LogError(msg.str());
 return false;
 }
   if (this->RunUicFailed)
 {
-std::cerr << "uic failed..." << std::endl;
+std::stringstream msg; msg << "uic failed..." << std::endl;
+this->LogError(msg.str());
 return false;
 }
   if (this->RunRccFailed)
 {
-std::cerr << "rcc failed..." << std::endl;
+std::stringstream msg; msg << "rcc failed..." << std::endl;
+this->LogError(msg.str());
 return false;
 }
 
@@ -637,8 +644,10 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename,
   const std::string contentsString = ReadAll(absFilename);
   if (contentsString.empty())
 {
-std::cerr << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
-  << std::endl;
+std::stringstream msg;
+msg << "AUTOGEN: warning: " << absFilename << ": file is empty\n"
+<< std::endl;
+this->LogError(msg.str());
 return;
 }
   this->ParseForUic(absFilename, contentsString, includedUis);
@@ -670,7 +679,6 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename,
 do
   {
   const std::string currentMoc = mocIncludeRegExp.match(1);
-  //std::cout << "found moc include: " << currentMoc << std::endl;
 
   std::string basename = cmsys::SystemTools::
GetFilenameWithoutLastExtension(currentMoc);
@@ -703,20 +711,21 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename,
   }
 else
   {
-  std::cerr << "AUTOGEN: error: " << absFilename << ": The file "
-<< "includes the moc file \"" << currentMoc << "\", "
-<< "but could not find header \"" << basename
-<< '{' <<