[PATCH] kbuild: compile-test global headers to ensure they are self-contained
yamada.masahiro at socionext.com
Sat Jun 22 05:30:24 PDT 2019
On Sat, Jun 22, 2019 at 2:51 AM Sam Ravnborg <sam at ravnborg.org> wrote:
> Hi Masahiro.
> On Sat, Jun 22, 2019 at 01:39:31AM +0900, Masahiro Yamada wrote:
> > Make as many headers self-contained as possible so that they can be
> > included without relying on a specific include order.
> It is very nice finally to get some infrastructure to validate header
> But to avoid too many conflicts while including more and more headers
> that are selfcontained we really need something that is more
> So for example all header files in include/drm/* could be in one
> Makefile, incl. sub-directories, but the same Makefile would not include
> the files in include/soc/
> If you just show how ot do it, others can follow-up with the
> relevant directories.
At first, I tried to split Makefile per directory,
and add header-test-y one by one.
I think you expect they look like this:
subdir-y += drm
subdir-y += linux
subdir-y += media
header-test-y += drm_cache.h
header-test-y += drm_file.h
header-test-y += drm_util.h
header-test-y += io.h
header-test-y += list.h
header-test-y += kernel.h
header-test-y += types.h
This is a straightforward way,
but I see some disadvantages.
Currently, there are more than 4000 headers
So, to cover (almost) all of them, we must
list out 4000 entries.
When somebody adds a new header,
he will be very likely to forget to add
header-test-y for it.
So, newly added headers will always
fall off the coverage.
So, I am trying to take an opposite approach.
Add all headers in include/ by wildcard, then
filter-out one that cannot be self-contained.
In my analysis, 70% of headers are already conf-contained.
After some fixups, 95% of headers can become self-contained.
At this moment, the wildcard only covers some directories
or patterns, but my plan is to extend the wildcard gradually.
Please feel free to suggest alternative ideas.
More information about the Linux-mediatek