svn commit: r231760 - head/sys/netgraph

Bruce Evans brde at optusnet.com.au
Wed Feb 15 15:19:41 UTC 2012


On Wed, 15 Feb 2012, Gleb Smirnoff wrote:

> Log:
>  style(9): sort includes.
> Modified: head/sys/netgraph/ng_base.c
> ==============================================================================
> --- head/sys/netgraph/ng_base.c	Wed Feb 15 14:23:01 2012	(r231759)
> +++ head/sys/netgraph/ng_base.c	Wed Feb 15 14:26:50 2012	(r231760)
> @@ -43,25 +43,25 @@
>  */
>
> #include <sys/param.h>
> -#include <sys/systm.h>

systm was already sorted.  Like param.h, it defines important macros that
may be needed by other headers.  For example, many headers use KASSERT().
KASSERT() happens to be a macro, so this happens to work if the other
headers only use it in other macros, but this would fail if any of the
other headers started using it in an inline functions.

> #include <sys/ctype.h>
> #include <sys/errno.h>

errno.h is standard pollution in param.h.  Including it directly is a
style bug.  This style bug was not very common.  It was in 7 files
in kern in 4.4BSD-Lite2, 1 in kern in FreeBSD-3 (after I fixed it in
FreeBSD-2), 4 in kern in FreeBSD-4, and 8 in kern in -current.  But
in the top level directory of netgraph, it is in all 49 of 49 .c files
in -current.

> #include <sys/kdb.h>
> #include <sys/kernel.h>
> +#include <sys/kthread.h>
> #include <sys/ktr.h>
> #include <sys/limits.h>
> #include <sys/lock.h>
> #include <sys/malloc.h>
> #include <sys/mbuf.h>
> +#include <sys/proc.h>
> #include <sys/queue.h>

queue.h is nonstandard pollution in many headers.  It has already been
included (guarded) many times before here.  Unfortunately, since it
is nonstandard, this can't be depended on, though many .c files do.

Bruce


More information about the svn-src-all mailing list