Commit 654927c8 authored by Ondřej Surý's avatar Ondřej Surý

Add separate .clang-format files for headers

parent 618947c6
BasedOnStyle: LLVM
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterEnum: false
AfterStruct: false
AfterUnion: false
AfterControlStatement: MultiLine
AfterFunction: false # should also be MultiLine, but not yet supported
AfterExternBlock: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
AlwaysBreakAfterReturnType: All
Cpp11BracedListStyle: false
ColumnLimit: 80
AlignAfterOpenBracket: Align
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
AlignEscapedNewlines: Left
DerivePointerAlignment: false
PointerAlignment: Right
PointerBindsToType: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<isc/'
Priority: 2
- Regex: '^<dns/'
Priority: 3
- Regex: '^<iscccc/'
Priority: 4
- Regex: '^<isccfg/'
Priority: 5
- Regex: '^<ns/'
Priority: 6
- Regex: '^<bind9/)'
Priority: 7
- Regex: '^(<[^/]*)/)'
Priority: 8
- Regex: '<[[:alnum:].]+>'
Priority: 1
- Regex: '".*"'
Priority: 9
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
PenaltyBreakAssignment: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 10
PenaltyExcessCharacter: 100
Standard: Cpp11
ContinuationIndentWidth: 8
......@@ -389,7 +389,7 @@ misc:sid:amd64:
💾:sid:amd64:
<<: *precheck_job
script:
- if [ -r .clang-format ]; then ./util/cformat.sh "${CLANG_FORMAT}"; fi
- if [ -r .clang-format ]; then "${CLANG_FORMAT}" -i -style=file $(git ls-files '*.c' '*.h'); fi
- if test "$(git status --porcelain | grep -Ev '\?\?' | wc -l)" -gt "0"; then git status --short; exit 1; fi
🐞:sid:amd64:
......
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
../../../.clang-format.headers
\ No newline at end of file
#!/bin/sh
#
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
CLANG_FORMAT=clang-format
if [ -n "$1" ]; then
CLANG_FORMAT="$1"
fi
CLANG_FORMAT_VERSION=$("$CLANG_FORMAT" --version | sed -e 's/clang-format version \([0-9]*\)\..*/\1/')
if [ "$CLANG_FORMAT_VERSION" -lt 11 ]; then
echo "clang-format version 11 required"
exit 1
fi
# use the main .clang-format for C files
"$CLANG_FORMAT" --style=file --sort-includes -i $(git ls-files '*.c')
# set up a temporary .clang-format file for headers ONLY
cp -f .clang-format .clang-format.bak
sed -e 's/\(AlignConsecutiveDeclarations\).*/\1: true/' \
.clang-format.bak > .clang-format
"$CLANG_FORMAT" --style=file --sort-includes -i $(git ls-files '*.h')
# restore the original .clang-format file
cp -f .clang-format.bak .clang-format
rm -f .clang-format.bak
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment