Skip to content
Snippets Groups Projects
Commit 6b9c233c authored by Brad King's avatar Brad King
Browse files

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 `,`
parent 5357cfc4
No related branches found
No related tags found
No related merge requests found
---
# This configuration requires clang-format 3.8 or higher.
# 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
Standard: Cpp03
...
......@@ -27,7 +27,7 @@ copies of KWSys within dependent projects can be updated to get the changes.
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 KWSys source tree. See the `.clang-format`_ configuration file for
our style settings. Use the `clang-format.bash`_ script to format source
code. It automatically runs ``clang-format`` on the set of source files
......
......@@ -78,8 +78,8 @@ test "$#" = 0 || die "$usage"
# Find a default tool.
tools='
clang-format-6.0
clang-format
clang-format-3.8
'
if test "x$clang_format" = "x"; then
for tool in $tools; do
......@@ -92,7 +92,12 @@ fi
# Verify that we have a tool.
if ! type -p "$clang_format" >/dev/null; then
echo "Unable to locate '$clang_format'"
echo "Unable to locate a 'clang-format' tool."
exit 1
fi
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment