summaryrefslogtreecommitdiff
path: root/scripts/coccinelle/try_parse.sh
blob: 3033242946f07d7d25f69b5a203c48252a4e12e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh

# Echo the name of every argument of this script that is not "perfect"
# according to coccinelle's --parse-c.

top="$(dirname "$0")/../.."

exitcode=0

for fn in "$@"; do

    if spatch -macro_file_builtins "$top"/scripts/coccinelle/tor-coccinelle.h \
              -I "$top" -I "$top"/src -I "$top"/ext --parse-c "$fn" \
              2>/dev/null | grep "perfect = 1" > /dev/null; then
        : # it's perfect
    else
        echo "$fn"
        if test "${VERBOSE}" != ""; then
            spatch -macro_file_builtins "$top"/scripts/coccinelle/tor-coccinelle.h \
                   -I "$top" -I "$top"/src -I "$top"/ext --parse-c "$fn"
        fi
        exitcode=1
    fi

done

exit "$exitcode"