Re: [RFC][PATCH] tree-wide: Remove __inline__ and __inline usage

From: Peter Zijlstra
Date: Tue Nov 06 2018 - 14:42:02 EST


On Tue, Nov 06, 2018 at 11:18:59AM -0800, Linus Torvalds wrote:
> On Tue, Nov 6, 2018 at 2:02 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > Therefore I'm proposing to run:
> >
> > git grep -l "\<__inline\(\|__\)\>" | while read file
> > do
> > sed -i -e 's/\<__inline\(\|__\)\>/inline/g' $file
> > done
> >
> > On your current tree, and apply the below fixup patch on top of that
> > result.
>
> So I started doing this, and in fact fixed up a few more issues by
> hand on top of your patch, but then realized hat it's somewhat
> dangerous and possibly broken.
>
> For the uapi header files in particular, __inline__ may actually be
> required. Depending on use, and compiler settings, "inline" can be a
> word reserved for the user, and shouldn't be used by system headers.

*groan*, indeed. Now obvious those headers need to compile without our
override, so we could simply exclude uapi from the transformation.

(and __inline is mostly in staging/ and a few stray places, we really
should get rid of that one I feel, there's so few of them)

> But we *could* get rid of these two lines in include/linux/compiler_types.h
>
> #define __inline__ inline
> #define __inline inline
>
> and just say that "inline" for the kernel means "always_inline", but
> if you use __inline__ or __inline then you get the "raw" compiler
> inlining.
>
> Then people can decide to get rid of __inline__ on a case-by-case basis.

Right, that gets us what we need; but makes a fair bunch of kernel code
compile differently.

It probably doesn't matter, and a fair amount of the __inline__ usage is
in fairly crusty code which will likely never get fixed up.

And that is probably still a safer option than removing the #define
inline entirely.

Do you want me to do that patch, or have you already just done it?