mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
automation/eclair: update configuration of Rule 20.7
MISRA C:2012 Rule 20.7 states that "Expressions resulting from the
expansion of macro parameters shall be enclosed in parentheses".
The rational of the rule is that if a macro argument expands to an
expression, there may be problems related to operator precedence, e.g.,
define M(A, B) A * B
M(1+1, 2+2) will expand to: 1+1 * 2+2
Update ECLAIR configuration to tag as 'safe' the expansions of macro
arguments surrounded tokens '{', '}' and ';', since in their presence
problems related to operator precedence can not occur.
Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
1 parent
33888e7aaa
commit
3c5c9743ca
2 files changed
+9
No files matched your search
@@ -598,6 +598,10 @@ 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)$))))"}
|
-config=MC3R1.R20.7,reports+={deliberate, "any_area(any_loc(any_exp(macro(^(COMPILE_CHECK|RUNTIME_CHECK)$))))"}
|
||||||
-doc_end
|
-doc_end
|
||||||
|
|
||||||
|
-doc_begin="Problems related to operator precedence can not occur if the expansion of the macro argument is surrounded by tokens '{', '}' and ';'."
|
||||||
|
-config=MC3R1.R20.7,expansion_context+={safe, "left_right(^[\\{;]$,^[;\\}]$)"}
|
||||||
|
-doc_end
|
||||||
|
|
||||||
-doc_begin="Uses of variadic macros that have one of their arguments defined as
|
-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
|
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
|
operand to the # or ## operators have a behavior that is well-understood and
|
||||||
|
|||||||
@@ -552,6 +552,11 @@ Deviations related to MISRA C:2012 Rules:
|
|||||||
usage scope, omitting parentheses is deemed unlikely to cause issues.
|
usage scope, omitting parentheses is deemed unlikely to cause issues.
|
||||||
- Tagged as `deliberate` for ECLAIR.
|
- Tagged as `deliberate` for ECLAIR.
|
||||||
|
|
||||||
|
* - R20.7
|
||||||
|
- Problems related to operator precedence can not occur if the expansion
|
||||||
|
of the macro argument is surrounded by tokens '{', '}' and ';'.
|
||||||
|
- Tagged as `safe` for ECLAIR.
|
||||||
|
|
||||||
* - R20.12
|
* - R20.12
|
||||||
- Variadic macros that use token pasting often employ the gcc extension
|
- Variadic macros that use token pasting often employ the gcc extension
|
||||||
`ext_paste_comma`, as detailed in `C-language-toolchain.rst`, which is
|
`ext_paste_comma`, as detailed in `C-language-toolchain.rst`, which is
|
||||||
|
|||||||