Skip to content

Commit

Permalink
Add .clang-format and format C files
Browse files Browse the repository at this point in the history
Add `.clang-format` file that can be used directly by the clang
formatter or by the Microsoft C/C++ VSCode extension.
Style based on Microsoft default style guide, but update brace and case
indentation settings to match current files better (as well as Go code).

Run formatter on `init\init.c` and `vsockexec\vsockexec.c`.
Changes mostly with brace position, spacing, indentation, and pointer
alignment.

Signed-off-by: Hamza El-Saawy <[email protected]>
  • Loading branch information
helsaawy committed Aug 23, 2024
1 parent e7a1be7 commit d32c55b
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 177 deletions.
12 changes: 12 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Language: Cpp
BasedOnStyle: Microsoft
BreakBeforeBraces: Attach
PointerAlignment: Left
AllowShortFunctionsOnASingleLine: All
# match Go style
IndentCaseLabels: false
# don't break comments over line limit (needed for CodeQL exceptions)
ReflowComments: false
InsertNewlineAtEOF: true
KeepEmptyLines:
AtEndOfFile: true
Loading

0 comments on commit d32c55b

Please sign in to comment.