Skip to content

Commit

Permalink
Add .clang-format and format C files (#2246)
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 <hamzaelsaawy@microsoft.com>
  • Loading branch information
helsaawy authored Aug 27, 2024
1 parent 59e8375 commit f80cf91
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 138 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 f80cf91

Please sign in to comment.