aboutsummaryrefslogtreecommitdiffstats
path: root/.clang-format
diff options
context:
space:
mode:
authorgbc dev <gbc@localhost>2026-07-18 20:57:37 +0200
committergbc dev <gbc@localhost>2026-07-18 20:57:37 +0200
commit4901afc59a43841a7cd9e5aee5fbdbd5966a8171 (patch)
treece5fe093e2896cf583ae0fbec123b3999777f8d4 /.clang-format
parentREADME: fix source paths in Architecture table (src/ prefix) (diff)
downloadsl0pboy-4901afc59a43841a7cd9e5aee5fbdbd5966a8171.tar.gz
sl0pboy-4901afc59a43841a7cd9e5aee5fbdbd5966a8171.tar.xz
sl0pboy-4901afc59a43841a7cd9e5aee5fbdbd5966a8171.zip
hooks: clang-format pre-commit (changed lines only) + .clang-format
git-clang-format scopes formatting to the lines each commit touches - a full-file reformat would destroy the deliberately dense hand formatting (opcode tables, multi-statement helpers). The hook re-adds formatted files (git-clang-format --staged fixes the worktree, not the index) and refuses partially-staged C files rather than mixing staged and unstaged changes. Enable once: git config core.hooksPath hooks
Diffstat (limited to '.clang-format')
-rw-r--r--.clang-format23
1 files changed, 23 insertions, 0 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..e338db1
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,23 @@
+# House style for sl0pboy/gbos C: 4-space, attached braces, dense-but-readable.
+# Tuned to minimize churn against the existing hand-formatted code.
+BasedOnStyle: LLVM
+IndentWidth: 4
+TabWidth: 4
+UseTab: Never
+ColumnLimit: 100
+PointerAlignment: Right
+BreakBeforeBraces: Attach
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: AllIfsAndElse
+AllowShortLoopsOnASingleLine: true
+AllowShortBlocksOnASingleLine: Always
+AlignTrailingComments: true
+SpacesBeforeTrailingComments: 2
+AlignConsecutiveMacros: Consecutive
+SortIncludes: Never
+IndentCaseLabels: true
+MaxEmptyLinesToKeep: 2
+KeepEmptyLinesAtTheStartOfBlocks: true
+AlignArrayOfStructures: None
+ReflowComments: false