Date: Wed, 30 Sep 2009 20:59:05 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Lawrence Stewart <lstewart@freebsd.org> Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r197638 - projects/tcp_ffcaia2008_8.x/sys/kern Message-ID: <20090930203736.D1368@besplex.bde.org> In-Reply-To: <200909300953.n8U9r3Oo011112@svn.freebsd.org> References: <200909300953.n8U9r3Oo011112@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 30 Sep 2009, Lawrence Stewart wrote: > Log: > Alphabetically order includes. > ... > Modified: projects/tcp_ffcaia2008_8.x/sys/kern/kern_alq.c > ============================================================================== > --- projects/tcp_ffcaia2008_8.x/sys/kern/kern_alq.c Wed Sep 30 08:48:59 2009 (r197637) > +++ projects/tcp_ffcaia2008_8.x/sys/kern/kern_alq.c Wed Sep 30 09:53:03 2009 (r197638) > @@ -36,7 +36,9 @@ __FBSDID("$FreeBSD$"); > #include "opt_mac.h" > > #include <sys/param.h> > -#include <sys/systm.h> > +#include <sys/alq.h> > +#include <sys/eventhandler.h> > +#include <sys/fcntl.h> > #include <sys/kernel.h> > #include <sys/kthread.h> > #include <sys/lock.h> > @@ -44,12 +46,9 @@ __FBSDID("$FreeBSD$"); > #include <sys/mutex.h> > #include <sys/namei.h> > #include <sys/proc.h> > -#include <sys/vnode.h> > -#include <sys/alq.h> > -#include <sys/malloc.h> > +#include <sys/systm.h> > ... <sys/systm.h> should not be sorted alphabeticaly, since it declares things like KASSERT() and (by nested includes) hundreds of inline functions (especially ones in <machine/atomic.h>, <machine/cpufunc.h> and <sys/libkern.h>) which are used in many other headers. It should be sorted immediately after <sys/param.h> where it was. Mis-sorting it is sometimes masked by namespace pollution in other headers. <sys/mbuf.h> has the grossest namespace pollution despite me once completely cleaning it up :-(. It now includes <sys/systm.h> and <vm/uma.h>. (<vm/uma.h> is even more disgusting. It starts by including <sys/param.h> and says that this is "/* for NULL */", despite there being a whole header <sys/_null.h> for the purpose of defining NULL and thus avoiding namespace which would be caused by defining NULL in a more central header, and despite it using _much_ more of <sys/param.h> than the definition of NULL.) But most headers aren't as bad. Thus sorting <sys/systm.h> alphabetically (near the end) rarely works, and even when it works it is fragile and will break when a header sorted before it starts using KASSERT(). Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090930203736.D1368>