1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

uncrustify: move annotation by offset

This commit is contained in:
Martine Lenders 2021-01-19 14:32:40 +01:00
parent b52ddefccd
commit 254af225c9
No known key found for this signature in database
GPG Key ID: CCD317364F63286F

View File

@ -75,6 +75,16 @@ exec_uncrustify () {
DIFF="--- $DIFFFILE\n+++ $DIFFFILE"
fi
DIFFLINE="$(echo "$line" | sed 's/@@ -\([0-9]\+\).*$/\1/')"
# Parse
# @@ -<DIFFLINE>,<DIFFOFFSET> ...
DIFFOFFSET="$(echo "$line" |
sed 's/@@ -[0-9]\+\(,\([0-9]\+\)\)\?.*$/\2/')"
if [ -n "$DIFFOFFSET" ]; then
# if there is a DIFFOFFSET, add it to
# DIFFLINE. DIFFLINE starts at 1, so we
# need to subtract 1 to not overshoot.
DIFFLINE=$(( DIFFLINE + DIFFOFFSET - 1 ))
fi
fi
DIFF="$DIFF\n${line//\\/\\\\}"
fi