[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOQ4uxgjgQbYy+cHKYM5ZqJm7hKT6oGTty6fvh1_zEX3krptJQ@mail.gmail.com>
Date: Fri, 26 Jan 2024 16:46:08 +0200
From: Amir Goldstein <amir73il@...il.com>
To: Vinicius Costa Gomes <vinicius.gomes@...el.com>
Cc: brauner@...nel.org, hu1.chen@...el.com, miklos@...redi.hu,
malini.bhandaru@...el.com, tim.c.chen@...el.com, mikko.ylinen@...el.com,
lizhen.you@...el.com, linux-unionfs@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC v2 1/4] cleanup: Fix discarded const warning when defining guards
On Fri, Jan 26, 2024 at 1:57 AM Vinicius Costa Gomes
<vinicius.gomes@...el.com> wrote:
>
> When defining guards for const types the void* return implicitly
> discards the const modifier. Be explicit about it.
>
> Compiler warning (gcc 13.2.1):
>
> ./include/linux/cleanup.h:154:18: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
> 154 | { return *_T; }
> | ^~~
> ./include/linux/cred.h:193:1: note: in expansion of macro ‘DEFINE_GUARD’
> 193 | DEFINE_GUARD(cred, const struct cred *, _T = override_creds_light(_T),
> | ^~~~~~~~~~~~
>
I did not look closely, but can't you use DEFINE_LOCK_GUARD_1()?
Thanks,
Amir.
Powered by blists - more mailing lists