Meta: Switch to clang-format-19 as the standard formatter

This commit is contained in:
Timothy Flynn 2024-12-27 18:40:32 -05:00 committed by Tim Flynn
commit 66732d2203
Notes: github-actions[bot] 2024-12-28 13:40:44 +00:00
5 changed files with 14 additions and 14 deletions

View file

@ -28,21 +28,21 @@ fi
if (( ${#files[@]} )); then
TOOLCHAIN_DIR=Toolchain/Local/clang/bin
CLANG_FORMAT=false
if command -v clang-format-18 >/dev/null 2>&1 ; then
CLANG_FORMAT=clang-format-18
elif command -v brew >/dev/null 2>&1 && command -v "$(brew --prefix llvm@18)"/bin/clang-format >/dev/null 2>&1 ; then
CLANG_FORMAT="$(brew --prefix llvm@18)"/bin/clang-format
elif command -v $TOOLCHAIN_DIR/clang-format >/dev/null 2>&1 && $TOOLCHAIN_DIR/clang-format --version | grep -qF ' 18.' ; then
if command -v clang-format-19 >/dev/null 2>&1 ; then
CLANG_FORMAT=clang-format-19
elif command -v brew >/dev/null 2>&1 && command -v "$(brew --prefix llvm@19)"/bin/clang-format >/dev/null 2>&1 ; then
CLANG_FORMAT="$(brew --prefix llvm@19)"/bin/clang-format
elif command -v $TOOLCHAIN_DIR/clang-format >/dev/null 2>&1 && $TOOLCHAIN_DIR/clang-format --version | grep -qF ' 19.' ; 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."
if ! "${CLANG_FORMAT}" --version | awk '{ if (substr($NF, 1, index($NF, ".") - 1) != 19) exit 1; }'; then
echo "You are using '$("${CLANG_FORMAT}" --version)', which appears to not be clang-format 19."
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.)"
echo "clang-format-19 is not available, but C or C++ files need linting! Either skip this script, or install clang-format-19."
echo "(If you install a package 'clang-format', please make sure it's version 19.)"
exit 1
fi