Date: Fri, 9 Oct 1998 15:07:39 +1000 From: Bruce Evans <bde@zeta.org.au> To: jkh@time.cdrom.com, wollman@khavrinen.lcs.mit.edu Cc: committers@FreeBSD.ORG Subject: Re: cvs commit: src/libexec/getty main.c Message-ID: <199810090507.PAA19770@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>> System headers go first. Header files should never include other >> header files, except for certain system headers and as necessary to >> meet formal Standards. > >Hmmm. formal Standards. When you figure out what those are, >including the ones in the wake of our "cleanup" which have caused >certain interfaces to no longer behave as described in their own man >pages (in terms of what must be included as a prerequisite), kindly >let me know. :-) Which interaces are those? Only a few of have been broken since I last checked (on Aug 4). They are libutil.h (surprise), kvm.h (ssize_t), err.h (FILE * vs void *), resolv.h (redefining foo as __foo leaves no prototype for foo), dialog.h (dialog_ftree() doesn't match reality), and many kernel-only interfaces (the bugs are mostly in new man pages that never matched realilty). >> declaration of functions in heaer files. This whole debacle >> illustrates properties_read(), and non-Standard library functions >> generally, should not take `FILE *' arguments. It should be an fd, or > >A nice goal, but much less easy in practice. Fairly easy for incremental changes. Bruce #!/bin/sh # Check prototypes in man pages against reality. # XXX scribbles in /tmp. cd /usr/share/man for i in `find . -name '*.gz' -links +0 | xargs zegrep -l '(\.Fn|#include)'` do zcat $i | awk -v file=$i ' BEGIN { print ".Dd" print ".Sh SYNOPSIS" ft = "" if (index(file, ".9.gz") != 0) print ".Fd #define KERNEL 1" printf "" > "/tmp/zFnlist" } /^\.Fd/ { print $0 } /^\.Ft/ { ft = $0 } /^(\.Fn.*"|\.Fn.* void)/ { print $2 > "/tmp/zFnlist" print ".Fd #undef " $2 print ft ft = "" print $0 # Print semicolon on a separate line to avoid too many args. print ";" } /^\.Fo/ { print $2 > "/tmp/zFnlist" print ".Fd #undef " $2 print ft ft = "" print $0 while (getline >= 0 && index($0, ".Fc") != 1) print $0 print ".Fc" # Print semicolon on a separate line to avoid too many args. print ";" } # /^[ \t]*#include/ { print ".Fd " $1 " " $2 } END { print "int pedantic_pacificer;" } ' | nroff -mandoc | sed -e 's/.//g' -e 's/^[ ]*//' -e '/^$/d' -e '/^SYNOPSIS$/d' | tr '\012' '@' | sed -e 's/@@//g' | tr '@' '\012' > /tmp/z.c # Here -I /sys is for <scsi/something.h>, and -I /usr/include is # before that to avoid a bugfeature in gcc: warnings for `long long' # are apparently suppressed if long long is used in headers in # standard places, but not if it is used elsewhere. if cc -ansi -pedantic -Werror -I /tmp -I /usr/include -I /sys -S \ -o /dev/null /tmp/z.c >/dev/null 2>&1 then expect=`sort < /tmp/zFnlist` sedcmd="s/.*\`\(.*\)'.*/\1/" got=`cc -Wredundant-decls -I /tmp -I /usr/include -I /sys -S \ -o /dev/null /tmp/z.c 2>&1 | grep redundant | sed $sedcmd | sort` if test "$expect" != "$got" then echo expect \"$expect\", got \"$got\" echo $i bad mv /tmp/z.c /tmp/`basename $i .gz`.c fi else echo $i bad mv /tmp/z.c /tmp/`basename $i .gz`.c fi done
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810090507.PAA19770>