From: Otto Moerbeek Date: Wed, 12 Feb 2025 07:57:10 +0000 (+0100) Subject: Switch to clang-format-19 by default and allow //comment with no leading space X-Git-Tag: dnsdist-2.0.0-alpha1~102^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fb460aab83ccee1e00f713628040643b554dc79;p=thirdparty%2Fpdns.git Switch to clang-format-19 by default and allow //comment with no leading space Still some formatting differences, but they look legit. It seems older versions of clang-format did not process preprocessor conditionals correctly in all cases. --- diff --git a/.clang-format b/.clang-format index e56bf79197..aa363c30c9 100644 --- a/.clang-format +++ b/.clang-format @@ -31,3 +31,9 @@ AllowAllParametersOfDeclarationOnNextLine: true BreakConstructorInitializers: AfterColon ConstructorInitializerAllOnOneLineOrOnePerLine: true SpaceInEmptyBlock: false + +# I'd rather have the default (Minimum 1) here, but that causes quite some churn +SpacesInLineCommentPrefix: + Minimum: 0 + Maximum: -1 + diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index 4ac84a7e77..1e3e7a5e9e 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -21,7 +21,7 @@ jobs: - name: Update dependencies run: | sudo apt-get update - sudo apt-get -qq --no-install-recommends install git clang-19 + sudo apt-get -qq --no-install-recommends install git clang-format-19 - name: Run format-code on files that should be formatted run: | ./build-scripts/format-code $(find . -type f -name '*.[ch][ch]' | sort | comm -23 - .not-formatted) diff --git a/build-scripts/format-code b/build-scripts/format-code index 62914f5648..2da740a9b5 100755 --- a/build-scripts/format-code +++ b/build-scripts/format-code @@ -28,7 +28,7 @@ if [ x$CIRCLECI = xtrue ]; then verbose=0 fi -FORMAT=clang-format-11 +FORMAT=clang-format-19 if ! which $FORMAT 2> /dev/null; then FORMAT=clang-format fi