From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: xen-devel@lists.xenproject.org,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Julien Grall" <julien@xen.org>,
"Bertrand Marquis" <bertrand.marquis@arm.com>,
"Michal Orzel" <michal.orzel@amd.com>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Dmytro Prokopchuk1" <dmytro_prokopchuk1@epam.com>
Subject: Re: [PATCH] misra: add ASSERT_UNREACHABLE() in default clauses
Date: Tue, 12 Aug 2025 11:55:29 +0200 [thread overview]
Message-ID: <8ce96224f88513e4041d33248456fab3@bugseng.com> (raw)
In-Reply-To: <c7f118a9-aea8-4f3a-8072-1bfa128d56b8@suse.com>
On 2025-08-12 09:25, Jan Beulich wrote:
> On 11.08.2025 23:25, Nicola Vetrini wrote:
>> On 2025-08-11 22:30, Dmytro Prokopchuk1 wrote:
>>> --- a/xen/arch/arm/decode.c
>>> +++ b/xen/arch/arm/decode.c
>>> @@ -178,6 +178,9 @@ static int decode_thumb(register_t pc, struct
>>> hsr_dabt *dabt)
>>> case 3: /* Signed byte */
>>> update_dabt(dabt, reg, 0, true);
>>> break;
>>> + default:
>>> + ASSERT_UNREACHABLE();
>>> + break;
>>> }
>>>
>>
>> I think this is fine, and there should be no problems with the break
>> being unreachable in some configs due to the call property for
>> ASSERT_UNREACHABLE
>>
>> -doc_begin="Calls to function `__builtin_unreachable()' in the
>> expansion
>> of macro
>> `ASSERT_UNREACHABLE()' are not considered to have the `noreturn'
>> property."
>> -call_properties+={"name(__builtin_unreachable)&&stmt(begin(any_exp(macro(name(ASSERT_UNREACHABLE)))))",
>> {"noreturn(false)"}}
>> -doc_end
>
> Did you also see Julien's reply? Imo, to address a complaint from one
> rule, another rule is then being violated: The "default" label itself
> is unreachable here.
>
> Jan
Unfortunately only after sending my reply, however the point here is
that ASSERT_UNREACHABLE() is now considered as if it was not actually a
source of unreachability for any statement below (which is the case only
in configurations where NDEBUG is undefined iirc). This was done mainly
to allow stubs for Rule 2.1 so that their return statement just after an
ASSERT_UNREACHABLE() is not seen as a problem, but given that the
configuration to obtain that is global it influences treatment for other
rules as well, and its addition is relatively recent compared to the
text written in rules.rst.
--
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253
next prev parent reply other threads:[~2025-08-12 9:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 20:30 [PATCH] misra: add ASSERT_UNREACHABLE() in default clauses Dmytro Prokopchuk1
2025-08-11 21:21 ` Julien Grall
2025-08-12 7:32 ` Jan Beulich
2025-08-12 22:54 ` Julien Grall
2025-08-13 9:44 ` Dmytro Prokopchuk1
2025-08-14 6:34 ` Jan Beulich
2025-08-12 8:20 ` Dmytro Prokopchuk1
2025-08-11 21:25 ` Nicola Vetrini
2025-08-12 7:25 ` Jan Beulich
2025-08-12 9:55 ` Nicola Vetrini [this message]
2025-08-12 10:18 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ce96224f88513e4041d33248456fab3@bugseng.com \
--to=nicola.vetrini@bugseng.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=bertrand.marquis@arm.com \
--cc=dmytro_prokopchuk1@epam.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.