On 04.06.2025 03:11, Stefano Stabellini wrote:
> MISRA C Directive 4.10 states that "Precautions shall be taken in order
> to prevent the contents of a header file being included more than
> once".
>
> Add a SAF tag to the existing comment on top of cpufeatures.h.
> Add a header inclusion guard to compile.h.
>
> Update ECLAIR configuration to:
> - extend existing deviation to other comments explicitly saying a file
> is intended for multiple inclusion;
> - extend existing deviation to other autogenerated files;
> - tag the guidelines as clean.
>
> Update deviations.rst accordingly.
>
> Signed-off-by: Federico Serafini <[email protected]>
> Signed-off-by: Stefano Stabellini <[email protected]>
> ---
> Changes in v3:
> - fix copy/paste error in process-banner.sed
> - fix comment in cpufeatures.h so that ECLAIR picks it up properly
> - remove xlat.h deviation thanks to Jan's patch
With this in mind, ...
> --- a/docs/misra/deviations.rst
> +++ b/docs/misra/deviations.rst
> @@ -30,6 +30,19 @@ Deviations related to MISRA C:2012 Directives:
> not to add an additional encapsulation layer.
> - Tagged as `deliberate` for ECLAIR.
>
> + * - D4.10
> + - Files that are intended to be included more than once (and have
> + a comment that says this explicitly) do not need to conform to the
> + directive.
> + - Tagged as `safe` for ECLAIR.
> +
> + * - D4.10
> + - There are autogenerated files that do not need to comply to the
> + directive.
> + - Tagged as `safe` for ECLAIR. Such files are:
> + - xen/include/generated/autoconf.h
> + - xen/arch/{arm,x86}/include/generated/asm/\*
... why not deal with at least the latter (we may not want to fiddle with
kconfig
sources) as well?
Jan