On Tue, Mar 14, 2006 at 02:10:27PM +0100, J?rg Billeter wrote:
> a="$(echo -ne '\001')"
> b="$(echo -ne '\002')"

These can probably be simplified to:

a=$'\001'
b=$'\002'

> pushd $KERNEL_PATH/include

I don't think you need to pushd at the start and then popd at the end of
the script.  The script's environment (including its current working
directory) will already be thrown away when it exits; doing a "cd" will
be just as good.

> # delete the headers marked for removal
> rm -rvf $REMOVE_HEADERS

This might run out of argv space; it might be better to:

for file in $REMOVE_HEADERS ; do rm -rvf $file ; done

or something similar with find/xargs.


Moving on to the test script:

> for header in $(find $DIRECTORIES -name "*.h")
> do
>       for noheader in $NO_TEST_HEADERS
>       do
>               [ "$header" != "$noheader" ] || continue 2
>       done

Would this be a little more clear if the sense of the "[" was reversed?

[ "$header" == "$noheader" ] && continue 2

would be how I'd do it.  I doubt it matters much, though.

Alternately, it might be possible to exclude $NO_TEST_HEADERS from the
find; something like:

args=""
for noheader in $NO_TEST_HEADERS ; do
    args="$args -not -name $(basename $noheader)"
done

for header in $(find $DIRECTORIES -name "*.h" $args)
do
    # ...
done

might work, although I haven't actually tested it.  It might also not be
specific enough; if linux/x.h and asm/x.h both exist, and linux/x.h
needs to be excluded but asm/x.h doesn't, this will exclude both.  So
maybe the way you have it (or with the sense of the test reversed) would
be best.

>       echo -e "#include <$header>" > /tmp/linux-glibc-headers-test.c
>       gcc -I$KERNEL_PATH/include -Werror -S -o - 
> /tmp/linux-glibc-headers-test.c > /dev/null && echo " o $header succeeded" || 
> echo " o $header failed"

I was going to say "should you perhaps be using -c instead of -S?".  But
after some thinking, the only difference is that -c runs the assembler,
and we don't care whether the assembly that cc1 outputs is valid.  As
long as cc1 doesn't exit with an error, that means that there are no
missing constants, types, etc.  So good enough.

Attachment: pgpjIcZM8rR1Z.pgp
Description: PGP signature

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to