summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-05-06 18:19:04 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-06 18:25:55 (GMT)
commit64b5520346c75ec479042a114390a0bf71909723 (patch)
treebea1373e84594ba036fe50eea3eab86375d63aa6 /Source/cmGlobalGenerator.cxx
parent73601ff831faa80a188e5997ee048b6986b00a5c (diff)
downloadCMake-64b5520346c75ec479042a114390a0bf71909723.zip
CMake-64b5520346c75ec479042a114390a0bf71909723.tar.gz
CMake-64b5520346c75ec479042a114390a0bf71909723.tar.bz2
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/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 84ade25..bd809e1 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -111,12 +111,14 @@ bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p,
}
std::ostringstream e;
+ /* clang-format off */
e <<
"Generator\n"
" " << this->GetName() << "\n"
"does not support platform specification, but platform\n"
" " << p << "\n"
"was specified.";
+ /* clang-format on */
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
@@ -129,12 +131,14 @@ bool cmGlobalGenerator::SetGeneratorToolset(std::string const& ts,
return true;
}
std::ostringstream e;
+ /* clang-format off */
e <<
"Generator\n"
" " << this->GetName() << "\n"
"does not support toolset specification, but toolset\n"
" " << ts << "\n"
"was specified.";
+ /* clang-format on */
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
@@ -696,28 +700,34 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
if(!compilerFile || !*compilerFile ||
cmSystemTools::IsNOTFOUND(compilerFile))
{
+ /* clang-format off */
noCompiler <<
"No " << compilerName << " could be found.\n"
;
+ /* clang-format on */
}
else if(strcmp(lang, "RC") != 0 &&
strcmp(lang, "ASM_MASM") != 0)
{
if(!cmSystemTools::FileIsFullPath(compilerFile))
{
+ /* clang-format off */
noCompiler <<
"The " << compilerName << ":\n"
" " << compilerFile << "\n"
"is not a full path and was not found in the PATH.\n"
;
+ /* clang-format on */
}
else if(!cmSystemTools::FileExists(compilerFile))
{
+ /* clang-format off */
noCompiler <<
"The " << compilerName << ":\n"
" " << compilerFile << "\n"
"is not a full path to an existing compiler tool.\n"
;
+ /* clang-format on */
}
}
if(!noCompiler.str().empty())
@@ -889,10 +899,12 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0025"))
{
std::ostringstream w;
+ /* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0025) << "\n"
"Converting " << lang <<
" compiler id \"AppleClang\" to \"Clang\" for compatibility."
;
+ /* clang-format on */
mf->IssueMessage(cmake::AUTHOR_WARNING, w.str());
}
case cmPolicies::OLD:
@@ -920,10 +932,12 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf,
mf->PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0047"))
{
std::ostringstream w;
+ /* clang-format off */
w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0047) << "\n"
"Converting " << lang <<
" compiler id \"QCC\" to \"GNU\" for compatibility."
;
+ /* clang-format on */
mf->IssueMessage(cmake::AUTHOR_WARNING, w.str());
}
case cmPolicies::OLD: