mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
automation/eclair_analysis: fix MISRA Rule 20.7 regression in self-tests.h
Prior tobd1664db7b("xen/bitops: Introduce a multiple_bits_set() helper") the definition of {COMPILE,RUNTIME}_CHECK was fully compliant with respect to MISRA C Rule 20.7: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses." However, to allow testing function-like macros, parentheses on the "fn" parameter were removed and thus new violations of the rule have been introduced. Given the usefulness of this functionality, it is deemed ok to deviate these two macros for this rule, because their scope of (direct) usage is limited to just the file where they are defined, and the possibility of misuses is unlikely. No functional change. Fixes:bd1664db7b("xen/bitops: Introduce a multiple_bits_set() helper") Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
1 parent
035baa203b
commit
4b3f30ea30
2 files changed
+14
No files matched your search
@@ -581,6 +581,12 @@ of this macro do not lead to developer confusion, and can thus be deviated."
|
||||
-config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^count_args_$))))"}
|
||||
-doc_end
|
||||
|
||||
-doc_begin="The argument \"fn\" in macros {COMPILE,RUNTIME}_CHECK is not parenthesized
|
||||
on purpose, to be able to test function-like macros. Given the specialized and limited
|
||||
use of this macro, it is deemed ok to deviate them."
|
||||
-config=MC3R1.R20.7,reports+={deliberate, "any_area(any_loc(any_exp(macro(^(COMPILE_CHECK|RUNTIME_CHECK)$))))"}
|
||||
-doc_end
|
||||
|
||||
-doc_begin="Uses of variadic macros that have one of their arguments defined as
|
||||
a macro and used within the body for both ordinary parameter expansion and as an
|
||||
operand to the # or ## operators have a behavior that is well-understood and
|
||||
|
||||
@@ -534,6 +534,14 @@ Deviations related to MISRA C:2012 Rules:
|
||||
refactoring it to add parentheses breaks its functionality.
|
||||
- Tagged as `safe` for ECLAIR.
|
||||
|
||||
* - R20.7
|
||||
- The macros `{COMPILE,RUNTIME}_CHECK` defined in
|
||||
`xen/include/xen/self-tests.h` are allowed not to parenthesize the "fn"
|
||||
argument, to allow function-like macros to be tested as well as
|
||||
functions. Given the specialized use of these macros and their limited
|
||||
usage scope, omitting parentheses is deemed unlikely to cause issues.
|
||||
- Tagged as `deliberate` for ECLAIR.
|
||||
|
||||
* - R20.12
|
||||
- Variadic macros that use token pasting often employ the gcc extension
|
||||
`ext_paste_comma`, as detailed in `C-language-toolchain.rst`, which is
|
||||
|
||||