blob: 65db9502b1f027938b9dfc3e160e1353b1e29b89 [file] [log] [blame]
Michal Vaskob0e3ec42021-05-26 09:48:31 +02001#!/bin/sh
2
3RETVAL=0
4
5# params - paths to the source files to search
6SRC="$*"
7
8# param FUNC - name of the function in compat to check
9check_compat_func () {
10 FILES=`grep -rE "([^[:alnum:]]|^)$1\([^\)]+\)" --include=\*.{c,h} $SRC | cut -d: -f1 | uniq`
11 for f in $FILES; do
12 grep -q "#include \"compat.h\"" $f
13 if [ $? -ne 0 ]; then
14 echo "Missing #include \"compat.h\" in file $f for function $1()"
15 RETVAL=$((RETVAL+1))
16 fi
17 done
18}
19
20check_compat_macro () {
21 FILES=`grep -rE "([^[:alnum:]]|^)$1([^[:alnum:]]|$)" --include=\*.{c,h} $SRC | cut -d: -f1 | uniq`
22 for f in $FILES; do
23 grep -q "#include \"compat.h\"" $f
24 if [ $? -ne 0 ]; then
25 echo "Missing #include \"compat.h\" in file $f for macro $1"
26 RETVAL=$((RETVAL+1))
27 fi
28 done
29}
30
31check_compat_func vdprintf
32check_compat_func asprintf
33check_compat_func vasprintf
34check_compat_func getline
35check_compat_func strndup
36check_compat_func strnstr
37check_compat_func strdupa
38check_compat_func strchrnul
39check_compat_func get_current_dir_name
40check_compat_func pthread_mutex_timedlock
41check_compat_func UNUSED
42check_compat_macro _PACKED
43
44exit $RETVAL