All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/4] address MISRA C:2012 Rule 15.2
@ 2023-11-07 10:33 Nicola Vetrini
  2023-11-07 10:33 ` [RFC PATCH 1/4] xen/vsprintf: replace backwards jump with loop Nicola Vetrini
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Nicola Vetrini @ 2023-11-07 10:33 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, michal.orzel, xenia.ragiadakou, ayan.kumar.halder,
	consulting, jbeulich, andrew.cooper3, roger.pau, Nicola Vetrini,
	George Dunlap, Julien Grall, Wei Liu, Bertrand Marquis,
	Volodymyr Babchuk, Simone Ballarin, Doug Goldstein

This series is aimed at presenting some strategies that can be used to deal with
violations of Rule 15.2:
"The goto statement shall jump to a label declared later in the same function".

The rule's rationale is about possible developer confusion, therefore it could
be argued that there is no substantial gain in complying with it, given the
torough review process in place.

Nonetheless, the proposed resolution strategies are the following:
- use a loop instead of a goto (see patch 1 and 3)
- make the jump due to the goto forward, rather than backward (see patch 2)
- unconditionally allow certain constructs, such as "goto retry", whose presence
  in the codebase typically signifies that all other reasonable approaches (e.g,
  loops, forward jumps) have been considered and deemed inferior in terms of
  code readability.
  
The latter strategy may be postponed until all goto-s with a certain label have
been examined. An alternative strategy could be to allow certain files
(most notably those under x86/x86_emulate) to have backward jumps, and resolve
the remaining violations.

Any feedback on this matter is welcome.

Nicola Vetrini (4):
  xen/vsprintf: replace backwards jump with loop
  x86/dom0: make goto jump forward
  xen/arm: GICv3: address MISRA C:2012 Rule 15.2
  automation/eclair: add deviation for certain backwards goto

 .../eclair_analysis/ECLAIR/deviations.ecl     | 10 +++
 docs/misra/deviations.rst                     | 10 +++
 xen/arch/arm/gic-v3-its.c                     | 81 ++++++++++---------
 xen/arch/x86/dom0_build.c                     | 14 ++--
 xen/common/vsprintf.c                         | 20 +++--
 5 files changed, 81 insertions(+), 54 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-11-21 14:42 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-07 10:33 [RFC PATCH 0/4] address MISRA C:2012 Rule 15.2 Nicola Vetrini
2023-11-07 10:33 ` [RFC PATCH 1/4] xen/vsprintf: replace backwards jump with loop Nicola Vetrini
2023-11-07 11:36   ` Andrew Cooper
2023-11-21 13:52     ` Jan Beulich
2023-11-07 10:33 ` [RFC PATCH 2/4] x86/dom0: make goto jump forward Nicola Vetrini
2023-11-21 13:57   ` Jan Beulich
2023-11-07 10:33 ` [RFC PATCH 3/4] xen/arm: GICv3: address MISRA C:2012 Rule 15.2 Nicola Vetrini
2023-11-07 12:34   ` Julien Grall
2023-11-07 10:33 ` [RFC PATCH 4/4] automation/eclair: add deviation for certain backwards goto Nicola Vetrini
2023-11-07 12:44   ` Julien Grall
2023-11-07 14:45     ` Nicola Vetrini
2023-11-07 17:35       ` Julien Grall
2023-11-08 10:10         ` Nicola Vetrini
2023-11-07 10:52 ` [RFC PATCH 0/4] address MISRA C:2012 Rule 15.2 Jan Beulich
2023-11-07 11:10   ` Nicola Vetrini
2023-11-21 14:41 ` Nicola Vetrini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.