1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 22:43:50 +01:00

coccinelle: move annotation by offset

This commit is contained in:
Martine Lenders 2021-01-19 14:31:19 +01:00
parent 6f365f6e43
commit c6260f29b3
No known key found for this signature in database
GPG Key ID: CCD317364F63286F

View File

@ -85,6 +85,16 @@ coccinelle_checkone() {
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