CI: adjust to clang-format-10 automatically

- leave clang-format file alone, but dynamically
  modify it when clang-format 10 or later is present
- ignore the resulting .bak file
This commit is contained in:
Adriaan de Groot 2020-09-21 16:15:09 +02:00
parent e94c17e331
commit 17914b9cf9
2 changed files with 12 additions and 1 deletions

1
.gitignore vendored
View File

@ -50,6 +50,7 @@ CMakeLists.txt.user
# Backup files
*~
*.bak
# Kate
*.kate-swp

View File

@ -35,7 +35,13 @@ test -n "$CF" || { echo "! No clang-format ($CF_VERSIONS) found in PATH"; exit 1
test -x "$AS" || { echo "! $AS is not executable."; exit 1 ; }
test -x "$CF" || { echo "! $CF is not executable."; exit 1 ; }
expr `"$CF" --version | tr -dc '[^.0-9]' | cut -d . -f 1` '<' 10 > /dev/null || { echo "! $CF is version 10 or later, needs different .clang-format" ; exit 1 ; }
unmangle_clang_format=""
if expr `"$CF" --version | tr -dc '[^.0-9]' | cut -d . -f 1` '<' 10 > /dev/null ; then
:
else
unmangle_clang_format=$( dirname $0 )/../.clang-format
echo "SpaceInEmptyBlock: false" >> "$unmangle_clang_format"
fi
set -e
@ -65,3 +71,7 @@ if test "x$any_dirs" = "xyes" ; then
else
style_some "$@"
fi
if test -n "$unmangle_clang_format" ; then
sed -i.bak '/^SpaceInEmptyBlock/d' "$unmangle_clang_format"
fi