Re: [PATCH] lib/string: shrink lib/string.i via IWYU
From: Al Viro
Date: Tue Dec 05 2023 - 16:57:38 EST
On Tue, Dec 05, 2023 at 09:38:07PM +0000, Al Viro wrote:
> It also breeds includes of asm/*.h, by the look of the output, which is
> not a good thing in general ;-/ E.g. #include <asm/uaccess.h> *anywhere*
> outside of linux/uaccess.h is a bad idea.
Let me elaborate a bit:
Consider e.g. a situation when we have linux/foo.h pulling asm/foo.h;
among the things declared there is foo_bar(), which is identical in
18 instances of asm/foo.h (out of current 21).
At some point we notice that; the obvious approach would be to have
3 unusual architectures have their asm/foo.h define _ARCH_HAS_ODD_FOO_BAR
and put the common variant in linux/foo.h under ifndef _ARCH_HAS_ODD_FOO_BAR.
Except that any file that pulls asm/foo.h will get broken by that.
And something like your tool might convert the users of linux/foo.h to
asm/foo.h - all it takes is using only the primitives that currently
happen to be in asm/foo.h on all architectures.
This is not an artifical example, BTW - look at the history of uaccess.h and
checksum.h...