CI: forbid clang-format-14

This commit is contained in:
Adriaan de Groot 2022-05-18 12:55:15 +02:00
parent f352740aba
commit fc8e5fb5c7

View File

@ -24,7 +24,7 @@ test -f "$TOPDIR/.clang-format" || { echo "! No .clang-format support files in $
AS=$( which astyle ) AS=$( which astyle )
# Allow specifying CF_VERSIONS outside already # Allow specifying CF_VERSIONS outside already
CF_VERSIONS="$CF_VERSIONS clang-format14 clang-format-14 clang-format13 clang-format-13 clang-format12 clang-format-12 clang-format" CF_VERSIONS="$CF_VERSIONS clang-format13 clang-format-13 clang-format-13.0.1 clang-format12 clang-format-12 clang-format"
for _cf in $CF_VERSIONS for _cf in $CF_VERSIONS
do do
# Not an error if this particular clang-format isn't found # Not an error if this particular clang-format isn't found
@ -42,14 +42,17 @@ test -x "$CF" || { echo "! $CF is not executable."; exit 1 ; }
# Version 7 and earlier doesn't understand all the options we would like # Version 7 and earlier doesn't understand all the options we would like
# Version 12 handles lambdas nicely, so use that. # Version 12 handles lambdas nicely, so use that.
# Version 13 is also ok. # Version 13 is also ok.
# Version 14 behaves differently with short-functions-in-class,
# spreading functions out that 13 keeps on one line. To avoid
# ping-pong commits, forbid 14.
format_version=`"$CF" --version | tr -dc '[^.0-9]' | cut -d . -f 1` format_version=`"$CF" --version | tr -dc '[^.0-9]' | cut -d . -f 1`
case "$format_version" in case "$format_version" in
12|13|14 ) 12|13 )
: :
;; ;;
* ) * )
echo "! Clang-format version '$format_version' unsupported, versions 12 through 14 are ok." echo "! Clang-format version '$format_version' unsupported, versions 12 or 13 are ok."
exit 1 exit 1
;; ;;
esac esac