On 31/07/2025 4:58 pm, Dmytro Prokopchuk1 wrote:
> From: Nicola Vetrini <nicola.vetr...@bugseng.com>
>
> MISRA C Rule 2.1 states: "A project shall not contain unreachable code".
> Functions that are non-returning and are not explicitly annotated with
> the `noreturn' attribute are considered a violation of this rule.
>
> In certain cases, some functions might be non-returning in specific build
> configurations (when assertions are enabled, i.e., when `NDEBUG' is not
> defined). This is due to calls to `__builtin_unreachable()' in the
> expansion of the macro `ASSERT_UNREACHABLE()'.
>
> Conversely, in builds where `NDEBUG' is defined (assertions are disabled),
> the macro `ASSERT_UNREACHABLE()' expands to an empty construct
> (`do { } while (0)'), which does not affect the execution flow. This allows
> such functions to return normally in such builds, avoiding unreachable code.
>
> To account for that in specific builds, the `noreturn` property of
> `__builtin_unreachable()` is overridden in the ECLAIR configuration to
> deviate these violations.
>
> Signed-off-by: Nicola Vetrini <nicola.vetr...@bugseng.com>
> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopch...@epam.com>

Thanks.  I think that wording is much better.

Acked-by: Andrew Cooper <andrew.coop...@citrix.com>

Reply via email to