From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: xen-devel@lists.xenproject.org
Cc: sstabellini@kernel.org, michal.orzel@amd.com,
xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com,
consulting@bugseng.com, jbeulich@suse.com,
andrew.cooper3@citrix.com, roger.pau@citrix.com,
Nicola Vetrini <nicola.vetrini@bugseng.com>,
George Dunlap <george.dunlap@citrix.com>,
Julien Grall <julien@xen.org>, Wei Liu <wl@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
Simone Ballarin <simone.ballarin@bugseng.com>,
Doug Goldstein <cardoe@cardoe.com>
Subject: [RFC PATCH 0/4] address MISRA C:2012 Rule 15.2
Date: Tue, 7 Nov 2023 11:33:41 +0100 [thread overview]
Message-ID: <cover.1699295113.git.nicola.vetrini@bugseng.com> (raw)
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
next reply other threads:[~2023-11-07 10:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-07 10:33 Nicola Vetrini [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1699295113.git.nicola.vetrini@bugseng.com \
--to=nicola.vetrini@bugseng.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=ayan.kumar.halder@amd.com \
--cc=bertrand.marquis@arm.com \
--cc=cardoe@cardoe.com \
--cc=consulting@bugseng.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=simone.ballarin@bugseng.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
--cc=xenia.ragiadakou@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.