Skip to contentSkip to conversation

xen/compiler: Fix MISRA C 2012 Rule 20.7 violation

PATCH In review Xenia Ragiadakou 2 participants 2 messages Aug 4, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/compiler: Fix MISRA C 2012 Rule 20.7 violation

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.

---
 xen/include/xen/compiler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/xen/compiler.h +1 -1
index 933aec09a9..a563130334 100644
@@ -123,7 +123,7 @@
 
 /* &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). */
Signature · 1 line
2.34.1