Re: [PATCH] string.h: Mark 34 functions with __must_check

From: Joe Perches
Date: Wed Oct 09 2019 - 12:38:40 EST


On Wed, 2019-10-09 at 09:13 -0700, Nick Desaulniers wrote:
> On Wed, Oct 9, 2019 at 8:09 AM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> > On Wed, 9 Oct 2019 14:14:28 +0200 Markus Elfring <Markus.Elfring@xxxxxx> wrote:
[]
> > > Several functions return values with which useful data processing
> > > should be performed. These values must not be ignored then.
> > > Thus use the annotation â__must_checkâ in the shown function declarations.
[]
> > I'm curious. How many warnings showed up when you applied this patch?
>
> I got zero for x86_64 and arm64 defconfig builds of linux-next with
> this applied. Hopefully that's not an argument against the more
> liberal application of it? I view __must_check as a good thing, and
> encourage its application, unless someone can show that a certain
> function would be useful to call without it.

stylistic trivia, neither agreeing nor disagreeing with the patch
as I generally avoid reading Markus' patches.

I believe __must_check is best placed before the return type as
that makes grep for function return type easier to parse.

i.e. prefer
[static inline] __must_check <type> <function>(<args...>);
over
[static inline] <type> __must_check <function>(<args...>);