Re: RFC: cleaning up the in-kernel headers

David Woodhouse
2006-07-11T16:28:59Z

On Tue, 2006-07-11 at 18:06 +0200, Adrian Bunk wrote:
> I'd like to cleanup the mess of the in-kernel headers, based on the
> following rules:
> - every header should #include everything it uses
> - remove unneeded #include's from headers
>
> This would also remove all the implicit rules "before #include'ing
> header foo.h, you must #include header bar.h" you usually only see
> when the compilation fails.
>
> There might be exceptions (e.g. for avoiding circular #include's) but
> these would be special cases.

Seems eminently sensible. Please make sure you don't introduce
regressions in the output of 'make headers_install' by unconditionally
including files which don't exist in the export -- if something is only
_used_ within #ifdef __KERNEL__ then it should only be #included within
#ifdef __KERNEL__ too.

It would be nice in the general case if we could actually _compile_ each
header file, standalone. There may be some cases where that doesn't
work, but it's a useful goal in most cases, for bother exported headers
_and_ the in-kernel version. For the former case it would be nice to add
it to 'make headers_check' once it's realistic to do so.

I still think it would be quite nice if we could _eliminate_ some of
those ifdefs, to be honest -- but I'm not overly bothered about that
now, because 'make headers_install' works well enough.

--
dwmw2