From 3a8884a54a41939341584d88eda7da03e66f4619 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Mon, 15 Mar 2021 21:09:18 +0000 Subject: [PATCH 1/2] Add a basic .clang-format that mostly matches existing style This allows me to use git-clang-format. It also ensures that my IDE correctly indents code correctly while I'm typing. --- .clang-format | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..6af6c273 --- /dev/null +++ b/.clang-format @@ -0,0 +1,33 @@ +BasedOnStyle: LLVM +AlignConsecutiveMacros: AcrossEmptyLinesAndComments +AllowAllArgumentsOnNextLine: false +AllowAllConstructorInitializersOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Never +AllowShortFunctionsOnASingleLine: None +AllowShortIfStatementsOnASingleLine: false +AlwaysBreakAfterReturnType: All +BreakBeforeBraces: Linux +BreakStringLiterals: false +ContinuationIndentWidth: 8 +Cpp11BracedListStyle: false +ForEachMacros: + - wl_array_for_each + - wl_client_for_each + - wl_list_for_each + - wl_list_for_each_reverse_safe + - wl_list_for_each_safe + - STAILQ_FOREACH +IndentWidth: 8 +PenaltyBreakAssignment: 1000 +PenaltyBreakBeforeFirstCallParameter: 1000 +PointerAlignment: Right +# Reflow comments breaks some HTML tags in doc comments +ReflowComments: false +# Not sure about SpaceAfterCStyleCast, some files use it others don't +SpaceAfterCStyleCast: true +SortIncludes: Never +SpaceBeforeParens: ControlStatementsExceptForEachMacros +SpaceAroundPointerQualifiers: Before +TabWidth: 8 +UseTab: ForContinuationAndIndentation From dff9f5efcea898a53f79370904c522e1e8764527 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Sat, 20 Mar 2021 17:24:44 +0000 Subject: [PATCH 2/2] Comment out clang-format directives that depend on clang 12 --- .clang-format | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.clang-format b/.clang-format index 6af6c273..91236d6f 100644 --- a/.clang-format +++ b/.clang-format @@ -1,5 +1,5 @@ BasedOnStyle: LLVM -AlignConsecutiveMacros: AcrossEmptyLinesAndComments +# TODO-clang-12: AlignConsecutiveMacros: AcrossEmptyLinesAndComments AllowAllArgumentsOnNextLine: false AllowAllConstructorInitializersOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false @@ -26,8 +26,8 @@ PointerAlignment: Right ReflowComments: false # Not sure about SpaceAfterCStyleCast, some files use it others don't SpaceAfterCStyleCast: true -SortIncludes: Never +# TODO-clang-12: SortIncludes: Never SpaceBeforeParens: ControlStatementsExceptForEachMacros -SpaceAroundPointerQualifiers: Before +# TODO-clang-12: SpaceAroundPointerQualifiers: Before TabWidth: 8 UseTab: ForContinuationAndIndentation