From: Dan Carpenter Date: Wed, 09 Oct 2019 14:30:01 +0000 Subject: Re: [PATCH] string.h: Mark 34 functions with __must_check Message-Id: <20191009143000.GD13286@kadam> List-Id: References: <75f70e5e-9ece-d6d1-a2c5-2f3ad79b9ccb@web.de> <954c5d70-742f-7b0e-57ad-ea967e93be89@rasmusvillemoes.dk> <20191009135522.GA20194@kadam> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Rasmus Villemoes Cc: Markus Elfring , kernel-janitors@vger.kernel.org, Alexander Shishkin , Andrew Morton , Andy Shevchenko , Joe Perches , Kees Cook , Nick Desaulniers , Steven Rostedt , LKML 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 thing in the kernel. gcc itself knows this about __builtin_strlen() > etc. If anything, we could annotate some of our non-standard functions > (say, memchr_inv) with __pure - then we'd both get the Wunused-value in > the nonsense cases, and allow gcc to optimize or reorder the calls. Huh. You're right. GCC already knows. So this patch is pointless like you say. regards, dan carpenter