summaryrefslogtreecommitdiff
path: root/Source/cmDepends.cxx
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2020-03-22 22:29:43 +0800
committerAlex Turbov <i.zaufi@gmail.com>2020-03-24 21:32:05 +0800
commit1e4b5c7d090fc77daa2aaede0bd57d476e3f45ed (patch)
tree0215a0628dc36e38956f2fea531916f71a5d093b /Source/cmDepends.cxx
parent7099db5dd48d36e5d39ab17219278d834c8a88a7 (diff)
downloadcmake-1e4b5c7d090fc77daa2aaede0bd57d476e3f45ed.tar.gz
Refactor: Avoid `std::endl` where it's not necessary (part 2)
The `std::endl` manipulator, except inserting `\n` character, also performs `os.flush()`, which may lead to undesired effects (like disk I/O in the middle of forming data strings). For the `std::stringstream` it also has no meaning. * replace multiple `operator<<` calls on a string literal w/ the only call and the only (bigger) string literal; * replace one character string literal used in `operator<<` w/ a char literal.
Diffstat (limited to 'Source/cmDepends.cxx')
-rw-r--r--Source/cmDepends.cxx31
1 files changed, 12 insertions, 19 deletions
diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx
index 129a5f72fe..d4e8da61b2 100644
--- a/Source/cmDepends.cxx
+++ b/Source/cmDepends.cxx
@@ -2,7 +2,6 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmDepends.h"
-#include <sstream>
#include <utility>
#include "cmsys/FStream.hxx"
@@ -81,16 +80,14 @@ void cmDepends::Clear(const std::string& file)
{
// Print verbose output.
if (this->Verbose) {
- std::ostringstream msg;
- msg << "Clearing dependencies in \"" << file << "\"." << std::endl;
- cmSystemTools::Stdout(msg.str());
+ cmSystemTools::Stdout(
+ cmStrCat("Clearing dependencies in \"", file, "\".\n"));
}
// Write an empty dependency file.
cmGeneratedFileStream depFileStream(file);
depFileStream << "# Empty dependencies file\n"
- << "# This may be replaced when dependencies are built."
- << std::endl;
+ "# This may be replaced when dependencies are built.\n";
}
bool cmDepends::WriteDependencies(const std::set<std::string>& /*unused*/,
@@ -172,10 +169,9 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
// Print verbose output.
if (this->Verbose) {
- std::ostringstream msg;
- msg << "Dependee \"" << dependee << "\" does not exist for depender \""
- << depender << "\"." << std::endl;
- cmSystemTools::Stdout(msg.str());
+ cmSystemTools::Stdout(cmStrCat("Dependee \"", dependee,
+ "\" does not exist for depender \"",
+ depender, "\".\n"));
}
} else if (dependerExists) {
// The dependee and depender both exist. Compare file times.
@@ -185,10 +181,9 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
// Print verbose output.
if (this->Verbose) {
- std::ostringstream msg;
- msg << "Dependee \"" << dependee << "\" is newer than depender \""
- << depender << "\"." << std::endl;
- cmSystemTools::Stdout(msg.str());
+ cmSystemTools::Stdout(cmStrCat("Dependee \"", dependee,
+ "\" is newer than depender \"",
+ depender, "\".\n"));
}
}
} else {
@@ -200,11 +195,9 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends,
// Print verbose output.
if (this->Verbose) {
- std::ostringstream msg;
- msg << "Dependee \"" << dependee
- << "\" is newer than depends file \"" << internalDependsFileName
- << "\"." << std::endl;
- cmSystemTools::Stdout(msg.str());
+ cmSystemTools::Stdout(cmStrCat("Dependee \"", dependee,
+ "\" is newer than depends file \"",
+ internalDependsFileName, "\".\n"));
}
}
}