diff --git a/.clang-format b/.clang-format index 18c50583..e53eca26 100644 --- a/.clang-format +++ b/.clang-format @@ -7,28 +7,40 @@ BasedOnStyle: LLVM IndentWidth: 4 UseTab: Never -BreakBeforeBraces: Linux +# === Struct/Union/Class member indentation === +# These options control indentation of struct members to ensure consistent +# 4-space indentation for all struct/union/class members +IndentAccessModifiers: false +AccessModifierOffset: 0 +NamespaceIndentation: All + +BreakBeforeBraces: Attach BraceWrapping: AfterControlStatement: false - AfterFunction: true + AfterFunction: false AfterClass: false AfterStruct: false + # AfterStruct: false keeps struct opening brace on same line (K&R style) + # Struct members will still be indented with IndentWidth: 4 AfterUnion: false AfterNamespace: false AfterEnum: false BeforeCatch: false BeforeElse: false IndentBraces: false + # IndentBraces: false ensures braces themselves are not indented, + # but content inside braces respects IndentWidth setting -ContinuationIndentWidth: 0 -AlignAfterOpenBracket: false AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AllowShortBlocksOnASingleLine: Always +# AllowShortFunctionsOnASingleLine: None enforces function bodies +# to always be on separate lines, following K&R convention +AllowShortFunctionsOnASingleLine: None + IndentCaseLabels: false SpaceAfterCStyleCast: true -AllowShortFunctionsOnASingleLine: None -ColumnLimit: 80 +ColumnLimit: 150 MaxEmptyLinesToKeep: 1 Cpp11BracedListStyle: false AlignTrailingComments: true @@ -39,7 +51,9 @@ IncludeBlocks: Regroup IncludeCategories: - Regex: '<[[:alnum:].]+>' Priority: 1 + # System headers (angle brackets) have highest priority - Regex: '.*' Priority: 2 + # Project headers (quotes) have lower priority SortIncludes: CaseSensitive AlignEscapedNewlines: Left \ No newline at end of file