From 45aac7db6658eacbb8095cf712fc87e24fdb96d0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 17 Jun 2020 07:53:40 -0400 Subject: [PATCH] CI: update clang-format In clang-format 10, SpaceInEmptyBlock is introduced, and defaults to true .. which is different from the earlier formatting versions did. For now, refuse clang-format 10, and search specifically also for clang-format-9.0.1 because that's what I have on my laptop. At some point, switch in the config option and then require clang-format 10 or later (because earlier versions refuse to run with an unknown config option) --- .clang-format | 1 + ci/calamaresstyle | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index cc430e627..187c3638f 100644 --- a/.clang-format +++ b/.clang-format @@ -26,6 +26,7 @@ ReflowComments: "false" SortIncludes: "true" SpaceAfterCStyleCast: "false" SpacesBeforeTrailingComments: "2" +# SpaceInEmptyBlock: "true" SpacesInAngles: "true" SpacesInParentheses: "true" SpacesInSquareBrackets: "true" diff --git a/ci/calamaresstyle b/ci/calamaresstyle index 6a8285124..44f9fe91f 100755 --- a/ci/calamaresstyle +++ b/ci/calamaresstyle @@ -13,7 +13,7 @@ export LANG LC_ALL LC_NUMERIC AS=$( which astyle ) -CF_VERSIONS="clang-format-7 clang-format-8 clang-format70 clang-format80 clang-format" +CF_VERSIONS="clang-format-7 clang-format-8 clang-format70 clang-format80 clang-format-9.0.1 clang-format" for _cf in $CF_VERSIONS do # Not an error if this particular clang-format isn't found @@ -26,6 +26,8 @@ test -n "$CF" || { echo "! No clang-format ($CF_VERSIONS) found in PATH"; exit 1 test -x "$AS" || { echo "! $AS is not executable."; exit 1 ; } test -x "$CF" || { echo "! $CF is not executable."; exit 1 ; } +expr `"$CF" --version | tr -dc '[^.0-9]' | cut -d . -f 1` '<' 10 > /dev/null || { echo "! $CF is version 10 or later, needs different .clang-format" ; exit 1 ; } + set -e any_dirs=no