summaryrefslogtreecommitdiff
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-05-06 14:19:04 -0400
committerBrad King <brad.king@kitware.com>2016-05-06 14:25:55 -0400
commit64b5520346c75ec479042a114390a0bf71909723 (patch)
treebea1373e84594ba036fe50eea3eab86375d63aa6 /Source/cmMakefileTargetGenerator.cxx
parent73601ff831faa80a188e5997ee048b6986b00a5c (diff)
downloadcmake-64b5520346c75ec479042a114390a0bf71909723.tar.gz
Isolate formatted streaming blocks with clang-format off/on
The clang-format tool can do a good job formatting most code, but well-organized streaming blocks are best left manually formatted. Find blocks of the form os << "...\n" "...\n" ; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}' Find blocks of the form os << "...\n" << "...\n" << "...\n"; using the command $ git ls-files -z -- Source | egrep -v -z '^Source/kwsys/' | xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \ '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}' Surround such blocks with the pair /* clang-format off */ ... /* clang-format on */ in order to protect them from update by clang-format. Use the C-style `/*...*/` comments instead of C++-style `//...` comments in order to prevent them from ever being swallowed by re-formatting of surrounding comments.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index e14f828e21..50449fbdd6 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1057,10 +1057,12 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
// Store multiple output pairs in the depend info file.
if(!this->MultipleOutputPairs.empty())
{
+ /* clang-format off */
*this->InfoFileStream
<< "\n"
<< "# Pairs of files generated by the same build rule.\n"
<< "set(CMAKE_MULTIPLE_OUTPUT_PAIRS\n";
+ /* clang-format on */
for(MultipleOutputPairsType::const_iterator pi =
this->MultipleOutputPairs.begin();
pi != this->MultipleOutputPairs.end(); ++pi)
@@ -1075,10 +1077,12 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
// Store list of targets linked directly or transitively.
{
+ /* clang-format off */
*this->InfoFileStream
<< "\n"
<< "# Targets to which this target links.\n"
<< "set(CMAKE_TARGET_LINKED_INFO_FILES\n";
+ /* clang-format on */
std::vector<std::string> dirs = this->GetLinkedTargetDirectories();
for (std::vector<std::string>::iterator i = dirs.begin();
i != dirs.end(); ++i)
@@ -1089,11 +1093,13 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< " )\n";
}
+ /* clang-format off */
*this->InfoFileStream
<< "\n"
<< "# Fortran module output directory.\n"
<< "set(CMAKE_Fortran_TARGET_MODULE_DIR \""
<< this->GetFortranModuleDirectory() << "\")\n";
+ /* clang-format on */
// and now write the rule to use it
std::vector<std::string> depends;
@@ -1308,11 +1314,13 @@ cmMakefileTargetGenerator
variableNameExternal =
this->LocalGenerator->CreateMakeVariable(this->GeneratorTarget->GetName(),
"_EXTERNAL_OBJECTS");
+ /* clang-format off */
*this->BuildFileStream
<< "\n"
<< "# External object files for target "
<< this->GeneratorTarget->GetName() << "\n"
<< variableNameExternal << " =";
+ /* clang-format on */
for(std::vector<std::string>::const_iterator i =
this->ExternalObjects.begin();
i != this->ExternalObjects.end(); ++i)