[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] misra: deviate MISRA C Rule 10.1 for boolean operands of arithmetic


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Mon, 16 Nov 2026 11:48:46 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZNZS6FWJGmZRxk0ZYj26mTT1o9Ic2fDvknSe3swgw6c=; b=HofIH6LsDmmeFK/pHmBmks4vkAeVKwJoMvG+IovvJCJ6WA6m88MY2vvJ9s6SqvdryGrMV551GM0yH/uTcQK/zbMaEE1rfEv9FWACQDnfweRl94C2y2xrpNN6h49+m/W4aZ4gtdmcgGk23w+gBJ4bimTHsmK3k1LWUN0d+VV0CP+OVgqUxj4nR2QOULSY0jq0q4zMWpwXMj6oNNmoPr+aFTG3oLgbdA/Qbu3RscCwNCthTULAah7Rx8utt29k2pMHEYCU4WSue3OBWn6qnSnWnQ87s4qvWW0otYGTdAa7S03ondLoALcmSjTQj5HxTvMazwb6S9NvmTfvE68blr9EFA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pdHMpRBFL5YBPC9NodN1f5v2qZo1XZFb0hC44+W6LlHYNVF9CFYxke8cfg4fXxdShR35c1buwtAEFkDOP1FZtKDICreoaTLiTZUrdKm8i5PJ4hiPzdDcPbrb5N5J8P7EZkwyKRToJ46Q/i3Z9HZh9JGjRvkpbhaLk/PcqMrrb5Cjgh75SWGgKrrqgJ0fx6AbT1IScQVruFrYVkN+aRJcsL8sYprIvx5qwlH53t/Q+uLD2E5/r3D6tbXEJIGhfKF9X4JqmVPtuV4dfjAHSFeNbTpCrCqHvMpW7fjyxryV/h2VmiS4QKM/yAwypC0jHSj9nGMeMjwvefJPdcDby3YDlQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 16 Nov 2026 09:48:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>



On 11/16/26 10:39, Jan Beulich wrote:
On 16.11.2026 09:25, Dmytro Prokopchuk wrote:
On 11/10/26 11:58, Jan Beulich wrote:
On 10.11.2026 10:25, Dmytro Prokopchuk1 wrote:
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -335,6 +335,10 @@ still non-negative."
   -config=MC3A2.R10.1,etypes+={safe, 
"stmt(operator(logical)||node(conditional_operator||binary_conditional_operator))", 
"dst_type(ebool||boolean)"}
   -doc_end
+-doc_begin="A 0-or-1 Boolean operand of binary +, -, *, <<, >>, <, >, <=, >= and of +=, -=, *=, <<=, >>= is safe. See docs/misra/deviations.rst for the full explanation."
+-config=MC3A2.R10.1,etypes+={safe, 
"stmt(operator(add||sub||add_assign||sub_assign||mul||mul_assign||shl||shr||shl_assign||shr_assign||lt||gt||le||ge))",
 "src_type(ebool||boolean)"}

Imo this wants shortening by making use of regex-es (provided such can be
used here).

Unfortunately no. Unlike file() or macro(), which take ^REGEX$
matchers, operator() in ECLAIR only accepts operator identifiers or
predefined operator collections.

I see. Then, to help readability, would something like

-config=MC3A2.R10.1,etypes+={safe, "stmt(operator(add||add_assign))", 
"src_type(ebool||boolean)"}
-config=MC3A2.R10.1,etypes+={safe, "stmt(operator(sub||sub_assign))", 
"src_type(ebool||boolean)"}
-config=MC3A2.R10.1,etypes+={safe, "stmt(operator(mul||mul_assign))", 
"src_type(ebool||boolean)"}
-config=MC3A2.R10.1,etypes+={safe, "stmt(operator(shl||shl_assign))", 
"src_type(ebool||boolean)"}
-config=MC3A2.R10.1,etypes+={safe, "stmt(operator(shr||shr_assign))", 
"src_type(ebool||boolean)"}

work?

Yes, this is equivalent to the single long list. It will work.


Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.