143 lines
3.6 KiB
YAML
143 lines
3.6 KiB
YAML
# Zephyr Project .clang-format configuration
|
|
# Based on Linux kernel style with Zephyr-specific adaptations
|
|
|
|
# Use LLVM as the base style and customize from there
|
|
BasedOnStyle: LLVM
|
|
|
|
# Language settings
|
|
Language: Cpp
|
|
|
|
# Indentation settings
|
|
IndentWidth: 8
|
|
TabWidth: 8
|
|
UseTab: ForIndentation
|
|
|
|
# Line length
|
|
ColumnLimit: 100
|
|
|
|
# Brace settings
|
|
BreakBeforeBraces: Linux
|
|
BraceWrapping:
|
|
AfterClass: true
|
|
AfterControlStatement: false
|
|
AfterEnum: true
|
|
AfterFunction: true
|
|
AfterNamespace: true
|
|
AfterStruct: true
|
|
AfterUnion: true
|
|
BeforeCatch: true
|
|
BeforeElse: false
|
|
IndentBraces: false
|
|
SplitEmptyFunction: true
|
|
SplitEmptyRecord: true
|
|
SplitEmptyNamespace: true
|
|
|
|
# Always add braces for control statements (Zephyr requirement)
|
|
RemoveBracesLLVM: false
|
|
|
|
# Control statement settings
|
|
SpaceBeforeParens: ControlStatements
|
|
SpacesInParentheses: false
|
|
|
|
# Function settings
|
|
AllowShortFunctionsOnASingleLine: None
|
|
AllowShortBlocksOnASingleLine: Empty
|
|
AllowShortIfStatementsOnASingleLine: Never
|
|
AllowShortLoopsOnASingleLine: false
|
|
AllowShortCaseLabelsOnASingleLine: false
|
|
|
|
# Pointer and reference alignment
|
|
PointerAlignment: Right
|
|
ReferenceAlignment: Right
|
|
|
|
# Spacing settings
|
|
SpaceAfterCStyleCast: false
|
|
SpaceAfterLogicalNot: false
|
|
SpaceBeforeAssignmentOperators: true
|
|
SpaceBeforeCpp11BracedList: false
|
|
SpaceBeforeCtorInitializerColon: true
|
|
SpaceBeforeInheritanceColon: true
|
|
SpaceBeforeRangeBasedForLoopColon: true
|
|
SpaceInEmptyParentheses: false
|
|
SpacesBeforeTrailingComments: 1
|
|
SpacesInAngles: false
|
|
SpacesInCStyleCastParentheses: false
|
|
SpacesInContainerLiterals: false
|
|
SpacesInSquareBrackets: false
|
|
|
|
# Alignment settings
|
|
AlignAfterOpenBracket: DontAlign
|
|
AlignConsecutiveAssignments: false
|
|
AlignConsecutiveDeclarations: false
|
|
AlignEscapedNewlines: Right
|
|
AlignOperands: false
|
|
AlignTrailingComments: false
|
|
|
|
# Breaking settings
|
|
AlwaysBreakAfterDefinitionReturnType: None
|
|
AlwaysBreakAfterReturnType: None
|
|
AlwaysBreakBeforeMultilineStrings: false
|
|
AlwaysBreakTemplateDeclarations: false
|
|
BinPackArguments: false
|
|
BinPackParameters: false
|
|
BreakBeforeBinaryOperators: None
|
|
BreakBeforeTernaryOperators: true
|
|
BreakConstructorInitializersBeforeComma: false
|
|
BreakAfterJavaFieldAnnotations: false
|
|
BreakStringLiterals: true
|
|
|
|
# Penalties (used for line breaking decisions)
|
|
PenaltyBreakAssignment: 2
|
|
PenaltyBreakBeforeFirstCallParameter: 19
|
|
PenaltyBreakComment: 300
|
|
PenaltyBreakFirstLessLess: 120
|
|
PenaltyBreakString: 1000
|
|
PenaltyExcessCharacter: 1000000
|
|
PenaltyReturnTypeOnItsOwnLine: 60
|
|
|
|
# Comment settings
|
|
ReflowComments: true
|
|
CommentPragmas: '^ IWYU pragma:'
|
|
|
|
# Sorting settings
|
|
SortIncludes: true
|
|
SortUsingDeclarations: true
|
|
|
|
# Preprocessor settings
|
|
IndentPPDirectives: None
|
|
MacroBlockBegin: ''
|
|
MacroBlockEnd: ''
|
|
|
|
# Misc settings
|
|
CompactNamespaces: false
|
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
|
ConstructorInitializerIndentWidth: 4
|
|
ContinuationIndentWidth: 4
|
|
Cpp11BracedListStyle: true
|
|
DerivePointerAlignment: false
|
|
DisableFormat: false
|
|
ExperimentalAutoDetectBinPacking: false
|
|
FixNamespaceComments: true
|
|
ForEachMacros: ['LISTIFY', 'FOR_EACH', 'FOR_EACH_FIXED_ARG', 'FOR_EACH_IDX', 'FOR_EACH_IDX_FIXED_ARG', 'FOR_EACH_NONEMPTY_TERM', 'Z_FOR_EACH', 'Z_FOR_EACH_FIXED_ARG', 'Z_FOR_EACH_IDX', 'Z_FOR_EACH_IDX_FIXED_ARG']
|
|
IncludeBlocks: Preserve
|
|
IncludeCategories:
|
|
- Regex: '^<zephyr/.*\.h>'
|
|
Priority: 1
|
|
- Regex: '^<.*\.h>'
|
|
Priority: 2
|
|
- Regex: '^<.*'
|
|
Priority: 3
|
|
- Regex: '.*'
|
|
Priority: 4
|
|
IndentCaseLabels: false
|
|
IndentWrappedFunctionNames: false
|
|
JavaScriptQuotes: Leave
|
|
JavaScriptWrapImports: true
|
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
|
MaxEmptyLinesToKeep: 1
|
|
NamespaceIndentation: None
|
|
ObjCBinPackProtocolList: Auto
|
|
ObjCBlockIndentWidth: 2
|
|
ObjCSpaceAfterProperty: false
|
|
ObjCSpaceBeforeProtocolList: true
|