Re: [PATCH v4] cleanup: adjust scoped_guard() macros to avoid potential warning

From: Dmitry Torokhov
Date: Fri Oct 18 2024 - 15:16:06 EST


Hi Przemek,

On Fri, Oct18, 2024 at 01:38:14PM +0200, Przemek Kitszel wrote:
> Change scoped_guard() and scoped_cond_guard() macros to make reasoning
> about them easier for static analysis tools (smatch, compiler
> diagnostics), especially to enable them to tell if the given usage of
> scoped_guard() is with a conditional lock class (interruptible-locks,
> try-locks) or not (like simple mutex_lock()).

Thank you for making all these improvements!

>
> +#define __DEFINE_CLASS_IS_CONDITIONAL(_name, _is_cond) \
> +static __maybe_unused const bool class_##_name##_is_conditional = _is_cond

Question - does this have to be a constant or can it be a macro?

Thanks.

--
Dmitry