Re: string.h: Mark 34 functions with __must_check

2019-10-10 Thread Markus Elfring
> +our $PositionalAttribute = qr{ > + __must_check| > + __printf| I suggest to put all key words which share the leading underscores into another alternation for an improved regular expression. Regards, Markus

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

2019-10-10 Thread David Laight
From: David Sterba > Sent: 10 October 2019 15:28 ... > > Can we pick a style and enforce it via checkpatch? (It's probably not > > fun to check for each function attribute in > > include/linux/compiler_attributes.h). > > Anything that has the return type, attributes and function name on one > line

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

2019-10-10 Thread Joe Perches
On Thu, 2019-10-10 at 16:27 +0200, David Sterba wrote: > On Wed, Oct 09, 2019 at 10:33:45AM -0700, Nick Desaulniers wrote: > > On Wed, Oct 9, 2019 at 9:38 AM Joe Perches wrote: > > > I believe __must_check is best placed before the return type as > > > that makes grep for function return type easi

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

2019-10-10 Thread David Sterba
On Wed, Oct 09, 2019 at 10:33:45AM -0700, Nick Desaulniers wrote: > On Wed, Oct 9, 2019 at 9:38 AM Joe Perches wrote: > > > > On Wed, 2019-10-09 at 09:13 -0700, Nick Desaulniers wrote: > > > On Wed, Oct 9, 2019 at 8:09 AM Steven Rostedt wrote: > > > > On Wed, 9 Oct 2019 14:14:28 +0200 Markus Elfr

Re: string.h: Mark 34 functions with __must_check

2019-10-10 Thread Markus Elfring
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/test_kasan.c?id=b92a953cb7f727c42a15ac2ea59bf3cf9c39370d#n595 > > The *test* word must have given you a clue that the code you a looking > at is not an ordinary one. The proposed extension of function annotations can be

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

2019-10-10 Thread Rasmus Villemoes
On 09/10/2019 18.31, Nick Desaulniers wrote: > On Wed, Oct 9, 2019 at 7:30 AM Dan Carpenter wrote: >> >> On Wed, Oct 09, 2019 at 04:21:20PM +0200, Rasmus Villemoes wrote: >>> On 09/10/2019 15.56, Dan Carpenter wrote: That's because glibc strlen is annotated with __attribute_pure__ which

Re: string.h: Mark 34 functions with __must_check

2019-10-09 Thread Andy Shevchenko
On Wed, Oct 9, 2019 at 11:11 PM Markus Elfring wrote: > > > I'm curious. How many warnings showed up when you applied this patch? > > I suggest to take another look at six places in a specific source file > (for example). > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/li

Re: string.h: Mark 34 functions with __must_check

2019-10-09 Thread Markus Elfring
> I'm curious. How many warnings showed up when you applied this patch? I suggest to take another look at six places in a specific source file (for example). https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/test_kasan.c?id=b92a953cb7f727c42a15ac2ea59bf3cf9c39370d#n595 ht

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

2019-10-09 Thread Dan Carpenter
On Wed, Oct 09, 2019 at 09:31:41AM -0700, Nick Desaulniers wrote: > On Wed, Oct 9, 2019 at 7:30 AM Dan Carpenter wrote: > > > > On Wed, Oct 09, 2019 at 04:21:20PM +0200, Rasmus Villemoes wrote: > > > On 09/10/2019 15.56, Dan Carpenter wrote: > > > > That's because glibc strlen is annotated with __

Re: string.h: Mark 34 functions with __must_check

2019-10-09 Thread Nick Desaulniers
On Wed, Oct 9, 2019 at 10:04 AM Markus Elfring wrote: > > > Ah, granted, I was surprised, too. > > Thanks for this view. I mean, it's a good thing that we don't have any issues that this patch would catch today. Seems Steven and I were surprised (pessimistic?). > > > > Maybe would be helpful to

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

2019-10-09 Thread Nick Desaulniers
On Wed, Oct 9, 2019 at 9:38 AM Joe Perches wrote: > > On Wed, 2019-10-09 at 09:13 -0700, Nick Desaulniers wrote: > > On Wed, Oct 9, 2019 at 8:09 AM Steven Rostedt wrote: > > > On Wed, 9 Oct 2019 14:14:28 +0200 Markus Elfring > > > wrote: > [] > > > > Several functions return values with which u

Re: string.h: Mark 34 functions with __must_check

2019-10-09 Thread Markus Elfring
> Ah, granted, I was surprised, too. Thanks for this view. > Maybe would be helpful to mention that in the commit message. My Linux software build resources might be too limited to take more system configuration variations safely into account for this issue. Would you like to achieve further ch

Re: string.h: Mark 34 functions with __must_check

2019-10-09 Thread Markus Elfring
> You're also not consistent - strlen() is not annotated. Would you like to integrate any additional function annotations? > And, for the standard C functions, -Wall already seems to warn about > an unused call: This detail is nice, isn't it? > a.c:5:2: warning: statement with no effect [-Wun

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

2019-10-09 Thread Nick Desaulniers
On Wed, Oct 9, 2019 at 9:27 AM Steven Rostedt wrote: > > On Wed, 9 Oct 2019 09:13:17 -0700 > Nick Desaulniers wrote: > > > On Wed, Oct 9, 2019 at 8:09 AM Steven Rostedt wrote: > > > > > > I'm curious. How many warnings showed up when you applied this patch? > > > > I got zero for x86_64 and arm6

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

2019-10-09 Thread Joe Perches
On Wed, 2019-10-09 at 09:13 -0700, Nick Desaulniers wrote: > On Wed, Oct 9, 2019 at 8:09 AM Steven Rostedt wrote: > > On Wed, 9 Oct 2019 14:14:28 +0200 Markus Elfring > > wrote: [] > > > Several functions return values with which useful data processing > > > should be performed. These values mus

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

2019-10-09 Thread Nick Desaulniers
On Wed, Oct 9, 2019 at 6:26 AM Rasmus Villemoes wrote: > > On 09/10/2019 14.14, Markus Elfring wrote: > > From: Markus Elfring > > Date: Wed, 9 Oct 2019 13:53:59 +0200 > > > > Several functions return values with which useful data processing > > should be performed. These values must not be ignor

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

2019-10-09 Thread Nick Desaulniers
On Wed, Oct 9, 2019 at 7:30 AM Dan Carpenter wrote: > > On Wed, Oct 09, 2019 at 04:21:20PM +0200, Rasmus Villemoes wrote: > > On 09/10/2019 15.56, Dan Carpenter wrote: > > > That's because glibc strlen is annotated with __attribute_pure__ which > > > means it has no side effects. > > > > I know, e

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

2019-10-09 Thread Steven Rostedt
On Wed, 9 Oct 2019 09:13:17 -0700 Nick Desaulniers wrote: > On Wed, Oct 9, 2019 at 8:09 AM Steven Rostedt wrote: > > > > On Wed, 9 Oct 2019 14:14:28 +0200 > > Markus Elfring wrote: > > > > > From: Markus Elfring > > > Date: Wed, 9 Oct 2019 13:53:59 +0200 > > > > > > Several functions return

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

2019-10-09 Thread Nick Desaulniers
On Wed, Oct 9, 2019 at 8:09 AM Steven Rostedt wrote: > > On Wed, 9 Oct 2019 14:14:28 +0200 > Markus Elfring wrote: > > > From: Markus Elfring > > Date: Wed, 9 Oct 2019 13:53:59 +0200 > > > > Several functions return values with which useful data processing > > should be performed. These values m

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

2019-10-09 Thread Steven Rostedt
On Wed, 9 Oct 2019 14:14:28 +0200 Markus Elfring wrote: > From: Markus Elfring > Date: Wed, 9 Oct 2019 13:53:59 +0200 > > 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 t

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

2019-10-09 Thread Dan Carpenter
On Wed, Oct 09, 2019 at 04:21:20PM +0200, Rasmus Villemoes wrote: > On 09/10/2019 15.56, Dan Carpenter wrote: > > That's because glibc strlen is annotated with __attribute_pure__ which > > means it has no side effects. > > I know, except it has nothing to do with glibc headers. Just try the > same

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

2019-10-09 Thread Rasmus Villemoes
On 09/10/2019 15.56, Dan Carpenter wrote: > [ I haven't reviewed the original patch ] > > On Wed, Oct 09, 2019 at 03:26:18PM +0200, Rasmus Villemoes wrote: >> On 09/10/2019 14.14, Markus Elfring wrote: >>> From: Markus Elfring >>> Date: Wed, 9 Oct 2019 13:53:59 +0200 >>> >>> Several functions ret

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

2019-10-09 Thread Dan Carpenter
[ I haven't reviewed the original patch ] On Wed, Oct 09, 2019 at 03:26:18PM +0200, Rasmus Villemoes wrote: > On 09/10/2019 14.14, Markus Elfring wrote: > > From: Markus Elfring > > Date: Wed, 9 Oct 2019 13:53:59 +0200 > > > > Several functions return values with which useful data processing > >

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

2019-10-09 Thread Rasmus Villemoes
On 09/10/2019 14.14, Markus Elfring wrote: > From: Markus Elfring > Date: Wed, 9 Oct 2019 13:53:59 +0200 > > 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 functi

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

2019-10-09 Thread Markus Elfring
From: Markus Elfring Date: Wed, 9 Oct 2019 13:53:59 +0200 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. Add also corresponding parameter name