Re: [patch 1/8] extend make headers_check to detect more problems

From: Sam Ravnborg
Date: Mon Sep 18 2006 - 02:17:14 EST


> --- linux-cg.orig/scripts/hdrcheck.sh 2006-09-18 02:04:44.000000000 +0200
> +++ linux-cg/scripts/hdrcheck.sh 2006-09-18 02:04:45.000000000 +0200
> @@ -1,8 +1,28 @@
> #!/bin/sh
>
> +# check if all included files exist
> for FILE in `grep '^[ \t]*#[ \t]*include[ \t]*<' $2 | cut -f2 -d\< | cut -f1 -d\> | egrep ^linux\|^asm` ; do
> if [ ! -r $1/$FILE ]; then
> echo $2 requires $FILE, which does not exist in exported headers
> exit 1
> fi
> done
> +
> +# try to compile in order to see CC warnings, show only the first few
> +CHECK_CFLAGS=`grep @headercheck: $2 | sed -e 's/^.*@headercheck:\([^@]*\)@.*$/\1/'`

The purpose of @headercheck: should be documented sonewhere.
A simple way to do so would be to paste the content of the changelog that
describe it in the top of this file.

> +CFLAGS="-Wall -std=gnu99 -xc -O2 -I$1 ${CHECK_CFLAGS}"
> +tmpfile=`mktemp`
Can't we do this with a hdrchk$$$ filename to avoid using
random entropy for each compile?

> +${CC:-gcc} ${CFLAGS} -c $2 -o $tmpfile 2>&1 | sed -e "s:$1:include:g" >&2
> +
> +# check if object file is empty
> +if [ "`nm $tmpfile`" ] ; then
Replace nm with {NM:-nm} to obtain correct NM when cross compiling.

> + echo include${2#$1}: warning: non-empty output >&2
Paste output of nm so one can see what is defined?

Sam
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/