]> xenbits.xensource.com Git - xen.git/commitdiff
xen/compiler: fix MISRA C 2012 Rule 20.7 violation
authorXenia Ragiadakou <burzalodowa@gmail.com>
Fri, 5 Aug 2022 06:37:13 +0000 (08:37 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 5 Aug 2022 06:37:13 +0000 (08:37 +0200)
In __must_be_array(), the macro parameter 'a' is used as expression and
therefore it is good to be enclosed in parentheses to prevent against
unintended expansions.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/include/xen/compiler.h

index 933aec09a92dc0af9cf66755f55a60274a877612..a5631303348b16f7b5f737c9e94af4daf1d11527 100644 (file)
 
 /* &a[0] degrades to a pointer: a different type from an array */
 #define __must_be_array(a) \
-  BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
+  BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&(a)[0])))
 
 #ifdef CONFIG_CC_HAS_VISIBILITY_ATTRIBUTE
 /* Results in more efficient PIC code (no indirections through GOT or PLT). */