Re: [RFC] clang: 'unused-function' warning on static inline functions

Linus Torvalds
2017-06-06T21:28:07Z

On Tue, Jun 6, 2017 at 2:23 PM, Matthias Kaehlcke <mka@chromium.org> wrote:
>
> I tend to disagree, the warning is useful to detect truly unused
> static inline functions, which should be removed, rather than be
> carried around/maintained for often long periods of time.

That may be true in other projects, but we really do have a lot of
code that is conditionally used. The warning is just not useful.

I agree that we could use "__maybe_unused", but at the same time, I
don't really see the point. There's no way in hell we'd ever do that
for inlines that are in header files (*of course* they may be unused),
why would we then haev a magical rule like "let's do it for inlines in
C files".

I applied the patch from David Rientjes to just make "inline"
automatically mean "maybe unused" for clang.

Linus