diff options
author | Brad King <brad.king@kitware.com> | 2016-05-06 18:19:04 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-05-06 18:25:55 (GMT) |
commit | 64b5520346c75ec479042a114390a0bf71909723 (patch) | |
tree | bea1373e84594ba036fe50eea3eab86375d63aa6 /Source/cmGlobalVisualStudio10Generator.cxx | |
parent | 73601ff831faa80a188e5997ee048b6986b00a5c (diff) | |
download | CMake-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/cmGlobalVisualStudio10Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 22ffbcc..4376dd9 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -337,6 +337,7 @@ void cmGlobalVisualStudio10Generator::Generate() { cmLocalGenerator* lg = this->LongestSource.Target->GetLocalGenerator(); std::ostringstream e; + /* clang-format off */ e << "The binary and/or source directory paths may be too long to generate " "Visual Studio 10 files for this project. " @@ -356,6 +357,7 @@ void cmGlobalVisualStudio10Generator::Generate() "the path length is too long for some internal buffer or API. " "To avoid this problem CMake must use a full path for this file " "which then triggers the VS 10 property dialog bug."; + /* clang-format on */ lg->IssueMessage(cmake::WARNING, e.str().c_str()); } } @@ -566,9 +568,11 @@ bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) else { std::ostringstream e; + /* clang-format off */ e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n" << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n" << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx"; + /* clang-format on */ mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); cmSystemTools::SetFatalErrorOccured(); return false; |