summaryrefslogtreecommitdiffstats
path: root/Source/cmDependsFortran.cxx
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2020-03-22 14:29:43 (GMT)
committerAlex Turbov <i.zaufi@gmail.com>2020-03-24 13:32:05 (GMT)
commit1e4b5c7d090fc77daa2aaede0bd57d476e3f45ed (patch)
tree0215a0628dc36e38956f2fea531916f71a5d093b /Source/cmDependsFortran.cxx
parent7099db5dd48d36e5d39ab17219278d834c8a88a7 (diff)
downloadCMake-1e4b5c7d090fc77daa2aaede0bd57d476e3f45ed.zip
CMake-1e4b5c7d090fc77daa2aaede0bd57d476e3f45ed.tar.gz
CMake-1e4b5c7d090fc77daa2aaede0bd57d476e3f45ed.tar.bz2
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/cmDependsFortran.cxx')
-rw-r--r--Source/cmDependsFortran.cxx37
1 files changed, 18 insertions, 19 deletions
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 983a684..666306c 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -185,7 +185,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
fiStream << "provides\n";
std::set<std::string> const& provides = this->Internal->TargetProvides;
for (std::string const& i : provides) {
- fiStream << " " << i << "\n";
+ fiStream << ' ' << i << '\n';
}
// Create a script to clean the modules.
@@ -202,14 +202,14 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
std::string mod_lower = cmStrCat(mod_dir, '/');
cmFortranModuleAppendUpperLower(i, mod_upper, mod_lower);
std::string stamp = cmStrCat(stamp_dir, '/', i, ".stamp");
- fcStream << "\n";
- fcStream << " \""
+ fcStream << "\n"
+ " \""
<< this->MaybeConvertToRelativePath(currentBinDir, mod_lower)
- << "\"\n";
- fcStream << " \""
+ << "\"\n"
+ " \""
<< this->MaybeConvertToRelativePath(currentBinDir, mod_upper)
- << "\"\n";
- fcStream << " \""
+ << "\"\n"
+ " \""
<< this->MaybeConvertToRelativePath(currentBinDir, stamp)
<< "\"\n";
}
@@ -326,16 +326,15 @@ bool cmDependsFortran::WriteDependenciesReal(std::string const& obj,
std::string binDir = this->LocalGenerator->GetBinaryDirectory();
std::string obj_i = this->MaybeConvertToRelativePath(binDir, obj);
std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i);
- internalDepends << obj_i << std::endl;
- internalDepends << " " << src << std::endl;
+ internalDepends << obj_i << "\n " << src << '\n';
for (std::string const& i : info.Includes) {
makeDepends << obj_m << ": "
<< cmSystemTools::ConvertToOutputPath(
this->MaybeConvertToRelativePath(binDir, i))
- << std::endl;
- internalDepends << " " << i << std::endl;
+ << '\n';
+ internalDepends << ' ' << i << '\n';
}
- makeDepends << std::endl;
+ makeDepends << '\n';
// Write module requirements to the output stream.
for (std::string const& i : info.Requires) {
@@ -354,7 +353,7 @@ bool cmDependsFortran::WriteDependenciesReal(std::string const& obj,
// This module is known. Depend on its timestamp file.
std::string stampFile = cmSystemTools::ConvertToOutputPath(
this->MaybeConvertToRelativePath(binDir, required->second));
- makeDepends << obj_m << ": " << stampFile << "\n";
+ makeDepends << obj_m << ": " << stampFile << '\n';
} else {
// This module is not known to CMake. Try to locate it where
// the compiler will and depend on that.
@@ -362,7 +361,7 @@ bool cmDependsFortran::WriteDependenciesReal(std::string const& obj,
if (this->FindModule(i, module)) {
module = cmSystemTools::ConvertToOutputPath(
this->MaybeConvertToRelativePath(binDir, module));
- makeDepends << obj_m << ": " << module << "\n";
+ makeDepends << obj_m << ": " << module << '\n';
}
}
}
@@ -391,7 +390,7 @@ bool cmDependsFortran::WriteDependenciesReal(std::string const& obj,
cmSystemTools::ConvertToOutputPath(stampFile);
makeDepends << obj_m << ".provides.build"
- << ": " << stampFileForMake << "\n";
+ << ": " << stampFileForMake << '\n';
// Note that when cmake_copy_f90_mod finds that a module file
// and the corresponding stamp file have no differences, the stamp
// file is not updated. In such case the stamp file will be always
@@ -399,15 +398,15 @@ bool cmDependsFortran::WriteDependenciesReal(std::string const& obj,
// on each new build. This is expected behavior for incremental
// builds and can not be changed without preforming recursive make
// calls that would considerably slow down the building process.
- makeDepends << stampFileForMake << ": " << obj_m << "\n";
+ makeDepends << stampFileForMake << ": " << obj_m << '\n';
makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod " << modFile
- << " " << stampFileForShell;
+ << ' ' << stampFileForShell;
cmMakefile* mf = this->LocalGenerator->GetMakefile();
const char* cid = mf->GetDefinition("CMAKE_Fortran_COMPILER_ID");
if (cid && *cid) {
- makeDepends << " " << cid;
+ makeDepends << ' ' << cid;
}
- makeDepends << "\n";
+ makeDepends << '\n';
}
makeDepends << obj_m << ".provides.build:\n";
// After copying the modules update the timestamp file.