mbox series

[XEN,v2,0/7] address some violations of MISRA C Rule 20.7

Message ID cover.1709896401.git.nicola.vetrini@bugseng.com (mailing list archive)
Headers show
Series address some violations of MISRA C Rule 20.7 | expand

Message

Nicola Vetrini March 8, 2024, 11:20 a.m. UTC
Hi all,

this series aims to refactor some macros that cause violations of MISRA C Rule
20.7 ("Expressions resulting from the expansion of macro parameters shall be
enclosed in parentheses"). All the macros touched by these patches are in some
way involved in violations, and the strategy adopted to bring them into
compliance is to add parentheses around macro arguments where needed.

Given that the community has previously requested a deviation from the rule, as
stated in docs/misra/deviations.rst, and reported below for convenience [1],
some macro parameters do not need any adjusting (e.g., when used as lhs to
an assignment in statement expressions), but in some cases (most notably in
patch 3) such adjustments have been made for consistency.

This series fixes a significant portion of the violations on Arm
(from ~14000 to ~2500). On x86, though there is one patch touching it, there are
still many more; they will be part of a later series.

Changes in v2:
- Removed a hunk of patch 1 touching __config_enabled (will be deviated in a
  subsequent series).
- Split patch 1 into three patches, for easier reviewing.
- Made minor adjustments to "xen-arm-address-some...".
- Dropped GUARD(1) hunk from the x86 patch.
- Dropped patch 4, 5 and 10: they will be subject to a deviation in the future.
- Patch 7, 8, 9 have been committed already. 

Nicola Vetrini (7):
  xen/spinlock: address violations of MISRA C Rule 20.7
  xen/include: address violations of MISRA C Rule 20.7
  xen/list: address violations of MISRA C Rule 20.7
  xen/param: address violations of MISRA C Rule 20.7
  xen/arm: address some violations of MISRA C Rule 20.7
  x86/irq: parenthesize negative constants
  arm/smmu: address some violations of MISRA C Rule 20.7

 xen/arch/arm/arm64/cpufeature.c          | 14 ++--
 xen/arch/arm/cpuerrata.c                 |  8 +--
 xen/arch/arm/include/asm/arm64/sysregs.h |  2 +-
 xen/arch/arm/include/asm/guest_atomics.h |  4 +-
 xen/arch/arm/include/asm/mm.h            |  2 +-
 xen/arch/arm/include/asm/smccc.h         | 36 +++++-----
 xen/arch/arm/include/asm/vgic-emul.h     |  8 +--
 xen/arch/arm/vcpreg.c                    |  5 +-
 xen/arch/x86/include/asm/irq.h           |  8 +--
 xen/drivers/passthrough/arm/smmu.c       |  4 +-
 xen/include/xen/bug.h                    |  2 +-
 xen/include/xen/init.h                   |  4 +-
 xen/include/xen/list.h                   | 83 ++++++++++++------------
 xen/include/xen/param.h                  | 22 +++----
 xen/include/xen/spinlock.h               |  2 +-
 15 files changed, 102 insertions(+), 102 deletions(-)