Reformat C: Require ClangFormat 9
Unfortunately ClangFormat 10 seems to format parts of the code base
slightly differently.
@@ -9,14 +9,14 @@ SCRIPTS_DIR=$(dirname "$0")
# shellcheck disable=SC1091 source=include-common
. "${SCRIPTS_DIR}/include-common"
-MIN_VERSION=9
-CLANG_FORMAT=$(command -v clang-format-$MIN_VERSION || command -v clang-format)
+REQUIRED_VERSION=9
+CLANG_FORMAT=$(command -v clang-format-$REQUIRED_VERSION || command -v clang-format)
if [ -n "$CLANG_FORMAT" ]; then
LOCATION="$CLANG_FORMAT"
VERSION=$("$CLANG_FORMAT" --version 2> /dev/null)
MAJOR_VERSION=$(printf '%s' "$VERSION" | sed -E 's/.* ([0-9]+)\.[0-9].[0-9][ -].*/\1/')
- if [ "${MAJOR_VERSION:-0}" -lt $MIN_VERSION ]; then
+ if [ "${MAJOR_VERSION:-0}" -ne $REQUIRED_VERSION ]; then
unset CLANG_FORMAT
fi
fi
@@ -25,7 +25,7 @@ if [ -z "${CLANG_FORMAT}" ]; then
printf >&2 'ClangFormat: %s\n' "$LOCATION"
printf >&2 'Version Info: %s\n' "$VERSION"
printf >&2 'Major Version: %s\n' "$MAJOR_VERSION"
- printf >&2 'Please install clang-format %s or later' "$MIN_VERSION"
+ printf >&2 'Please install clang-format %s' "$REQUIRED_VERSION"
exit 1
fi
