Re: [PATCH] headerdep: a tool for detecting inclusion cycles in header file

From: Matthew Wilcox
Date: Sat Apr 26 2008 - 12:17:42 EST


On Sat, Apr 26, 2008 at 03:45:54PM +0200, Vegard Nossum wrote:
> Maybe something like this could be useful for cleaning up headers (and
> maintaining that cleanliness once it has been achieved). What do you think?
>
> Subject: [PATCH] headerdep: a tool for detecting inclusion cycles in header files

Do we actually have inclusion cycles in header files? I remember gcc
warning about them when we were working on the parisc port (because we
needed includes that differed from x86). Has the new build system got
rid of these warnings?

I think a more useful tool would be one which mapped something like
'use of down()' to 'needs to include <linux/semaphore.h>'. It needs
to be at least somewhat done by hand because there are rules such
as 'include linux/spinlock.h to get spinlock_t' (which is actually
defined in linux/spinlock_types.h), but you want people to include
<linux/completion.h> directly rather than rely on it being pulled in
through linux/sched.h, for example.

It's further complicated by multi-file drivers, such as qla2xxx. Each
file includes qla_def.h which includes a lot of the necessary header
files for them ... but then each file will include a few more header
files that it needs.

So some implicit includes are _good_ and other implicit includes are
_bad_ (as they hurt when trying to rationalise the header files).
Anyone who likes complexity and fuzzy logic like this want to take a
stab at writing such a tool?

--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/