Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Oct 1996 08:05:07 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@freefall.freebsd.org, wosch@cs.tu-berlin.de
Cc:        cvs-all@freefall.freebsd.org, CVS-committers@freefall.freebsd.org, cvs-sys@freefall.freebsd.org
Subject:   Re: cvs commit:  src/sys/i386/i386 genassym.c src/sys/pci if_fxp.c src/sys/i386/eisa 3c5x9.c src/sys/net if.h if_arp.h if_mib.c src/sys/netinet if_ether.c ip_fw.c
Message-ID:  <199610122205.IAA08426@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help

>>The nested
>>  include just allowed unportable programs to compile and made my
>>  simple #include checking program report that networking code doesn't
>>  need to include <sys/socket.h>.
>
>where can I find your #include checking program?

It is just a stupid shell script that tries recompiling everything one
header at a time removed.  For the LINT kernel, this takes about twice
as long as `make world' :-).

I've only used this much for the LINT kernel.  It seems to work OK in
the source directory for fsck.  It depends on plenty of warnings being
turned on by default so that removing a header that contains a useful
declaration changes the error output.

It also finds some bugs in gcc.  gcc gets confused when important headers
are missing and dumps core.

The input file must be prepared by running `make -n >zin' in a clean
(kernel) compile directory and editing out the few lines for non-C
files.

---
while :;
do
    read line
    if [ -z "$line" ]
    then
	rm -f 1 2 1.o 2.o z.c
	exit
    fi
    cmd=`echo $line | sed 's;[ 	][^ 	]*$;;'`
    src=`echo $line | sed 's;.* ;;'`
    echo "trying $src"
    cat $src >z.c
    $cmd z.c >/dev/null 2>1
    if test -f z.o
    then
	mv z.o 1.o
    else
	echo "original build of $src failed!"
	$cmd z.c
	exit 1
    fi
    for i in `grep -n '^[ 	]*#include' $src | sed 's/:.*//' | sort -nr`
    do
	sed -e "$i""s/.*//" $src >z.c
	$cmd z.c >/dev/null 2>2
	if test -f z.o
	then
	    mv z.o 2.o
	    if cmp -s 1 2 && cmp -s 1.o 2.o
	    then
		echo "line $i in source $src seems to be unnecessary:"
		head -$i $src | tail -1
		# exit 1
	    fi
	fi
    done
done <zin
---



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610122205.IAA08426>