Hello all!
The only purpose of this RFC is to receive comments from you on how to deal
with MISRA C Rule 5.5 violations in XEN.
The Rule states that: "Identifiers shall be distinct from macro names".
There are ~580 violations in ARM and ~3200 in x86 architectures.
The following macros violate this Rule:
__test_and_set_bit
__test_and_clear_bit
__test_and_change_bit
test_bit
set_bit
clear_bit
change_bit
test_and_set_bit
test_and_clear_bit
test_and_change_bit
get_fpu
do_multicall
virt_to_maddr
I would like to address these violations in XEN codebase.
Specifically to rename macros names with capital letters.
Like this:
-#define __test_and_change_bit(nr, addr) ({ \
+#define __TEST_AND_CHANGE_BIT(nr, addr) ({ \
if ( bitop_bad_size(addr) ) __bitop_bad_size(); \
__test_and_change_bit(nr, addr); \
})
As a result -> MISRA C compliance, clear and readable code.
PLEASE, NOTE!
I don't ask you to review this patch series.
Actually it isn't full and was created just to receive understanding how
changes would look like.
Yes, these changes are huge, that's why I created this RFC.
Please let me know your opinion.
Thank you in advance.
Dmytro Prokopchuk (3):
misra: address 5.5 pirq_cleanup_check
misra: address rule 5.5 gnttab
misra: address rule 5.5 bitops
xen/arch/arm/dm.c | 2 +-
xen/arch/arm/domctl.c | 2 +-
xen/arch/arm/gic-vgic.c | 26 ++++++++---------
xen/arch/arm/gic.c | 8 ++---
xen/arch/arm/include/asm/cpufeature.h | 2 +-
xen/arch/arm/include/asm/gic.h | 2 +-
xen/arch/arm/include/asm/guest_atomics.h | 4 +--
xen/arch/arm/irq.c | 16 +++++-----
xen/arch/arm/tee/ffa_partinfo.c | 2 +-
xen/arch/arm/tee/ffa_private.h | 2 +-
xen/arch/arm/traps.c | 2 +-
xen/arch/arm/vgic-v3-its.c | 6 ++--
xen/arch/arm/vgic.c | 10 +++----
xen/arch/arm/vgic/vgic-mmio.c | 2 +-
xen/arch/arm/vgic/vgic.c | 2 +-
xen/arch/arm/vpsci.c | 4 +--
xen/arch/riscv/cpufeature.c | 2 +-
xen/arch/riscv/include/asm/guest_atomics.h | 2 +-
xen/arch/x86/cpu-policy.c | 14 ++++-----
xen/arch/x86/cpu/amd.c | 2 +-
xen/arch/x86/cpu/common.c | 14 ++++-----
xen/arch/x86/cpu/mcheck/x86_mca.h | 2 +-
xen/arch/x86/domain.c | 2 +-
xen/arch/x86/e820.c | 4 +--
xen/arch/x86/guest/xen/xen.c | 2 +-
xen/arch/x86/hvm/emulate.c | 2 +-
xen/arch/x86/hvm/hpet.c | 6 ++--
xen/arch/x86/hvm/irq.c | 12 ++++----
xen/arch/x86/hvm/svm/nestedsvm.c | 10 +++----
xen/arch/x86/hvm/svm/svm.c | 2 +-
xen/arch/x86/hvm/viridian/time.c | 4 +--
xen/arch/x86/hvm/vlapic.c | 2 +-
xen/arch/x86/hvm/vmx/vmcs.c | 8 ++---
xen/arch/x86/hvm/vmx/vmx.c | 4 +--
xen/arch/x86/include/asm/guest_atomics.h | 2 +-
xen/arch/x86/include/asm/hvm/vlapic.h | 2 +-
xen/arch/x86/include/asm/hvm/vmx/vmx.h | 2 +-
xen/arch/x86/include/asm/mpspec.h | 2 +-
xen/arch/x86/irq.c | 34 +++++++++++-----------
xen/arch/x86/mm.c | 8 ++---
xen/arch/x86/mm/hap/hap.c | 2 +-
xen/arch/x86/mm/paging.c | 4 +--
xen/arch/x86/mm/shadow/common.c | 2 +-
xen/arch/x86/mm/shadow/hvm.c | 4 +--
xen/arch/x86/monitor.c | 4 +--
xen/arch/x86/msi.c | 2 +-
xen/arch/x86/psr.c | 2 +-
xen/arch/x86/pv/dom0_build.c | 4 +--
xen/arch/x86/pv/emul-priv-op.c | 2 +-
xen/arch/x86/pv/shim.c | 2 +-
xen/arch/x86/traps.c | 2 +-
xen/arch/x86/x86_64/mm.c | 2 +-
xen/arch/x86/x86_64/mmconfig_64.c | 2 +-
xen/arch/x86/xstate.c | 4 +--
xen/common/domain.c | 4 +--
xen/common/efi/runtime.c | 2 +-
xen/common/event_2l.c | 2 +-
xen/common/event_channel.c | 6 ++--
xen/common/grant_table.c | 10 +++----
xen/common/kexec.c | 16 +++++-----
xen/common/keyhandler.c | 2 +-
xen/common/multicall.c | 2 +-
xen/common/numa.c | 4 +--
xen/common/page_alloc.c | 4 +--
xen/common/pdx.c | 2 +-
xen/common/sched/core.c | 12 ++++----
xen/common/sched/credit.c | 12 ++++----
xen/common/sched/credit2.c | 6 ++--
xen/common/sched/rt.c | 4 +--
xen/common/vmap.c | 12 ++++----
xen/drivers/passthrough/iommu.c | 2 +-
xen/drivers/passthrough/vtd/dmar.c | 4 +--
xen/drivers/passthrough/vtd/iommu.c | 4 +--
xen/drivers/passthrough/x86/hvm.c | 10 +++----
xen/drivers/passthrough/x86/iommu.c | 2 +-
xen/drivers/vpci/vpci.c | 4 +--
xen/include/xen/bitops.h | 8 ++---
xen/include/xen/cpumask.h | 6 ++--
xen/include/xen/irq.h | 2 +-
xen/include/xen/nodemask.h | 2 +-
xen/include/xen/sched.h | 4 +--
81 files changed, 211 insertions(+), 211 deletions(-)
--
2.43.0