From: Federico Serafini <[email protected]> MISRA C Rule 5.5 states that: "Identifiers shall be distinct from macro names".
A common pattern in Xen is to have a function-like macro that acts as a "wrapper" for the function to be called: before calling the function, the macro adds additional checks or increase/decrease the number of parameters depending on the configuration. Update ECLAIR configuration and deviations.rst. Signed-off-by: Federico Serafini <[email protected]> Signed-off-by: Victor Lira <[email protected]> --- Cc: Andrew Cooper <[email protected]> Cc: Anthony PERARD <[email protected]> Cc: Michal Orzel <[email protected]> Cc: Jan Beulich <[email protected]> Cc: Julien Grall <[email protected]> Cc: Roger Pau Monné <[email protected]> Cc: Stefano Stabellini <[email protected]> Cc: Nicola Vetrini <[email protected]> Cc: Federico Serafini <[email protected]> Cc: Bertrand Marquis <[email protected]> --- automation/eclair_analysis/ECLAIR/deviations.ecl | 8 ++++++++ docs/misra/deviations.rst | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl index ffa23b53b7..303b06203a 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -114,6 +114,14 @@ it defines would (in the common case) be already defined. Peer reviewed by the c -config=MC3A2.R5.5,reports+={deliberate, "any_area(decl(kind(function))||any_loc(macro(name(memcpy||memset||memmove))))&&any_area(any_loc(file(^xen/common/libelf/libelf-private\\.h$)))"} -doc_end +-doc_begin="Clashes between function-like macros and function names are +deliberate since a common pattern in Xen is to have a function-like macro +that acts as a \"wrapper\" for the function to be called: +before calling the function, the macro adds additional checks or +increase/decrease the number of parameters depending on the configuration." +-config=MC3A2.R5.5,reports+={deliberate, "all_area(macro(function_like())||decl(kind(function)))"} +-doc_end + -doc_begin="The type \"ret_t\" is deliberately defined multiple times, depending on the guest." -config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"} diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst index 88328eaa8a..cfdd1a9838 100644 --- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -130,6 +130,14 @@ Deviations related to MISRA C:2012 Rules: memmove. - Tagged as `deliberate` for ECLAIR. + * - R5.5 + - Clashes between function-like macros and function names are + deliberate since a common pattern in Xen is to have a function-like + macro that acts as a "wrapper" for the function to be called: + before calling the function, the macro adds additional checks or + increase/decrease the number of parameters depending on the configuration. + - Tagged as `deliberate` for ECLAIR. + * - R5.6 - The type ret_t is deliberately defined multiple times depending on the type of guest to service. -- 2.47.0
