[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 0/9] xen: address violations of MISRA C:2012 Rule 11.8
- To: Jan Beulich <jbeulich@xxxxxxxx>, Maria Celeste Cesario <maria.celeste.cesario@xxxxxxxxxxx>
- From: Simone Ballarin <simone.ballarin@xxxxxxxxxxx>
- Date: Mon, 18 Dec 2023 15:28:08 +0100
- Cc: consulting@xxxxxxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>
- Delivery-date: Mon, 18 Dec 2023 14:28:17 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 14/12/23 13:36, Jan Beulich wrote:
On 14.12.2023 13:07, Simone Ballarin wrote:
From: Maria Celeste Cesario <maria.celeste.cesario@xxxxxxxxxxx>
The xen sources contain violations of MISRA C:2012 Rule 11.8 whose
headline states:
"A conversion shall not remove any const, volatile or _Atomic
qualification from the type pointed to by a pointer".
This patch amends or removes casts that unnecessarily drop
const and volatile qualifiers.
Example:
static always_inline bool int_##name(volatile void *p)
{
volatile uint32_t *ptr = (uint32_t *)p; /* Non-compliant */
volatile uint32_t *ptr = (volatile uint32_t *)p; /* Compliant, proposed
change */
}
Why would you further complicate things when here the cast can simply
be dropped?
Jan
Of course, the example will be improved in v2.
--
Simone Ballarin, M.Sc.
Field Application Engineer, BUGSENG (https://bugseng.com)
|