BasedOnStyle: LLVM
IndentWidth: 8
UseTab: Always
-BreakBeforeBraces: Linux
+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
+AlwaysBreakAfterReturnType: TopLevelDefinitions
Cpp11BracedListStyle: false
ColumnLimit: 80
AlignAfterOpenBracket: Align
-AlignConsecutiveDeclarations: true
+AlignConsecutiveDeclarations: false
+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/'
- Regex: '".*"'
Priority: 9
KeepEmptyLinesAtTheStartOfBlocks: false
-
-# Taken from git's rules
-PenaltyBreakAssignment: 10
-# PenaltyBreakBeforeFirstCallParameter: 30
+MaxEmptyLinesToKeep: 1
+PenaltyBreakAssignment: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 10
PenaltyExcessCharacter: 100
-
Standard: Cpp11
-
ContinuationIndentWidth: 8
--- /dev/null
+#!/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.
+
+# use the main .clang-format for C files
+find bin lib -name "*.c" |
+ xargs clang-format --style=file --sort-includes -i
+
+# set up a temporary .clang-format file for headers ONLY
+cp -f .clang-format .clang-format.bak
+sed -e 's/\(AlignConsecutiveDeclarations\).*/\1: true/' \
+ -e 's/\(AlwaysBreakAfterReturnType\).*/\1: All/' \
+ .clang-format.bak > .clang-format
+
+# modify header files
+find bin lib -name "*.h" |
+ xargs clang-format --style=file --sort-includes -i
+
+# restore the original .clang-format file
+cp -f .clang-format.bak .clang-format
+rm -f .clang-format.bak
./util/COPYRIGHT.TOP X 2018,2019,2020
./util/bindkeys.pl PERL 2009,2010,2011,2012,2014,2016,2017,2018,2019,2020
./util/branchsync.sh SH 2013,2016,2018,2019,2020
+./util/cformat.sh SH 2020
./util/check-ans-prereq.sh SH 2019,2020
./util/check-categories.sh SH 2015,2016,2017,2018,2019,2020
./util/check-changes PERL 2002,2004,2007,2012,2016,2018,2019,2020