On 14/12/23 13:36, Jan Beulich wrote:
On 14.12.2023 13:07, Simone Ballarin wrote:
From: Maria Celeste Cesario <maria.celeste.cesa...@bugseng.com>

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)


Reply via email to