BasedOnStyle: WebKit
IndentWidth: 4
UseTab: Never
ColumnLimit: 120

AllowShortIfStatementsOnASingleLine: false
AllowShortBlocksOnASingleLine: false
AllowShortEnumsOnASingleLine: false

BreakBeforeBraces: Custom
BraceWrapping:
    # Place opening brace on next line if the statement is multi-line
    # e.g.
    #  if (very
    #      long
    #      condition)
    #  {
    AfterControlStatement: MultiLine
    AfterFunction: false

AlignEscapedNewlines: DontAlign
SpaceAfterCStyleCast: true

IndentCaseLabels: true

BreakBeforeBinaryOperators: NonAssignment

ExperimentalAutoDetectBinPacking: true
BinPackParameters: false
AlignAfterOpenBracket: BlockIndent

AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros:
    Enabled: true
    AcrossEmptyLines: false
    AcrossComments: false
AlignTrailingComments: true

WhitespaceSensitiveMacros: ["STRINGIFY"]

# Our include order is WIP so disable it
SortIncludes: false
IncludeCategories:
    # common.h always comes first
    - Regex: '^"common\.h"$'
      Priority: 10
    # everything else
    - Regex: ".*"
      Priority: 1
      SortPriority: 0

AllowShortFunctionsOnASingleLine: None
---
# clang-format v21+ treats .c files as Language: C (not Cpp), so we need this
# section to avoid .c files falling through to the DisableFormat default.
# The settings are identical to Cpp above.
Language: C
DisableFormat: false
BasedOnStyle: WebKit
IndentWidth: 4
UseTab: Never
ColumnLimit: 120

AllowShortIfStatementsOnASingleLine: false
AllowShortBlocksOnASingleLine: false
AllowShortEnumsOnASingleLine: false

BreakBeforeBraces: Custom
BraceWrapping:
    AfterControlStatement: MultiLine
    AfterFunction: false

AlignEscapedNewlines: DontAlign
SpaceAfterCStyleCast: true

IndentCaseLabels: true

BreakBeforeBinaryOperators: NonAssignment

ExperimentalAutoDetectBinPacking: true
BinPackParameters: false
AlignAfterOpenBracket: BlockIndent

AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros:
    Enabled: true
    AcrossEmptyLines: false
    AcrossComments: false
AlignTrailingComments: true

WhitespaceSensitiveMacros: ["STRINGIFY"]

SortIncludes: false
IncludeCategories:
    - Regex: '^"common\.h"$'
      Priority: 10
    - Regex: ".*"
      Priority: 1
      SortPriority: 0

AllowShortFunctionsOnASingleLine: None
