From owner-cvs-all Thu Oct 8 22:07:52 1998 Return-Path: Received: (from daemon@localhost) by hub.freebsd.org (8.8.8/8.8.8) id WAA22239 for cvs-all-outgoing; Thu, 8 Oct 1998 22:07:52 -0700 (PDT) (envelope-from owner-cvs-all) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.15.68.22]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id WAA22215 for ; Thu, 8 Oct 1998 22:07:48 -0700 (PDT) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id PAA19770; Fri, 9 Oct 1998 15:07:39 +1000 Date: Fri, 9 Oct 1998 15:07:39 +1000 From: Bruce Evans Message-Id: <199810090507.PAA19770@godzilla.zeta.org.au> To: jkh@time.cdrom.com, wollman@khavrinen.lcs.mit.edu Subject: Re: cvs commit: src/libexec/getty main.c Cc: committers@FreeBSD.ORG Sender: owner-cvs-all@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> 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 , 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