Message ID | d7c9e5cdabbcc3262f0e23fbf914cd6bb7e47990.1712321857.git.nicola.vetrini@bugseng.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [XEN] xen/compiler: address violation of MISRA C Rule 20.9 | expand |
On 05.04.2024 14:59, Nicola Vetrini wrote: > The rule states: > "All identifiers used in the controlling expression of #if or #elif > preprocessing directives shall be #define'd before evaluation". > In this case, using defined(identifier) is a MISRA-compliant > way to achieve the same effect. > > Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> Acked-by: Jan Beulich <jbeulich@suse.com>
diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h index fc87a2edad7f..179ff23e62c5 100644 --- a/xen/include/xen/compiler.h +++ b/xen/include/xen/compiler.h @@ -30,7 +30,7 @@ #define __weak __attribute__((__weak__)) -#if !CONFIG_CC_IS_CLANG || CONFIG_CLANG_VERSION >= 140000 +#if !defined(CONFIG_CC_IS_CLANG) || CONFIG_CLANG_VERSION >= 140000 # define nocall __attribute__((__error__("Nonstandard ABI"))) #else # define nocall
The rule states: "All identifiers used in the controlling expression of #if or #elif preprocessing directives shall be #define'd before evaluation". In this case, using defined(identifier) is a MISRA-compliant way to achieve the same effect. Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com> --- This is the only outstanding violation of the rule, given the current configurations. There are likely other sites that may benefit from a gradual refactor. --- xen/include/xen/compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)