From ee19a6cbbcb28e7aab04dd13918edd46f21ecb22 Mon Sep 17 00:00:00 2001 From: David Turner Date: Fri, 1 May 2020 15:37:56 +0200 Subject: [PATCH] Add .clang-format file This file can be used to reformat FreeType sources and commits using one of these methods: - Direct formatting of a whole file: clang-format -i path/to/file For example, to reformat all sources at once: echo builds/unix/ftconfig.h.in $(git ls-files *.[hc]) | xargs clang-format -i - Only reformat the changed lines in the current work directoy: git clang-format The style settings in this file are very close to the FreeType formatting style, with the following exceptions which are not supported here: - Mminimal 2-space margin on each non-empty line. (no left margin instead). - 2 empty lines between variable declarations and statements in C blocks. (only 1 is kept). { int x = ...; foo(x); } becomes { int x = ...; foo(x); } - Aignment of declarations uses 2 spaces to separate types and variable names (only 1 space is kept). int x; => int x; int y; int y; - The start used for output parameters in function signature should be near the variable name (always near the type). void foo(int* input_ptr, int *output_ptr) => void foo(int* input_ptr, int* output_ptr) --- .clang-format | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..fbd04c11c --- /dev/null +++ b/.clang-format @@ -0,0 +1,16 @@ +BasedOnStyle: Chromium +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AlignConsecutiveMacros: true +AlignEscapedNewlines: true +# AlignOperands: Align +AlignTrailingComments: true +AlwaysBreakAfterReturnType: AllDefinitions +BreakBeforeBraces: Allman +ColumnLimit: 80 +DerivePointerAlignment: false +IndentCaseLabels: false +PointerAlignment: Left +SpaceBeforeParens: ControlStatements +SpacesInParentheses: true