summaryrefslogtreecommitdiff
path: root/.clang-format
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-17 00:11:56 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-05-17 13:34:23 -0600
commit1efe4e42745d79546160a581e1487c5c2f02d6bb (patch)
treedfa5f3aca9a0059b3d827795913dc24fe5d3d171 /.clang-format
parent42fb27570262b52e2ca889030c621b5f4af76fe1 (diff)
wip clang-formatlukeshu/clang-format
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