[PATCH v2 0/4] kbuild: resurrect generic header check facility
Linus Torvalds
torvalds at linux-foundation.org
Tue Apr 8 19:48:13 UTC 2025
On Tue, 8 Apr 2025 at 01:28, Jani Nikula <jani.nikula at intel.com> wrote:
>
> Your goal may be to make everything self-contained, but AFAICS there is
> no agreement on that goal.
Yeah, absolutely not.
I'm not interested in making some general rule that all headers should
be self-contained.
We already have some fairly obvious and clear exceptions to that, in
how some headers are special and get included early on and headers are
*not* supposed to include them themselves (ie things like
compiler-version.h and kconfig.h)
And while those are *really* special and end up being done
automatically by our compiler flags, they are by no means the only
special cases.
Quite a *lot* of our headers have things like
# error "Please do not include this file directly."
because those headers are literally *designed* to not be
self-sufficient. And that is absolutely not a mistake. These are
headers that are meant to be included in very specific situations by
specific other header files.
So no. The whole "everything is going to be self-contained" is simply
not going to happen. It's not even worth discussing. It's a
no-starter, and limits our header file design much too much.
Honestly, I think the whole "headers have to be self-contained in
general" thing is a mistake. But I think it's fine for people to mark
their "generic" headers for some kind of checking.
I think it's a bad bad idea to make it a rule, though.
Linus
More information about the Intel-xe
mailing list