Commit feece4b4 authored by Jan Kiene's avatar Jan Kiene
Browse files

change clang-format version in chec-format.sh version check

parent d2574125
Loading
Loading
Loading
Loading
Loading
+154 −155
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ if [ ! -d "lib_com" ]; then
fi

CLANG_FORMAT=clang-format
CLANG_FORMAT_REQUIRED_VERSION="13.0" 
CLANG_FORMAT_REQUIRED_VERSION="18.1"

# list (with space between entries) of substrings that are excluded from the file list, e.g. very large files
EXCLUDE_FILES="ivas_rom_binaural_crend_head.c"
@@ -69,8 +69,7 @@ cl-format-apply() {
  ${CLANG_FORMAT} -i $1
}

ensure-one-newline()
{
ensure-one-newline() {
  # first command adds a newline at the end of the file if there might be none
  # -> clang-format-13 does not add them and warnings e.g. on MacOS are triggered by them
  sed -i -e '$a\' $1
@@ -109,7 +108,7 @@ cl-format-check() {
      DIFF=$(diff -u $I <(echo "$O"))
      if [ $COLOR ]; then
        if [[ "$OSTYPE" == "darwin"* ]]; then
                   echo "$DIFF" | sed "s/^-/`echo -e \"\x1b\"`[41m-/;s/^+/`echo -e \"\x1b\"`[42m+/;s/^@/`echo -e \"\x1b\"`[34m@/;s/$/`echo -e \"\x1b\"`[0m/"
          echo "$DIFF" | sed "s/^-/$(echo -e \"\x1b\")[41m-/;s/^+/$(echo -e \"\x1b\")[42m+/;s/^@/$(echo -e \"\x1b\")[34m@/;s/$/$(echo -e \"\x1b\")[0m/"
        else
          echo "$DIFF" | sed 's/^-/\x1b[41m-/;s/^+/\x1b[42m+/;s/^@/\x1b[34m@/;s/$/\x1b[0m/'
        fi
@@ -223,21 +222,21 @@ else
    (
      cl-format-check $i $COLOR
      RET=$?
        if [[ $RET -gt 0 ]]
        then
      if [[ $RET -gt 0 ]]; then
        echo "1" >>"$NUMFAILSTMPFILE"
      fi
      ((NUMFAILS += RET))
      if [ $FORMAT ]; then
        ensure-one-newline $i
        cl-format-apply $i
        fi ) &
      fi
    ) &
    while [[ $(jobs -r -p | wc -l) -ge $NUMPROCS ]]; do
      sleep 0.1
    done
  done
  wait
    NUMFAILS=`cat $NUMFAILSTMPFILE | wc -l`
  NUMFAILS=$(cat $NUMFAILSTMPFILE | wc -l)
  rm "$NUMFAILSTMPFILE"
  if [[ $NUMFAILS -gt 0 ]]; then
    echo "Total fails:  $NUMFAILS"