summaryrefslogtreecommitdiff
path: root/.clang-format
diff options
context:
space:
mode:
Diffstat (limited to '.clang-format')
-rw-r--r--.clang-format46
1 files changed, 46 insertions, 0 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..05e8ba5
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,46 @@
+---
+# ggaze .clang-format — matches docs/coding-conventions.md and the
+# c-best-practices skill. Enforced in CI with `clang-format --dry-run -Werror`.
+Language: Cpp
+BasedOnStyle: LLVM
+
+# 3-space indent, no tabs, 80-col limit.
+# (UseTab singular is the canonical clang-format key across LLVM >=16; the
+# older plural spelling is rejected by current toolchains.)
+ColumnLimit: 80
+IndentWidth: 3
+UseTab: Never
+TabWidth: 3
+ContinuationIndentWidth: 3
+
+# K&R braces (opening brace on the same line).
+BreakBeforeBraces: Attach
+
+# Return type on its own line above the function name (c-best-practices).
+# AllDefinitions is accepted by both LLVM 18 (Fedora 40) and LLVM 22.
+AlwaysBreakAfterReturnType: AllDefinitions
+
+# Pointer asterisk on the variable: `Token *p_token`, not `Token* p_token`.
+PointerAlignment: Right
+
+# Keep the hand-written include order (own header, system, project).
+SortIncludes: false
+IncludeBlocks: Preserve
+
+# Spacing.
+SpaceBeforeParens: ControlStatements
+SpaceAfterCStyleCast: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+
+# No collapsing short control bodies onto one line.
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortBlocksOnASingleLine: Empty
+AllowShortFunctionsOnASingleLine: Empty
+AllowShortLoopsOnASingleLine: false
+AllowShortEnumsOnASingleLine: false
+
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: Consecutive
+AlignConsecutiveDeclarations: Consecutive
+AlignTrailingComments: true \ No newline at end of file