|
|
e0018b |
From dc712e47c39f4dbc5f089831fd50dd1a2752c8fc Mon Sep 17 00:00:00 2001
|
|
|
e0018b |
From: Vishal Verma <vishal.l.verma@intel.com>
|
|
|
e0018b |
Date: Thu, 7 Oct 2021 02:21:23 -0600
|
|
|
e0018b |
Subject: [PATCH 031/217] ndctl: add .clang-format
|
|
|
e0018b |
|
|
|
e0018b |
Copy the Linux kernel's .clang-format and modify it for ndctl. Only the
|
|
|
e0018b |
'ForEachMacros' section has been modified from the original kernel copy.
|
|
|
e0018b |
|
|
|
e0018b |
Cc: Dan Williams <dan.j.williams@intel.com>
|
|
|
e0018b |
Reported-by: Ben Widawsky <ben.widawsky@intel.com>
|
|
|
e0018b |
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
|
|
|
e0018b |
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
|
|
|
e0018b |
---
|
|
|
e0018b |
.clang-format | 161 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
e0018b |
1 file changed, 161 insertions(+)
|
|
|
e0018b |
create mode 100644 .clang-format
|
|
|
e0018b |
|
|
|
e0018b |
diff --git a/.clang-format b/.clang-format
|
|
|
e0018b |
new file mode 100644
|
|
|
e0018b |
index 0000000..4e00fff
|
|
|
e0018b |
--- /dev/null
|
|
|
e0018b |
+++ b/.clang-format
|
|
|
e0018b |
@@ -0,0 +1,161 @@
|
|
|
e0018b |
+# SPDX-License-Identifier: GPL-2.0
|
|
|
e0018b |
+#
|
|
|
e0018b |
+# clang-format configuration file. Intended for clang-format >= 4.
|
|
|
e0018b |
+# Copied from Linux's .clang-format
|
|
|
e0018b |
+#
|
|
|
e0018b |
+# For more information, see:
|
|
|
e0018b |
+#
|
|
|
e0018b |
+# https://clang.llvm.org/docs/ClangFormat.html
|
|
|
e0018b |
+# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
|
|
e0018b |
+#
|
|
|
e0018b |
+---
|
|
|
e0018b |
+AccessModifierOffset: -4
|
|
|
e0018b |
+AlignAfterOpenBracket: Align
|
|
|
e0018b |
+AlignConsecutiveAssignments: false
|
|
|
e0018b |
+AlignConsecutiveDeclarations: false
|
|
|
e0018b |
+#AlignEscapedNewlines: Left # Unknown to clang-format-4.0
|
|
|
e0018b |
+AlignOperands: true
|
|
|
e0018b |
+AlignTrailingComments: false
|
|
|
e0018b |
+AllowAllParametersOfDeclarationOnNextLine: false
|
|
|
e0018b |
+AllowShortBlocksOnASingleLine: false
|
|
|
e0018b |
+AllowShortCaseLabelsOnASingleLine: false
|
|
|
e0018b |
+AllowShortFunctionsOnASingleLine: None
|
|
|
e0018b |
+AllowShortIfStatementsOnASingleLine: false
|
|
|
e0018b |
+AllowShortLoopsOnASingleLine: false
|
|
|
e0018b |
+AlwaysBreakAfterDefinitionReturnType: None
|
|
|
e0018b |
+AlwaysBreakAfterReturnType: None
|
|
|
e0018b |
+AlwaysBreakBeforeMultilineStrings: false
|
|
|
e0018b |
+AlwaysBreakTemplateDeclarations: false
|
|
|
e0018b |
+BinPackArguments: true
|
|
|
e0018b |
+BinPackParameters: true
|
|
|
e0018b |
+BraceWrapping:
|
|
|
e0018b |
+ AfterClass: false
|
|
|
e0018b |
+ AfterControlStatement: false
|
|
|
e0018b |
+ AfterEnum: false
|
|
|
e0018b |
+ AfterFunction: true
|
|
|
e0018b |
+ AfterNamespace: true
|
|
|
e0018b |
+ AfterObjCDeclaration: false
|
|
|
e0018b |
+ AfterStruct: false
|
|
|
e0018b |
+ AfterUnion: false
|
|
|
e0018b |
+ #AfterExternBlock: false # Unknown to clang-format-5.0
|
|
|
e0018b |
+ BeforeCatch: false
|
|
|
e0018b |
+ BeforeElse: false
|
|
|
e0018b |
+ IndentBraces: false
|
|
|
e0018b |
+ #SplitEmptyFunction: true # Unknown to clang-format-4.0
|
|
|
e0018b |
+ #SplitEmptyRecord: true # Unknown to clang-format-4.0
|
|
|
e0018b |
+ #SplitEmptyNamespace: true # Unknown to clang-format-4.0
|
|
|
e0018b |
+BreakBeforeBinaryOperators: None
|
|
|
e0018b |
+BreakBeforeBraces: Custom
|
|
|
e0018b |
+#BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
|
|
|
e0018b |
+BreakBeforeTernaryOperators: false
|
|
|
e0018b |
+BreakConstructorInitializersBeforeComma: false
|
|
|
e0018b |
+#BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
|
|
|
e0018b |
+BreakAfterJavaFieldAnnotations: false
|
|
|
e0018b |
+BreakStringLiterals: false
|
|
|
e0018b |
+ColumnLimit: 80
|
|
|
e0018b |
+CommentPragmas: '^ IWYU pragma:'
|
|
|
e0018b |
+#CompactNamespaces: false # Unknown to clang-format-4.0
|
|
|
e0018b |
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
|
|
e0018b |
+ConstructorInitializerIndentWidth: 8
|
|
|
e0018b |
+ContinuationIndentWidth: 8
|
|
|
e0018b |
+Cpp11BracedListStyle: false
|
|
|
e0018b |
+DerivePointerAlignment: false
|
|
|
e0018b |
+DisableFormat: false
|
|
|
e0018b |
+ExperimentalAutoDetectBinPacking: false
|
|
|
e0018b |
+#FixNamespaceComments: false # Unknown to clang-format-4.0
|
|
|
e0018b |
+
|
|
|
e0018b |
+# Taken from:
|
|
|
e0018b |
+# while read -r sym; do
|
|
|
e0018b |
+# printf " - '%s'\n" "$sym";
|
|
|
e0018b |
+# done < \
|
|
|
e0018b |
+# <(cscope -dL6 "foreach|for_each" \
|
|
|
e0018b |
+# | awk '{ print $4 $5 }' | grep -E 'foreach|for_each' \
|
|
|
e0018b |
+# | sed -e 's/#define//' \
|
|
|
e0018b |
+# -e 's/*//' \
|
|
|
e0018b |
+# -e 's/://' \
|
|
|
e0018b |
+# -e 's/\(.*for_each.*\)(.*/\1/' \
|
|
|
e0018b |
+# -e 's/\(.*foreach.*\)(.*/\1/' \
|
|
|
e0018b |
+# | sort -u)
|
|
|
e0018b |
+ForEachMacros:
|
|
|
e0018b |
+ - 'daxctl_dev_foreach'
|
|
|
e0018b |
+ - 'daxctl_mapping_foreach'
|
|
|
e0018b |
+ - 'daxctl_region_foreach'
|
|
|
e0018b |
+ - 'kmod_list_foreach'
|
|
|
e0018b |
+ - 'kmod_list_foreach_reverse'
|
|
|
e0018b |
+ - 'list_for_each'
|
|
|
e0018b |
+ - 'list_for_each_off'
|
|
|
e0018b |
+ - 'list_for_each_rev'
|
|
|
e0018b |
+ - 'list_for_each_safe'
|
|
|
e0018b |
+ - 'list_for_each_safe_off'
|
|
|
e0018b |
+ - 'ndctl_btt_foreach'
|
|
|
e0018b |
+ - 'ndctl_btt_foreach_safe'
|
|
|
e0018b |
+ - 'ndctl_bus_foreach'
|
|
|
e0018b |
+ - 'ndctl_dax_foreach'
|
|
|
e0018b |
+ - 'ndctl_dax_foreach_safe'
|
|
|
e0018b |
+ - 'ndctl_dimm_foreach'
|
|
|
e0018b |
+ - 'ndctl_dimm_foreach_in_interleave_set'
|
|
|
e0018b |
+ - 'ndctl_dimm_foreach_in_region'
|
|
|
e0018b |
+ - 'ndctl_interleave_set_foreach'
|
|
|
e0018b |
+ - 'ndctl_mapping_foreach'
|
|
|
e0018b |
+ - 'ndctl_namespace_badblock_foreach'
|
|
|
e0018b |
+ - 'ndctl_namespace_bb_foreach'
|
|
|
e0018b |
+ - 'ndctl_namespace_foreach'
|
|
|
e0018b |
+ - 'ndctl_namespace_foreach_safe'
|
|
|
e0018b |
+ - 'ndctl_pfn_foreach'
|
|
|
e0018b |
+ - 'ndctl_pfn_foreach_safe'
|
|
|
e0018b |
+ - 'ndctl_region_badblock_foreach'
|
|
|
e0018b |
+ - 'ndctl_region_foreach'
|
|
|
e0018b |
+ - 'udev_list_entry_foreach'
|
|
|
e0018b |
+
|
|
|
e0018b |
+#IncludeBlocks: Preserve # Unknown to clang-format-5.0
|
|
|
e0018b |
+IncludeCategories:
|
|
|
e0018b |
+ - Regex: '.*'
|
|
|
e0018b |
+ Priority: 1
|
|
|
e0018b |
+IncludeIsMainRegex: '(Test)?$'
|
|
|
e0018b |
+IndentCaseLabels: false
|
|
|
e0018b |
+#IndentPPDirectives: None # Unknown to clang-format-5.0
|
|
|
e0018b |
+IndentWidth: 8
|
|
|
e0018b |
+IndentWrappedFunctionNames: false
|
|
|
e0018b |
+JavaScriptQuotes: Leave
|
|
|
e0018b |
+JavaScriptWrapImports: true
|
|
|
e0018b |
+KeepEmptyLinesAtTheStartOfBlocks: false
|
|
|
e0018b |
+MacroBlockBegin: ''
|
|
|
e0018b |
+MacroBlockEnd: ''
|
|
|
e0018b |
+MaxEmptyLinesToKeep: 1
|
|
|
e0018b |
+NamespaceIndentation: None
|
|
|
e0018b |
+#ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
|
|
|
e0018b |
+ObjCBlockIndentWidth: 8
|
|
|
e0018b |
+ObjCSpaceAfterProperty: true
|
|
|
e0018b |
+ObjCSpaceBeforeProtocolList: true
|
|
|
e0018b |
+
|
|
|
e0018b |
+# Taken from git's rules
|
|
|
e0018b |
+#PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
|
|
|
e0018b |
+PenaltyBreakBeforeFirstCallParameter: 30
|
|
|
e0018b |
+PenaltyBreakComment: 10
|
|
|
e0018b |
+PenaltyBreakFirstLessLess: 0
|
|
|
e0018b |
+PenaltyBreakString: 10
|
|
|
e0018b |
+PenaltyExcessCharacter: 100
|
|
|
e0018b |
+PenaltyReturnTypeOnItsOwnLine: 60
|
|
|
e0018b |
+
|
|
|
e0018b |
+PointerAlignment: Right
|
|
|
e0018b |
+ReflowComments: false
|
|
|
e0018b |
+SortIncludes: false
|
|
|
e0018b |
+#SortUsingDeclarations: false # Unknown to clang-format-4.0
|
|
|
e0018b |
+SpaceAfterCStyleCast: false
|
|
|
e0018b |
+SpaceAfterTemplateKeyword: true
|
|
|
e0018b |
+SpaceBeforeAssignmentOperators: true
|
|
|
e0018b |
+#SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
|
|
|
e0018b |
+#SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
|
|
|
e0018b |
+SpaceBeforeParens: ControlStatements
|
|
|
e0018b |
+#SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
|
|
|
e0018b |
+SpaceInEmptyParentheses: false
|
|
|
e0018b |
+SpacesBeforeTrailingComments: 1
|
|
|
e0018b |
+SpacesInAngles: false
|
|
|
e0018b |
+SpacesInContainerLiterals: false
|
|
|
e0018b |
+SpacesInCStyleCastParentheses: false
|
|
|
e0018b |
+SpacesInParentheses: false
|
|
|
e0018b |
+SpacesInSquareBrackets: false
|
|
|
e0018b |
+Standard: Cpp03
|
|
|
e0018b |
+TabWidth: 8
|
|
|
e0018b |
+UseTab: Always
|
|
|
e0018b |
+...
|
|
|
e0018b |
--
|
|
|
e0018b |
2.27.0
|
|
|
e0018b |
|