[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3] misra: deviate MISRA C Rule 10.1 for boolean operands of arithmetic
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
- Date: Wed, 18 Nov 2026 10:57:33 +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=6ySiYqjCFjN2XiVPiNpAsAed6vySI7lf7A6MJPRbnKo=; b=i53eEXJ4PR1Yhkjwj3aR0KywHrSCxVeUy3SrsgZh6DCmvlz0bdDOZCWdBhj/TM+0xMZhLAn2oyb1q3rX0Xmsj6BHQom4/V3zOPFv0rhfeJztm57cft2qZZEFsyUk7jpw7nCBwVRdPu5jy2w1JjlZITxA5CbK/EJParT8PezHDiogTgNaz05dKq776B0aXcuIdWs1KI61VErrL7X5tIbk9k0TCBhaUob3aNmzbfHn0X8hIrrohT2yEW6RtYvlvHJ4amFG3ihVV0rUjCJWG1y8FO6c25r3+baj52EGSmhn2Tk39AB5sWBekkzBvTzPg1UXIE2J/m7O+sbKbRYtSaN2fQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RXXeGfCyZtpeJ1YBPkLKGcU/KeaovFt3OnWUNf+Lh+AIp4W2T5K6wgHbjBVZrnloIFS8yprR0VsXFb5611M17wbKt77fVO+kpEkmF5bSQKDjFueVKysUBa+X/ze/tHrm9K1NVLW96JzUD3ODO+krP3mh5YtstFbmEBW8yZ4w0zj6qfI5Ysn8L40NcCtmBIMdGp0hVvO1iylHMNcLdfVUbF1Zs6hqYLmk27wraGjPU/Kl9/fUL6OnhHGroA8I1CMdXA6nfAH9YsLkjIt6Cz/DSXEO3L9G71BjiLts54vP/m7vTcL9gMV6zHmVQaXNHT9S1w26YABfYywd79nw3Rh1Ig==
- 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: Wed, 18 Nov 2026 08:57:45 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 11/18/26 10:49, Jan Beulich wrote:
On 17.11.2026 20:35, Dmytro Prokopchuk1 wrote:
MISRA C Rule 10.1 states: "Operands shall not be of an inappropriate
essential type".
The result of relational, equality and logical negation operators has
type int and value 0 or 1 (C99 6.5.8p6, 6.5.9p3, 6.5.3.3p5). An object
or function result of type bool has value 0 or 1 too, and it is
promoted to int (C99 6.3.1.2, 6.3.1.1p2). Using that value as an
Like in deviations.rst, s/that value/such a value/ ?
operand of unary +, -, binary +, -, *, <<, >> and of +=, -=, *=,
<<=, >>= is well-defined. Division, remainder, the relational
operators, increment and decrement stay covered by the rule.
Update the ECLAIR configuration to tag the accepted uses as safe.
Update deviations.rst and rules.rst accordingly.
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
Preferably with the adjustment (happy to carry out while committing):
Of course, I agree :)
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Jan
BR, Dmytro.
|