Re: Extern variables in *.c files (maintainers pls read this)

From: Olaf Dietsche (olaf.dietsche--list.linux-kernel@exmail.de)
Date: Thu Jan 03 2002 - 18:14:54 EST


"vda@port.imtp.ilyichevsk.odessa.ua" <vda@port.imtp.ilyichevsk.odessa.ua> writes:

> And this method is traditional for C. We have struct declarations and fn
> propotypes in *.h, we should place extern vars there too. Always.

Agreed.

> If you are a kernel subsystem or driver maintainer, you may wish to check
> whether *your* part of kernel has any extern variable defs. Just run this
> hunter script in top dir of kernel source:
> -----------------------
> #!/bin/sh
>
> function do_grep() {
> pattern="$1"
> dir="$2"
> shift;shift
>
> for i in $dir/$*; do
> if ! test -d "$i"; then
> if test -e "$i"; then
> grep -E "$pattern" "$i" /dev/null
> fi
> fi
> done
> for i in $dir/*; do
> if test -d "$i"; then
> do_grep "$pattern" "$i" $*
> fi
> done
> }
>
> do_grep 'extern [^()]*;' . "*.c" 2>&1 | tee ../extern.log
> ---------------------------------

FWIW, I suppose you meant:
$ find . -name '*.c' | xargs grep -E 'extern [^()]*;' 2>&1 | tee extern.log

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



This archive was generated by hypermail 2b29 : Mon Jan 07 2002 - 21:00:23 EST