Explorar o código

Merge topic 'source_sweep_ostringstream_single'

3b2b02825d Source sweep: Replace std::ostringstream when used with a single append

Acked-by: Kitware Robot <[email protected]>
Merge-request: !3726
Brad King %!s(int64=6) %!d(string=hai) anos
pai
achega
37c671570c

+ 2 - 3
Source/CPack/cmCPackBundleGenerator.cxx

@@ -89,11 +89,10 @@ int cmCPackBundleGenerator::ConstructBundle()
 
   // The staging directory contains everything that will end-up inside the
   // final disk image ...
-  std::ostringstream staging;
-  staging << toplevel;
+  std::string const staging = toplevel;
 
   std::ostringstream contents;
-  contents << staging.str() << "/" << cpack_bundle_name << ".app/"
+  contents << staging << "/" << cpack_bundle_name << ".app/"
            << "Contents";
 
   std::ostringstream application;

+ 6 - 7
Source/CTest/cmCTestBuildCommand.cxx

@@ -154,16 +154,15 @@ bool cmCTestBuildCommand::InitialPass(std::vector<std::string> const& args,
 {
   bool ret = cmCTestHandlerCommand::InitialPass(args, status);
   if (this->Values[ctb_NUMBER_ERRORS] && *this->Values[ctb_NUMBER_ERRORS]) {
-    std::ostringstream str;
-    str << this->Handler->GetTotalErrors();
-    this->Makefile->AddDefinition(this->Values[ctb_NUMBER_ERRORS], str.str());
+    this->Makefile->AddDefinition(
+      this->Values[ctb_NUMBER_ERRORS],
+      std::to_string(this->Handler->GetTotalErrors()));
   }
   if (this->Values[ctb_NUMBER_WARNINGS] &&
       *this->Values[ctb_NUMBER_WARNINGS]) {
-    std::ostringstream str;
-    str << this->Handler->GetTotalWarnings();
-    this->Makefile->AddDefinition(this->Values[ctb_NUMBER_WARNINGS],
-                                  str.str());
+    this->Makefile->AddDefinition(
+      this->Values[ctb_NUMBER_WARNINGS],
+      std::to_string(this->Handler->GetTotalWarnings()));
   }
   return ret;
 }

+ 2 - 3
Source/CTest/cmCTestHandlerCommand.cxx

@@ -228,9 +228,8 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args,
 
   int res = handler->ProcessHandler();
   if (this->Values[ct_RETURN_VALUE] && *this->Values[ct_RETURN_VALUE]) {
-    std::ostringstream str;
-    str << res;
-    this->Makefile->AddDefinition(this->Values[ct_RETURN_VALUE], str.str());
+    this->Makefile->AddDefinition(this->Values[ct_RETURN_VALUE],
+                                  std::to_string(res));
   }
   this->ProcessAdditionalValues(handler);
   // log the error message if there was an error

+ 5 - 4
Source/CTest/cmCTestMemCheckCommand.cxx

@@ -2,7 +2,7 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmCTestMemCheckCommand.h"
 
-#include <sstream>
+#include <string>
 #include <vector>
 
 #include "cmCTest.h"
@@ -44,8 +44,9 @@ void cmCTestMemCheckCommand::ProcessAdditionalValues(
   cmCTestGenericHandler* handler)
 {
   if (this->Values[ctm_DEFECT_COUNT] && *this->Values[ctm_DEFECT_COUNT]) {
-    std::ostringstream str;
-    str << static_cast<cmCTestMemCheckHandler*>(handler)->GetDefectCount();
-    this->Makefile->AddDefinition(this->Values[ctm_DEFECT_COUNT], str.str());
+    this->Makefile->AddDefinition(
+      this->Values[ctm_DEFECT_COUNT],
+      std::to_string(
+        static_cast<cmCTestMemCheckHandler*>(handler)->GetDefectCount()));
   }
 }

+ 1 - 4
Source/CTest/cmCTestMemCheckHandler.cxx

@@ -1074,10 +1074,7 @@ void cmCTestMemCheckHandler::AppendMemTesterOutput(cmCTestTestResult& res,
 void cmCTestMemCheckHandler::TestOutputFileNames(
   int test, std::vector<std::string>& files)
 {
-  std::string index;
-  std::ostringstream stream;
-  stream << test;
-  index = stream.str();
+  std::string index = std::to_string(test);
   std::string ofile = this->MemoryTesterOutputFile;
   std::string::size_type pos = ofile.find("??");
   ofile.replace(pos, 2, index);

+ 1 - 5
Source/CTest/cmCTestRunScriptCommand.cxx

@@ -5,8 +5,6 @@
 #include "cmCTestScriptHandler.h"
 #include "cmMakefile.h"
 
-#include <sstream>
-
 class cmExecutionStatus;
 
 bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args,
@@ -41,9 +39,7 @@ bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args,
       int ret;
       cmCTestScriptHandler::RunScript(this->CTest, this->Makefile,
                                       args[i].c_str(), !np, &ret);
-      std::ostringstream str;
-      str << ret;
-      this->Makefile->AddDefinition(returnVariable, str.str());
+      this->Makefile->AddDefinition(returnVariable, std::to_string(ret));
     }
   }
   return true;

+ 1 - 3
Source/cmAddExecutableCommand.cxx

@@ -93,9 +93,7 @@ bool cmAddExecutableCommand(std::vector<std::string> const& args,
       return false;
     }
     if (args.size() != 3) {
-      std::ostringstream e;
-      e << "ALIAS requires exactly one target argument.";
-      status.SetError(e.str());
+      status.SetError("ALIAS requires exactly one target argument.");
       return false;
     }
 

+ 26 - 42
Source/cmAddLibraryCommand.cxx

@@ -49,9 +49,8 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
     std::string libType = *s;
     if (libType == "STATIC") {
       if (type == cmStateEnums::INTERFACE_LIBRARY) {
-        std::ostringstream e;
-        e << "INTERFACE library specified with conflicting STATIC type.";
-        status.SetError(e.str());
+        status.SetError(
+          "INTERFACE library specified with conflicting STATIC type.");
         return false;
       }
       ++s;
@@ -59,9 +58,8 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
       haveSpecifiedType = true;
     } else if (libType == "SHARED") {
       if (type == cmStateEnums::INTERFACE_LIBRARY) {
-        std::ostringstream e;
-        e << "INTERFACE library specified with conflicting SHARED type.";
-        status.SetError(e.str());
+        status.SetError(
+          "INTERFACE library specified with conflicting SHARED type.");
         return false;
       }
       ++s;
@@ -69,9 +67,8 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
       haveSpecifiedType = true;
     } else if (libType == "MODULE") {
       if (type == cmStateEnums::INTERFACE_LIBRARY) {
-        std::ostringstream e;
-        e << "INTERFACE library specified with conflicting MODULE type.";
-        status.SetError(e.str());
+        status.SetError(
+          "INTERFACE library specified with conflicting MODULE type.");
         return false;
       }
       ++s;
@@ -79,9 +76,8 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
       haveSpecifiedType = true;
     } else if (libType == "OBJECT") {
       if (type == cmStateEnums::INTERFACE_LIBRARY) {
-        std::ostringstream e;
-        e << "INTERFACE library specified with conflicting OBJECT type.";
-        status.SetError(e.str());
+        status.SetError(
+          "INTERFACE library specified with conflicting OBJECT type.");
         return false;
       }
       ++s;
@@ -89,9 +85,8 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
       haveSpecifiedType = true;
     } else if (libType == "UNKNOWN") {
       if (type == cmStateEnums::INTERFACE_LIBRARY) {
-        std::ostringstream e;
-        e << "INTERFACE library specified with conflicting UNKNOWN type.";
-        status.SetError(e.str());
+        status.SetError(
+          "INTERFACE library specified with conflicting UNKNOWN type.");
         return false;
       }
       ++s;
@@ -99,30 +94,26 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
       haveSpecifiedType = true;
     } else if (libType == "ALIAS") {
       if (type == cmStateEnums::INTERFACE_LIBRARY) {
-        std::ostringstream e;
-        e << "INTERFACE library specified with conflicting ALIAS type.";
-        status.SetError(e.str());
+        status.SetError(
+          "INTERFACE library specified with conflicting ALIAS type.");
         return false;
       }
       ++s;
       isAlias = true;
     } else if (libType == "INTERFACE") {
       if (haveSpecifiedType) {
-        std::ostringstream e;
-        e << "INTERFACE library specified with conflicting/multiple types.";
-        status.SetError(e.str());
+        status.SetError(
+          "INTERFACE library specified with conflicting/multiple types.");
         return false;
       }
       if (isAlias) {
-        std::ostringstream e;
-        e << "INTERFACE library specified with conflicting ALIAS type.";
-        status.SetError(e.str());
+        status.SetError(
+          "INTERFACE library specified with conflicting ALIAS type.");
         return false;
       }
       if (excludeFromAll) {
-        std::ostringstream e;
-        e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
-        status.SetError(e.str());
+        status.SetError(
+          "INTERFACE library may not be used with EXCLUDE_FROM_ALL.");
         return false;
       }
       ++s;
@@ -130,9 +121,8 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
       haveSpecifiedType = true;
     } else if (*s == "EXCLUDE_FROM_ALL") {
       if (type == cmStateEnums::INTERFACE_LIBRARY) {
-        std::ostringstream e;
-        e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL.";
-        status.SetError(e.str());
+        status.SetError(
+          "INTERFACE library may not be used with EXCLUDE_FROM_ALL.");
         return false;
       }
       ++s;
@@ -144,9 +134,8 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
       ++s;
       importGlobal = true;
     } else if (type == cmStateEnums::INTERFACE_LIBRARY && *s == "GLOBAL") {
-      std::ostringstream e;
-      e << "GLOBAL option may only be used with IMPORTED libraries.";
-      status.SetError(e.str());
+      status.SetError(
+        "GLOBAL option may only be used with IMPORTED libraries.");
       return false;
     } else {
       break;
@@ -155,15 +144,12 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
 
   if (type == cmStateEnums::INTERFACE_LIBRARY) {
     if (s != args.end()) {
-      std::ostringstream e;
-      e << "INTERFACE library requires no source arguments.";
-      status.SetError(e.str());
+      status.SetError("INTERFACE library requires no source arguments.");
       return false;
     }
     if (importGlobal && !importTarget) {
-      std::ostringstream e;
-      e << "INTERFACE library specified as GLOBAL, but not as IMPORTED.";
-      status.SetError(e.str());
+      status.SetError(
+        "INTERFACE library specified as GLOBAL, but not as IMPORTED.");
       return false;
     }
   }
@@ -192,9 +178,7 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
       return false;
     }
     if (args.size() != 3) {
-      std::ostringstream e;
-      e << "ALIAS requires exactly one target argument.";
-      status.SetError(e.str());
+      status.SetError("ALIAS requires exactly one target argument.");
       return false;
     }
 

+ 1 - 4
Source/cmCMakeHostSystemInformationCommand.cxx

@@ -2,7 +2,6 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmCMakeHostSystemInformationCommand.h"
 
-#include <sstream>
 #include <stddef.h>
 
 #include "cmExecutionStatus.h"
@@ -183,9 +182,7 @@ bool GetValue(cmExecutionStatus& status, cmsys::SystemInformation& info,
 
 std::string ValueToString(size_t value)
 {
-  std::ostringstream tmp;
-  tmp << value;
-  return tmp.str();
+  return std::to_string(value);
 }
 
 std::string ValueToString(const char* value)

+ 1 - 3
Source/cmCTest.cxx

@@ -1218,9 +1218,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
             timeout != cmCTest::MaxDuration() &&
             timeout > cmDuration::zero()) {
           args.emplace_back("--test-timeout");
-          std::ostringstream msg;
-          msg << cmDurationTo<unsigned int>(timeout);
-          args.push_back(msg.str());
+          args.push_back(std::to_string(cmDurationTo<unsigned int>(timeout)));
         }
         args.emplace_back(i);
       }

+ 1 - 3
Source/cmCommandArgumentParserHelper.cxx

@@ -88,9 +88,7 @@ const char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
     return nullptr;
   }
   if (this->FileLine >= 0 && strcmp(var, "CMAKE_CURRENT_LIST_LINE") == 0) {
-    std::ostringstream ostr;
-    ostr << this->FileLine;
-    return this->AddString(ostr.str());
+    return this->AddString(std::to_string(this->FileLine));
   }
   const char* value = this->Makefile->GetDefinition(var);
   if (!value) {

+ 1 - 3
Source/cmExportFileGenerator.cxx

@@ -842,9 +842,7 @@ void cmExportFileGenerator::SetImportDetailProperties(
     if (iface->Multiplicity > 0) {
       std::string prop =
         cmStrCat("IMPORTED_LINK_INTERFACE_MULTIPLICITY", suffix);
-      std::ostringstream m;
-      m << iface->Multiplicity;
-      properties[prop] = m.str();
+      properties[prop] = std::to_string(iface->Multiplicity);
     }
   }
 

+ 2 - 3
Source/cmFileCopier.cxx

@@ -446,9 +446,8 @@ bool cmFileCopier::Install(const std::string& fromFile,
                            const std::string& toFile)
 {
   if (fromFile.empty()) {
-    std::ostringstream e;
-    e << "INSTALL encountered an empty string input file name.";
-    this->Status.SetError(e.str());
+    this->Status.SetError(
+      "INSTALL encountered an empty string input file name.");
     return false;
   }
 

+ 1 - 3
Source/cmFunctionCommand.cxx

@@ -62,9 +62,7 @@ bool cmFunctionHelperCommand::operator()(
                                             this->Policies);
 
   // set the value of argc
-  std::ostringstream strStream;
-  strStream << expandedArgs.size();
-  makefile.AddDefinition("ARGC", strStream.str());
+  makefile.AddDefinition("ARGC", std::to_string(expandedArgs.size()));
   makefile.MarkVariableAsUsed("ARGC");
 
   // set the values for ARGV0 ARGV1 ...

+ 3 - 3
Source/cmGeneratorExpressionNode.cxx

@@ -683,10 +683,10 @@ struct CompilerIdNode : public cmGeneratorExpressionNode
       if (cmsysString_strcasecmp(param.c_str(), compilerId.c_str()) == 0) {
         switch (context->LG->GetPolicyStatus(cmPolicies::CMP0044)) {
           case cmPolicies::WARN: {
-            std::ostringstream e;
-            e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0044);
             context->LG->GetCMakeInstance()->IssueMessage(
-              MessageType::AUTHOR_WARNING, e.str(), context->Backtrace);
+              MessageType::AUTHOR_WARNING,
+              cmPolicies::GetPolicyWarning(cmPolicies::CMP0044),
+              context->Backtrace);
             CM_FALLTHROUGH;
           }
           case cmPolicies::OLD:

+ 3 - 4
Source/cmGeneratorTarget.cxx

@@ -3287,10 +3287,9 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
     if (configProp) {
       switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0043)) {
         case cmPolicies::WARN: {
-          std::ostringstream e;
-          e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0043);
-          this->LocalGenerator->IssueMessage(MessageType::AUTHOR_WARNING,
-                                             e.str());
+          this->LocalGenerator->IssueMessage(
+            MessageType::AUTHOR_WARNING,
+            cmPolicies::GetPolicyWarning(cmPolicies::CMP0043));
           CM_FALLTHROUGH;
         }
         case cmPolicies::OLD: {

+ 1 - 3
Source/cmGlobalVisualStudioGenerator.cxx

@@ -636,9 +636,7 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
   // follow the expected naming scheme. Expected naming scheme is that
   // the subkeys of OtherProjects7 is 0 to n-1, so it's ok to use "n"
   // as the name of the next subkey.
-  std::ostringstream ossNext;
-  ossNext << index;
-  nextAvailableSubKeyName = ossNext.str();
+  nextAvailableSubKeyName = std::to_string(index);
 
   keyname = regKeyBase + "\\RecordingProject7";
   hkey = NULL;

+ 3 - 4
Source/cmInstallCommand.cxx

@@ -368,10 +368,9 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
       !objectArgs.GetType().empty() || !frameworkArgs.GetType().empty() ||
       !bundleArgs.GetType().empty() || !privateHeaderArgs.GetType().empty() ||
       !publicHeaderArgs.GetType().empty() || !resourceArgs.GetType().empty()) {
-    std::ostringstream e;
-    e << "TARGETS given TYPE option. The TYPE option may only be specified in "
-         " install(FILES) and install(DIRECTORIES).";
-    this->SetError(e.str());
+    this->SetError(
+      "TARGETS given TYPE option. The TYPE option may only be specified in "
+      " install(FILES) and install(DIRECTORIES).");
     return false;
   }
 

+ 3 - 3
Source/cmListCommand.cxx

@@ -340,9 +340,9 @@ bool HandleFindCommand(std::vector<std::string> const& args,
   std::vector<std::string>::iterator it =
     std::find(varArgsExpanded.begin(), varArgsExpanded.end(), args[2]);
   if (it != varArgsExpanded.end()) {
-    std::ostringstream indexStream;
-    indexStream << std::distance(varArgsExpanded.begin(), it);
-    status.GetMakefile().AddDefinition(variableName, indexStream.str());
+    status.GetMakefile().AddDefinition(
+      variableName,
+      std::to_string(std::distance(varArgsExpanded.begin(), it)));
     return true;
   }
 

+ 1 - 4
Source/cmMacroCommand.cxx

@@ -2,7 +2,6 @@
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmMacroCommand.h"
 
-#include <sstream>
 #include <stdio.h>
 #include <utility>
 
@@ -64,9 +63,7 @@ bool cmMacroHelperCommand::operator()(
                                       this->Policies);
 
   // set the value of argc
-  std::ostringstream argcDefStream;
-  argcDefStream << expandedArgs.size();
-  std::string argcDef = argcDefStream.str();
+  std::string argcDef = std::to_string(expandedArgs.size());
 
   std::vector<std::string>::const_iterator eit =
     expandedArgs.begin() + (this->Args.size() - 1);

+ 10 - 14
Source/cmMakefile.cxx

@@ -2810,9 +2810,7 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
           switch (var.domain) {
             case NORMAL:
               if (filename && lookup == lineVar) {
-                std::ostringstream ostr;
-                ostr << line;
-                varresult = ostr.str();
+                varresult = std::to_string(line);
               } else {
                 value = this->GetDefinition(lookup);
               }
@@ -3244,9 +3242,7 @@ void cmMakefile::SetScriptModeFile(std::string const& scriptfile)
 
 void cmMakefile::SetArgcArgv(const std::vector<std::string>& args)
 {
-  std::ostringstream strStream;
-  strStream << args.size();
-  this->AddDefinition("CMAKE_ARGC", strStream.str());
+  this->AddDefinition("CMAKE_ARGC", std::to_string(args.size()));
   // this->MarkVariableAsUsed("CMAKE_ARGC");
 
   for (unsigned int t = 0; t < args.size(); ++t) {
@@ -4492,10 +4488,10 @@ bool cmMakefile::HaveCStandardAvailable(cmTarget const* target,
   const char* defaultCStandard =
     this->GetDefinition("CMAKE_C_STANDARD_DEFAULT");
   if (!defaultCStandard) {
-    std::ostringstream e;
-    e << "CMAKE_C_STANDARD_DEFAULT is not set.  COMPILE_FEATURES support "
-         "not fully configured for this compiler.";
-    this->IssueMessage(MessageType::INTERNAL_ERROR, e.str());
+    this->IssueMessage(
+      MessageType::INTERNAL_ERROR,
+      "CMAKE_C_STANDARD_DEFAULT is not set.  COMPILE_FEATURES support "
+      "not fully configured for this compiler.");
     // Return true so the caller does not try to lookup the default standard.
     return true;
   }
@@ -4576,10 +4572,10 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target,
   const char* defaultCxxStandard =
     this->GetDefinition("CMAKE_CXX_STANDARD_DEFAULT");
   if (!defaultCxxStandard) {
-    std::ostringstream e;
-    e << "CMAKE_CXX_STANDARD_DEFAULT is not set.  COMPILE_FEATURES support "
-         "not fully configured for this compiler.";
-    this->IssueMessage(MessageType::INTERNAL_ERROR, e.str());
+    this->IssueMessage(
+      MessageType::INTERNAL_ERROR,
+      "CMAKE_CXX_STANDARD_DEFAULT is not set.  COMPILE_FEATURES support "
+      "not fully configured for this compiler.");
     // Return true so the caller does not try to lookup the default standard.
     return true;
   }

+ 9 - 12
Source/cmTarget.cxx

@@ -1081,21 +1081,19 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
   MAKE_STATIC_PROP(TYPE);
 #undef MAKE_STATIC_PROP
   if (prop == propMANUALLY_ADDED_DEPENDENCIES) {
-    std::ostringstream e;
-    e << "MANUALLY_ADDED_DEPENDENCIES property is read-only\n";
-    impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
+    impl->Makefile->IssueMessage(
+      MessageType::FATAL_ERROR,
+      "MANUALLY_ADDED_DEPENDENCIES property is read-only\n");
     return;
   }
   if (prop == propNAME) {
-    std::ostringstream e;
-    e << "NAME property is read-only\n";
-    impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
+    impl->Makefile->IssueMessage(MessageType::FATAL_ERROR,
+                                 "NAME property is read-only\n");
     return;
   }
   if (prop == propTYPE) {
-    std::ostringstream e;
-    e << "TYPE property is read-only\n";
-    impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
+    impl->Makefile->IssueMessage(MessageType::FATAL_ERROR,
+                                 "TYPE property is read-only\n");
     return;
   }
   if (prop == propEXPORT_NAME && this->IsImported()) {
@@ -1222,9 +1220,8 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
     return;
   }
   if (prop == "NAME") {
-    std::ostringstream e;
-    e << "NAME property is read-only\n";
-    impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
+    impl->Makefile->IssueMessage(MessageType::FATAL_ERROR,
+                                 "NAME property is read-only\n");
     return;
   }
   if (prop == "EXPORT_NAME" && this->IsImported()) {

+ 1 - 3
Source/cmTimestamp.cxx

@@ -168,9 +168,7 @@ std::string cmTimestamp::AddTimestampComponent(char flag,
         return std::string();
       }
 
-      std::ostringstream ss;
-      ss << static_cast<long int>(difftime(timeT, unixEpoch));
-      return ss.str();
+      return std::to_string(static_cast<long int>(difftime(timeT, unixEpoch)));
     }
     default: {
       return formatString;

+ 7 - 13
Source/cmake.cxx

@@ -2103,9 +2103,7 @@ int cmake::CheckBuildSystem()
   // If no file is provided for the check, we have to rerun.
   if (this->CheckBuildSystemArgument.empty()) {
     if (verbose) {
-      std::ostringstream msg;
-      msg << "Re-run cmake no build system arguments\n";
-      cmSystemTools::Stdout(msg.str());
+      cmSystemTools::Stdout("Re-run cmake no build system arguments\n");
     }
     return 1;
   }
@@ -2188,10 +2186,8 @@ int cmake::CheckBuildSystem()
   if (depends.empty() || outputs.empty()) {
     // Not enough information was provided to do the test.  Just rerun.
     if (verbose) {
-      std::ostringstream msg;
-      msg << "Re-run cmake no CMAKE_MAKEFILE_DEPENDS "
-             "or CMAKE_MAKEFILE_OUTPUTS :\n";
-      cmSystemTools::Stdout(msg.str());
+      cmSystemTools::Stdout("Re-run cmake no CMAKE_MAKEFILE_DEPENDS "
+                            "or CMAKE_MAKEFILE_OUTPUTS :\n");
     }
     return 1;
   }
@@ -2207,9 +2203,8 @@ int cmake::CheckBuildSystem()
       }
     } else {
       if (verbose) {
-        std::ostringstream msg;
-        msg << "Re-run cmake: build system dependency is missing\n";
-        cmSystemTools::Stdout(msg.str());
+        cmSystemTools::Stdout(
+          "Re-run cmake: build system dependency is missing\n");
       }
       return 1;
     }
@@ -2226,9 +2221,8 @@ int cmake::CheckBuildSystem()
       }
     } else {
       if (verbose) {
-        std::ostringstream msg;
-        msg << "Re-run cmake: build system output is missing\n";
-        cmSystemTools::Stdout(msg.str());
+        cmSystemTools::Stdout(
+          "Re-run cmake: build system output is missing\n");
       }
       return 1;
     }