From: Andreas Schneider Date: Tue, 19 Jul 2022 13:38:27 +0000 (+0200) Subject: Add a .clang-format file X-Git-Tag: tevent-0.13.0~91 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3d95220a5710731a32a6678ad2878ef6af94b9bb;p=thirdparty%2Fsamba.git Add a .clang-format file How to use: Install 'git-format-clang' which is part of the clang suite (Fedora: git-clang-format, openSUSE: clang-tools). Now do your changes and stage them with `git add`. Once they are staged format the code using `git clang-format` before you commit. Now the formatting changed can be viewed with `git diff` against the staged changes. Signed-off-by: Andreas Schneider Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Wed Jul 20 18:23:49 UTC 2022 on sn-devel-184 --- diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000000..5385807bc1c --- /dev/null +++ b/.clang-format @@ -0,0 +1,26 @@ +# https://clang.llvm.org/docs/ClangFormatStyleOptions.html +BasedOnStyle: LLVM +IndentWidth: 8 +ContinuationIndentWidth: 8 +UseTab: true +BreakBeforeBraces: Custom +BraceWrapping: + AfterEnum: false + AfterFunction: true + AfterStruct: false + AfterUnion: false + AfterExternBlock: true + BeforeElse: false + BeforeWhile: false +AllowShortIfStatementsOnASingleLine: false +ColumnLimit: 80 +IndentCaseLabels: false +AlignAfterOpenBracket: Align +BinPackParameters: false +BinPackArguments: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowAllArgumentsOnNextLine: false +AllowShortFunctionsOnASingleLine: Empty +AlwaysBreakAfterReturnType: None +AlignEscapedNewlines: Left +SortIncludes: false diff --git a/README.Coding.md b/README.Coding.md index b87580f5f85..09a13283e05 100644 --- a/README.Coding.md +++ b/README.Coding.md @@ -88,20 +88,16 @@ displaying trailing whitespace: autocmd BufNewFile,BufRead *.c,*.h exec 'match Todo /\%>' . &textwidth . 'v.\+/' ``` -### clang-format +### How to use clang-format -``` -BasedOnStyle: LLVM -IndentWidth: 8 -UseTab: true -BreakBeforeBraces: Linux -AllowShortIfStatementsOnASingleLine: false -IndentCaseLabels: false -BinPackParameters: false -BinPackArguments: false -SortIncludes: false -``` +Install 'git-format-clang' which is part of the clang suite (Fedora: +git-clang-format, openSUSE: clang-tools). + +Now do your changes and stage them with `git add`. Once they are staged +format the code using `git clang-format` before you commit. +Now the formatting changed can be viewed with `git diff` against the +staged changes. ## FAQ & Statement Reference