summaryrefslogtreecommitdiff
path: root/.clang-format
diff options
context:
space:
mode:
Diffstat (limited to '.clang-format')
-rw-r--r--.clang-format49
1 files changed, 49 insertions, 0 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..686a068
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,49 @@
+---
+# .clang-format - How to format C files in sbc-harness
+#
+# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+# https://releases.llvm.org/19.1.0/tools/clang/docs/ClangFormatStyleOptions.html
+
+Language: Cpp # "C" didn't become a value until clang 20; I'm still on clang 19.1
+BasedOnStyle: LLVM
+LineEnding: LF
+ColumnLimit: 0
+
+# Indentation
+UseTab: AlignWithSpaces
+TabWidth: 8
+IndentWidth: 8
+ContinuationIndentWidth: 8
+IndentCaseLabels: false
+
+# Brace style
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortIfStatementsOnASingleLine: AllIfsAndElse
+BreakBeforeBraces: Attach
+Cpp11BracedListStyle: false
+
+# Alignment
+AlignConsecutiveAssignments:
+ Enabled: true
+ AcrossEmptyLines: false
+ AcrossComments: true
+ PadOperators: true
+AlignConsecutiveDeclarations:
+ Enabled: true
+ AcrossEmptyLines: false
+ AcrossComments: true
+ AlignFunctionPointers: true
+AlignConsecutiveShortCaseStatements:
+ Enabled: true
+
+# Preprocessor
+AlignConsecutiveMacros:
+ Enabled: true
+ AcrossEmptyLines: false
+ AcrossComments: true
+AlignEscapedNewlines: Left
+IndentPPDirectives: BeforeHash
+PPIndentWidth: -1 # inherit from IndentWidth
+SortIncludes: CaseSensitive