summaryrefslogtreecommitdiff
path: root/Meta/lint-clang-format.sh
diff options
context:
space:
mode:
authorRiyyi <Riyyi@users.noreply.github.com>2021-06-15 15:36:43 +0000
committerGunnar Beutner <gunnar@beutner.name>2021-07-15 09:27:44 +0200
commit5d1676b05aa7c8a414881f0414ef3370581d8be5 (patch)
tree523de65e7000b3b3271f4c6d5fc0eb5f436e4476 /Meta/lint-clang-format.sh
parent4566387ba5bc6f8b0907a1e5fb3f097435b89d0f (diff)
downloadserenity-5d1676b05aa7c8a414881f0414ef3370581d8be5.zip
Meta: Do not warn user about too modern clang-format
To prevent warnings for users of varying distributions, do not warn the user if the clang-version is higher than the expected version.
Diffstat (limited to 'Meta/lint-clang-format.sh')
-rwxr-xr-xMeta/lint-clang-format.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/Meta/lint-clang-format.sh b/Meta/lint-clang-format.sh
index 3f83ef7c38..b1c1a43678 100755
--- a/Meta/lint-clang-format.sh
+++ b/Meta/lint-clang-format.sh
@@ -31,13 +31,13 @@ if (( ${#files[@]} )); then
CLANG_FORMAT=clang-format-11
elif command -v clang-format >/dev/null 2>&1 ; then
CLANG_FORMAT=clang-format
- if ! "${CLANG_FORMAT}" --version | grep -qF ' 11.' ; then
- echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 11."
+ if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) < 11) exit 1; }'; then
+ echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 11 or later."
echo "It is very likely that the resulting changes are not what you wanted."
fi
else
echo "clang-format-11 is not available, but C or C++ files need linting! Either skip this script, or install clang-format-11."
- echo "(If you install a package 'clang-format', please make sure it's version 11.)"
+ echo "(If you install a package 'clang-format', please make sure it's version 11 or later.)"
exit 1
fi