clang-format.bash: update to clang-format-6.0
Update `.clang-format` with configuration to make the 6.0 format as close as possible to what 3.8 produced before. Then revise the style: * Indent preprocessor directives (a feature new since 3.8) * Add a newline and indentation before inheritance `:` and `,` Rename the Git attribute identifying the format to include the clang-format version number: `format.clang-format-6.0`. This will aid external infrastructure in knowing what version of the tool to run.
This commit is contained in:
parent
eb7ec19c1c
commit
523c443d13
@ -1,8 +1,21 @@
|
||||
---
|
||||
# This configuration requires clang-format version 3.8 exactly.
|
||||
# This configuration requires clang-format version 6.0 exactly.
|
||||
BasedOnStyle: Mozilla
|
||||
AlignOperands: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AllowShortFunctionsOnASingleLine: InlineOnly
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
BreakBeforeBraces: Custom
|
||||
ColumnLimit: 79
|
||||
IndentPPDirectives: AfterHash
|
||||
SortUsingDeclarations: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
...
|
||||
|
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -2,11 +2,11 @@
|
||||
.hooks* export-ignore
|
||||
|
||||
# Custom attribute to mark sources as using our C code style.
|
||||
[attr]our-c-style whitespace=tab-in-indent format.clang-format
|
||||
[attr]our-c-style whitespace=tab-in-indent format.clang-format-6.0
|
||||
|
||||
# Custom attribute to mark sources as generated.
|
||||
# Do not perform whitespace checks. Do not format.
|
||||
[attr]generated whitespace=-tab-in-indent,-indent-with-non-tab -format.clang-format
|
||||
[attr]generated whitespace=-tab-in-indent,-indent-with-non-tab -format.clang-format-6.0
|
||||
|
||||
bootstrap eol=lf
|
||||
configure eol=lf
|
||||
|
@ -9,7 +9,7 @@ See documentation on `CMake Development`_ for more information.
|
||||
C++ Code Style
|
||||
==============
|
||||
|
||||
We use `clang-format`_ version **3.8** to define our style for C++ code in
|
||||
We use `clang-format`_ version **6.0** to define our style for C++ code in
|
||||
the CMake source tree. See the `.clang-format`_ configuration file for our
|
||||
style settings. Use the `Utilities/Scripts/clang-format.bash`_ script to
|
||||
format source code. It automatically runs ``clang-format`` on the set of
|
||||
|
2
Source/.gitattributes
vendored
2
Source/.gitattributes
vendored
@ -1,2 +1,2 @@
|
||||
# Do not format third-party sources.
|
||||
/kwsys/** -format.clang-format
|
||||
/kwsys/** -format.clang-format-6.0
|
||||
|
2
Source/CursesDialog/form/.gitattributes
vendored
2
Source/CursesDialog/form/.gitattributes
vendored
@ -1 +1 @@
|
||||
* -format.clang-format
|
||||
* -format.clang-format-6.0
|
||||
|
2
Tests/CSharpLinkFromCxx/.gitattributes
vendored
2
Tests/CSharpLinkFromCxx/.gitattributes
vendored
@ -1 +1 @@
|
||||
UsefulManagedCppClass.* -format.clang-format
|
||||
UsefulManagedCppClass.* -format.clang-format-6.0
|
||||
|
2
Tests/CompileFeatures/.gitattributes
vendored
2
Tests/CompileFeatures/.gitattributes
vendored
@ -1,2 +1,2 @@
|
||||
# Do not format a source containing C++11 '>>' syntax as C++98.
|
||||
cxx_right_angle_brackets.cpp -format.clang-format
|
||||
cxx_right_angle_brackets.cpp -format.clang-format-6.0
|
||||
|
@ -1,2 +1,2 @@
|
||||
# Do not format a source where we want a long line preserved.
|
||||
pic_test.h -format.clang-format
|
||||
pic_test.h -format.clang-format-6.0
|
||||
|
@ -1,2 +1,2 @@
|
||||
# Do not format a source encoded in UTF-16.
|
||||
test_UTF-16LE.h -format.clang-format
|
||||
test_UTF-16LE.h -format.clang-format-6.0
|
||||
|
@ -1,2 +1,2 @@
|
||||
# Exclude reference content from formatting.
|
||||
* -format.clang-format
|
||||
* -format.clang-format-6.0
|
||||
|
@ -1 +1 @@
|
||||
Direct3DApp1.cpp -format.clang-format
|
||||
Direct3DApp1.cpp -format.clang-format-6.0
|
||||
|
4
Utilities/.gitattributes
vendored
4
Utilities/.gitattributes
vendored
@ -3,5 +3,5 @@
|
||||
SetupForDevelopment.sh export-ignore
|
||||
|
||||
# Do not format third-party sources.
|
||||
/KWIML/** -format.clang-format
|
||||
/cm*/** -format.clang-format
|
||||
/KWIML/** -format.clang-format-6.0
|
||||
/cm*/** -format.clang-format-6.0
|
||||
|
@ -78,7 +78,7 @@ test "$#" = 0 || die "$usage"
|
||||
|
||||
# Find a default tool.
|
||||
tools='
|
||||
clang-format-3.8
|
||||
clang-format-6.0
|
||||
clang-format
|
||||
'
|
||||
if test "x$clang_format" = "x"; then
|
||||
@ -96,8 +96,8 @@ if ! type -p "$clang_format" >/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! "$clang_format" --version | grep 'clang-format version 3\.8' >/dev/null 2>/dev/null; then
|
||||
echo "clang-format version 3.8 is required (exactly)"
|
||||
if ! "$clang_format" --version | grep 'clang-format version 6\.0' >/dev/null 2>/dev/null; then
|
||||
echo "clang-format version 6.0 is required (exactly)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -115,8 +115,8 @@ esac
|
||||
$git_ls |
|
||||
|
||||
# Select sources with our attribute.
|
||||
git check-attr --stdin format.clang-format |
|
||||
grep -e ': format\.clang-format: set$' |
|
||||
git check-attr --stdin format.clang-format-6.0 |
|
||||
grep -e ': format\.clang-format-6\.0: set$' |
|
||||
sed -n 's/:[^:]*:[^:]*$//p' |
|
||||
|
||||
# Update sources in-place.
|
||||
|
Loading…
Reference in New Issue
Block a user