From 8f45f59df3eccbbb6fc0af1d936cf2f052a375d1 Mon Sep 17 00:00:00 2001 From: John Diamond Date: Sat, 12 Oct 2024 22:47:19 +0200 Subject: [PATCH] Meta: Warn before attempting to use clang-format 19 The clang-format version released with llvm 19 will format many files differently than clang-format-18. This change presents the existing warning shown for incorrect clang-format versions to those with versions greater than 18. Fixes issue #1750 --- Meta/lint-clang-format.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Meta/lint-clang-format.sh b/Meta/lint-clang-format.sh index 68304ec7aa8..bca36c2cec8 100755 --- a/Meta/lint-clang-format.sh +++ b/Meta/lint-clang-format.sh @@ -39,13 +39,13 @@ if (( ${#files[@]} )); then CLANG_FORMAT=$TOOLCHAIN_DIR/clang-format elif command -v clang-format >/dev/null 2>&1 ; then CLANG_FORMAT=clang-format - if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) < 18) exit 1; }'; then - echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 18 or later." + if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) != 18) exit 1; }'; then + echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 18." echo "It is very likely that the resulting changes are not what you wanted." fi else echo "clang-format-18 is not available, but C or C++ files need linting! Either skip this script, or install clang-format-18." - echo "(If you install a package 'clang-format', please make sure it's version 18 or later.)" + echo "(If you install a package 'clang-format', please make sure it's version 18.)" exit 1 fi