From b0dfd5854def0a099eaab92d4dcff94b50321fd4 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Wed, 19 Jun 2024 20:17:17 +0200 Subject: [PATCH] chore(common): update C/C++ formatting options This change updates two formatting options: - pointers and references will be left-aligned (`int* foo`). Previously we had the setting to left-align but that got ignored because of the `DerivePointerAlignment` setting which tries to use the style used elsewhere in the file, which is not good to get consistent styling. - no longer always add a line break after the return type of a function, only if type and name don't fit in a line. Unfortunately clang-format doesn't have a setting to only add the line break if the method definition is too long to fit in one line. The new setting matches the alternative formatting from our style guide. --- .clang-format | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.clang-format b/.clang-format index 76e36e1d44..81ca2c82a3 100644 --- a/.clang-format +++ b/.clang-format @@ -19,7 +19,7 @@ AllowShortLambdasOnASingleLine: All AllowShortIfStatementsOnASingleLine: Never AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: AllDefinitions +AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: MultiLine BinPackArguments: true @@ -58,7 +58,7 @@ ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DeriveLineEnding: true -DerivePointerAlignment: true +DerivePointerAlignment: false DisableFormat: false ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true