From cd07912073c951b4bbb871ed2653af1be2cfc714 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 11:55:11 +0200 Subject: Adding upstream version 2.1.30. Signed-off-by: Daniel Baumann --- compat/check_includes.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 compat/check_includes.sh (limited to 'compat/check_includes.sh') diff --git a/compat/check_includes.sh b/compat/check_includes.sh new file mode 100755 index 0000000..0090007 --- /dev/null +++ b/compat/check_includes.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +RETVAL=0 + +# params - paths to the source files to search +SRC="$*" + +# param FUNC - name of the function in compat to check +check_compat_func () { + FILES=`grep -rE "([^[:alnum:]]|^)$1\([^\)]+\)" --include=\*.{c,h} $SRC | cut -d: -f1 | uniq` + for f in $FILES; do + grep -q "#include \"compat.h\"" $f + if [ $? -ne 0 ]; then + echo "Missing #include \"compat.h\" in file $f for function $1()" + RETVAL=$((RETVAL+1)) + fi + done +} + +check_compat_macro () { + FILES=`grep -rE "([^[:alnum:]]|^)$1([^[:alnum:]]|$)" --include=\*.{c,h} $SRC | cut -d: -f1 | uniq` + for f in $FILES; do + grep -q "#include \"compat.h\"" $f + if [ $? -ne 0 ]; then + echo "Missing #include \"compat.h\" in file $f for macro $1" + RETVAL=$((RETVAL+1)) + fi + done +} + +check_compat_func vdprintf +check_compat_func asprintf +check_compat_func vasprintf +check_compat_func getline +check_compat_func strndup +check_compat_func strnstr +check_compat_func strdupa +check_compat_func strchrnul +check_compat_func get_current_dir_name +check_compat_func pthread_mutex_timedlock +check_compat_func UNUSED +check_compat_macro _PACKED + +exit $RETVAL -- cgit v1.2.3