[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



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)




 


Rackspace

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