[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] docs/misra: Document ECLAIR extension to Rule 20.7
commit 75d88297f50531bdad83a513b47e6ffad34499ec Author: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx> AuthorDate: Fri Jan 17 08:54:39 2025 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri Jan 17 08:54:39 2025 +0100 docs/misra: Document ECLAIR extension to Rule 20.7 MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Document the behaviour of ECLAIR with respect to the CPP extension that allows variable macro arguments to be named. Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> --- docs/misra/rules.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst index e7763795b8..e1c26030e8 100644 --- a/docs/misra/rules.rst +++ b/docs/misra/rules.rst @@ -671,7 +671,14 @@ maintainers if you want to suggest a change. shall be enclosed in parentheses - Extra parentheses are not required when macro parameters are used as function arguments, as macro arguments, array indices, lhs in - assignments or as initializers in initalizer lists. + assignments or as initializers in initalizer lists. In addition, + the use of a named variable argument in a macro that would constitute + a violation of the rule is allowed by ECLAIR as an extension of the + MISRA guideline, since it may not always be possible to parenthesize + such argument and the feature is non-standard:: + + #define M(args...) args + #if M(1) + 0 * - `Rule 20.9 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_09.c>`_ - Required -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |