]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add separate .clang-format files for headers
authorOndřej Surý <ondrej@sury.org>
Fri, 14 Feb 2020 08:14:28 +0000 (09:14 +0100)
committerOndřej Surý <ondrej@sury.org>
Fri, 14 Feb 2020 08:31:05 +0000 (09:31 +0100)
22 files changed:
.clang-format.headers [new file with mode: 0644]
.gitlab-ci.yml
bin/confgen/include/.clang-format [new symlink]
bin/dig/include/.clang-format [new symlink]
bin/named/include/.clang-format [new symlink]
bin/named/unix/include/.clang-format [new symlink]
bin/named/win32/include/.clang-format [new symlink]
bin/rndc/include/.clang-format [new symlink]
contrib/dlz/drivers/include/.clang-format [new symlink]
contrib/dlz/modules/include/.clang-format [new symlink]
lib/bind9/include/.clang-format [new symlink]
lib/dns/include/.clang-format [new symlink]
lib/irs/include/.clang-format [new symlink]
lib/irs/win32/include/.clang-format [new symlink]
lib/isc/include/.clang-format [new symlink]
lib/isc/pthreads/include/.clang-format [new symlink]
lib/isc/unix/include/.clang-format [new symlink]
lib/isc/win32/include/.clang-format [new symlink]
lib/isccc/include/.clang-format [new symlink]
lib/isccfg/include/.clang-format [new symlink]
lib/ns/include/.clang-format [new symlink]
util/cformat.sh [deleted file]

diff --git a/.clang-format.headers b/.clang-format.headers
new file mode 100644 (file)
index 0000000..0e36bb4
--- /dev/null
@@ -0,0 +1,61 @@
+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
index 7719ea14a7d4ad2c270b0569fbe80dc38cb9428c..9ce010ff21dda33070af710e42e8db054efe2542 100644 (file)
@@ -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:
diff --git a/bin/confgen/include/.clang-format b/bin/confgen/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/bin/dig/include/.clang-format b/bin/dig/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/bin/named/include/.clang-format b/bin/named/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/bin/named/unix/include/.clang-format b/bin/named/unix/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/bin/named/win32/include/.clang-format b/bin/named/win32/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/bin/rndc/include/.clang-format b/bin/rndc/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/contrib/dlz/drivers/include/.clang-format b/contrib/dlz/drivers/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/contrib/dlz/modules/include/.clang-format b/contrib/dlz/modules/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/lib/bind9/include/.clang-format b/lib/bind9/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/lib/dns/include/.clang-format b/lib/dns/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/lib/irs/include/.clang-format b/lib/irs/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/lib/irs/win32/include/.clang-format b/lib/irs/win32/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/lib/isc/include/.clang-format b/lib/isc/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/lib/isc/pthreads/include/.clang-format b/lib/isc/pthreads/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/lib/isc/unix/include/.clang-format b/lib/isc/unix/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/lib/isc/win32/include/.clang-format b/lib/isc/win32/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/lib/isccc/include/.clang-format b/lib/isccc/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/lib/isccfg/include/.clang-format b/lib/isccfg/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/lib/ns/include/.clang-format b/lib/ns/include/.clang-format
new file mode 120000 (symlink)
index 0000000..0e62f72
--- /dev/null
@@ -0,0 +1 @@
+../../../.clang-format.headers
\ No newline at end of file
diff --git a/util/cformat.sh b/util/cformat.sh
deleted file mode 100755 (executable)
index 3ad6231..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/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