[XEN PATCH] docs/misra: deviate deliberately unused labels

Nicola Vetrini posted 1 patch 4 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/669f63d14926f6335a081711de5a34ef04c61717.1701714146.git.nicola.vetrini@bugseng.com
automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
docs/misra/deviations.rst                        | 8 ++++++++
2 files changed, 12 insertions(+)
[XEN PATCH] docs/misra: deviate deliberately unused labels
Posted by Nicola Vetrini 4 months, 3 weeks ago
The labels marked with __maybe_unused are either used only
in certain build configurations or deliberately unused.
See the justification in docs/misra/deviations.rst.

No functional changes.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++
 docs/misra/deviations.rst                        | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index c9e3a90801aa..f18ed6345e67 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -37,6 +37,10 @@ removed by the compiler, the resulting slowdown is negligible."
 -config=MC3R1.R2.2,reports+={disapplied,"any()"}
 -doc_end
 
+-doc_begin="Some labels are unused in certain build configurations, or are deliberately marked as unused, so that the compiler is entitled to remove them."
+-config=MC3R1.R2.6,reports+={deliberate, "any_area(text(^.*__maybe_unused.*$))"}
+-doc_end
+
 #
 # Series 3.
 #
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 160513b997ae..9979ddae7c7d 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -73,6 +73,14 @@ Deviations related to MISRA C:2012 Rules:
        resulting slowdown is negligible.
      - Project-wide deviation, tagged as `disapplied` for ECLAIR.
 
+   * - R2.6
+     - Labels deliberately marked as unused trough the pseudo-attribute
+       `__maybe_unused` are either the result of them not being in certain build
+       configurations, or as a deliberate practice (e.g., `unimplemented_insn`).
+       Given that the compiler is then entitled to remove them, the presence of
+       such labels poses no risks.
+     - Tagged as `deliberate` for ECLAIR.
+
    * - R3.1
      - Comments starting with '/\*' and containing hyperlinks are safe as they
        are not instances of commented-out code.
-- 
2.34.1
Re: [XEN PATCH] docs/misra: deviate deliberately unused labels
Posted by Stefano Stabellini 4 months, 3 weeks ago
On Mon, 4 Dec 2023, Nicola Vetrini wrote:
> The labels marked with __maybe_unused are either used only
> in certain build configurations or deliberately unused.
> See the justification in docs/misra/deviations.rst.
> 
> No functional changes.
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>