# $NetBSD: check-headers.sh,v 1.9 2007/01/02 17:58:11 rillig Exp $ # # This program checks the header files for possible problems. # # When a macro definition contains the characters "${", it is likely # that is comes from a GNU-style configure script that didn't use the # ${prefix} or ${exec_prefix} variable correctly. # set -eu checkdir=`dirname "$0"` . "$checkdir/check-subr.sh" cs_setprogname "$0" found_unresolved_variable=no # usage: check_header check_header() { # See the end of the loop for the redirection. while read line; do # Check for "${" in macro definitions. case "$line" in "#"*define*[\":]\$\{[A-Za-z]*\}/*\"*) found_unresolved_variable=yes cs_error_heading "Found unresolved variable in macro:" cs_error_msg "$fname: $line" ;; esac done < "$1" } find * -type f -print 2>/dev/null \ | { while read fname; do skip=no eval "case \"\$fname\" in $SKIP_FILTER *.orig) skip=yes;; esac" [ $skip = no ] || continue case "$fname" in *.h | *.hpp | *.h++ | *.hxx) check_header "$fname" ;; esac done if [ $found_unresolved_variable = yes ]; then cs_explain <