diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2020-03-22 13:54:31 (GMT) |
---|---|---|
committer | Alex Turbov <i.zaufi@gmail.com> | 2020-03-26 03:36:57 (GMT) |
commit | 3fdd8db3aaf4c804dd24a59913650ad024c8343e (patch) | |
tree | 1b2b9ef7f9b724b802b4cecdc2554f5abaf41a43 /Source/cmLocalUnixMakefileGenerator3.cxx | |
parent | ea54f8d44199502d6d02369ea0a2de4e9ef8c1ca (diff) | |
download | CMake-3fdd8db3aaf4c804dd24a59913650ad024c8343e.zip CMake-3fdd8db3aaf4c804dd24a59913650ad024c8343e.tar.gz CMake-3fdd8db3aaf4c804dd24a59913650ad024c8343e.tar.bz2 |
Refactor: Avoid `std::endl` where it's not necessary (part 1)
The `std::endl` manupulator, except inserting `\n` character, also
performs `os.flush()`, which may leads to undesired effects (like
disk I/O in the middle of forming data strings). For the
`std::stringstream` it also has no meaning.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 53bd1d5..a4b9e76 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1328,10 +1328,9 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies( int result; if (!ftc->Compare(internalDependFile, tgtInfo, &result) || result < 0) { if (verbose) { - std::ostringstream msg; - msg << "Dependee \"" << tgtInfo << "\" is newer than depender \"" - << internalDependFile << "\"." << std::endl; - cmSystemTools::Stdout(msg.str()); + cmSystemTools::Stdout(cmStrCat("Dependee \"", tgtInfo, + "\" is newer than depender \"", + internalDependFile, "\".\n")); } needRescanDependInfo = true; } @@ -1348,10 +1347,9 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies( if (!ftc->Compare(internalDependFile, dirInfoFile, &result) || result < 0) { if (verbose) { - std::ostringstream msg; - msg << "Dependee \"" << dirInfoFile << "\" is newer than depender \"" - << internalDependFile << "\"." << std::endl; - cmSystemTools::Stdout(msg.str()); + cmSystemTools::Stdout(cmStrCat("Dependee \"", dirInfoFile, + "\" is newer than depender \"", + internalDependFile, "\".\n")); } needRescanDirInfo = true; } @@ -1517,11 +1515,9 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose) if (cmSystemTools::FileExists(dependee) && !cmSystemTools::FileExists(depender)) { if (verbose) { - std::ostringstream msg; - msg << "Deleting primary custom command output \"" << dependee - << "\" because another output \"" << depender - << "\" does not exist." << std::endl; - cmSystemTools::Stdout(msg.str()); + cmSystemTools::Stdout(cmStrCat( + "Deleting primary custom command output \"", dependee, + "\" because another output \"", depender, "\" does not exist.\n")); } cmSystemTools::RemoveFile(dependee); } @@ -1969,7 +1965,7 @@ std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall( void cmLocalUnixMakefileGenerator3::WriteDivider(std::ostream& os) { os << "#======================================" - << "=======================================\n"; + "=======================================\n"; } void cmLocalUnixMakefileGenerator3::WriteCMakeArgument(std::ostream& os, @@ -1977,7 +1973,7 @@ void cmLocalUnixMakefileGenerator3::WriteCMakeArgument(std::ostream& os, { // Write the given string to the stream with escaping to get it back // into CMake through the lexical scanner. - os << "\""; + os << '"'; for (char c : s) { if (c == '\\') { os << "\\\\"; @@ -1987,7 +1983,7 @@ void cmLocalUnixMakefileGenerator3::WriteCMakeArgument(std::ostream& os, os << c; } } - os << "\""; + os << '"'; } std::string cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath( |