Skip to content

Commit

Permalink
Add clang-format style for project
Browse files Browse the repository at this point in the history
This adds a .clang-format file for the project.
Requires clang-format-17:
docker run -u 1000 -v $PWD:$PWD xianpengshen/clang-tools:17 \
clang-format -i $(find -name '*.c' | xargs realpath)

Signed-off-by: Andreas Fuchs <[email protected]>
  • Loading branch information
AndreasFuchsTPM committed May 3, 2024
1 parent 46a1079 commit d4f0551
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SPDX-FileCopyrightText: Copyright (c) 2023-2024 Infineon Technologies AG
#
# SPDX-License-Identifier: BSD-2-clause

---

BasedOnStyle: GNU

IndentWidth: 4
ColumnLimit: 100

BreakBeforeBraces: Attach

AlignAfterOpenBracket: Align
AlignConsecutiveDeclarations: true
BinPackParameters: false
AllowAllParametersOfDeclarationOnNextLine: false

SpaceBeforeParens: ControlStatementsExceptControlMacros
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: true
AcrossComments: false

Macros:
- statecase(VAR, STATE)=case 0:{}
- general_failure(VAR)=default:{}
- statecasedefault(VAR)=default:{}
- statecasedefault_error(VAR, r, label)=default:{}
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# .git-blame-ignore-revs

0 comments on commit d4f0551

Please sign in to comment.