Commit e21acd7e authored by norvell's avatar norvell
Browse files

Add function ensure-one-newline to scripts/check-format.sh since clang-13...

Add function ensure-one-newline to scripts/check-format.sh since clang-13 seems unable to handle this
parent c4047795
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -69,6 +69,12 @@ cl-format-apply() {
    ${CLANG_FORMAT} -i $1
}

ensure-one-newline()
{
    sed -i -e '$a\' $1
    sed -i -e :a -e '/^\n*$/{$d;N;ba' -e '}' $1
}

cl-format-check() {
    local I=$1
    local COLOR=$2
@@ -197,6 +203,7 @@ if [[ $NUMPROCS -lt 2 ]]; then
        RET=$?
        ((NUMFAILS+=RET))
        if [ $FORMAT ]; then
            ensure-one-newline $i
            cl-format-apply $i
        fi
    done
@@ -218,6 +225,7 @@ else
        fi
        ((NUMFAILS+=RET))
        if [ $FORMAT ]; then
            ensure-one-newline $i
            cl-format-apply $i
        fi ) &
        while [[ $(jobs -r -p | wc -l) -ge $NUMPROCS ]];do