diff options
| -rw-r--r-- | .editorconfig | 38 | ||||
| -rw-r--r-- | kernel/.clang-format | 51 | ||||
| -rw-r--r-- | tools/.clang-format | 18 | ||||
| -rw-r--r-- | userspace/.clang-format | 18 |
4 files changed, 125 insertions, 0 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..fd0ee61 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,38 @@ +# Open-IOV editor defaults. Per-area .clang-format files govern C layout; +# tools must not mass-reformat existing files (see +# docs/07-developers/onboarding-and-standards.md section 3). + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab +indent_size = 8 + +# Host kernel module: Linux kernel C style (tabs, tab width 8, ~80 columns). +[kernel/**.{c,h}] +indent_style = tab +indent_size = 8 +tab_width = 8 + +# Userspace library: LLVM base, 4 spaces, ~100 columns. +[userspace/**.{c,h}] +indent_style = space +indent_size = 4 +tab_width = 4 + +# Tools: LLVM base, 4 spaces, ~100 columns. +[tools/**.{c,h}] +indent_style = space +indent_size = 4 +tab_width = 4 diff --git a/kernel/.clang-format b/kernel/.clang-format new file mode 100644 index 0000000..a3c3acb --- /dev/null +++ b/kernel/.clang-format @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Linux kernel style for kernel/**: tabs, tab width 8, ~80 columns +# (see docs/07-developers/onboarding-and-standards.md 3.1). +# Existing files are NOT to be mass-reformatted; this config governs new +# code and hunks that are already being edited. +--- +Language: Cpp +BasedOnStyle: LLVM +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: false +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Never +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +BinPackArguments: true +BinPackParameters: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Linux +BreakBeforeTernaryOperators: false +BreakStringLiterals: false +ColumnLimit: 80 +ContinuationIndentWidth: 8 +DerivePointerAlignment: false +IndentCaseBlocks: false +IndentCaseLabels: false +IndentGotoLabels: false +IndentPPDirectives: None +IndentWidth: 8 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MaxEmptyLinesToKeep: 1 +PointerAlignment: Right +ReflowComments: false +SortIncludes: Never +SpaceAfterCStyleCast: false +SpaceBeforeParens: ControlStatements +SpacesBeforeTrailingComments: 1 +TabWidth: 8 +UseTab: Always diff --git a/tools/.clang-format b/tools/.clang-format new file mode 100644 index 0000000..fa09baa --- /dev/null +++ b/tools/.clang-format @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: BSD-3-Clause +# +# Tools style: LLVM base, 4-space indent, ~100 columns +# (see docs/07-developers/onboarding-and-standards.md 3.2). +# Existing files are NOT to be mass-reformatted; this config governs new +# code and hunks that are already being edited. +--- +Language: Cpp +BasedOnStyle: LLVM +AllowShortFunctionsOnASingleLine: Empty +BreakBeforeBraces: Attach +ColumnLimit: 100 +DerivePointerAlignment: false +IndentWidth: 4 +PointerAlignment: Right +SortIncludes: Never +TabWidth: 4 +UseTab: Never diff --git a/userspace/.clang-format b/userspace/.clang-format new file mode 100644 index 0000000..e331ac6 --- /dev/null +++ b/userspace/.clang-format @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: BSD-3-Clause +# +# Userspace library style: LLVM base, 4-space indent, ~100 columns +# (see docs/07-developers/onboarding-and-standards.md 3.2). +# Existing files are NOT to be mass-reformatted; this config governs new +# code and hunks that are already being edited. +--- +Language: Cpp +BasedOnStyle: LLVM +AllowShortFunctionsOnASingleLine: Empty +BreakBeforeBraces: Attach +ColumnLimit: 100 +DerivePointerAlignment: false +IndentWidth: 4 +PointerAlignment: Right +SortIncludes: Never +TabWidth: 4 +UseTab: Never |
