[PATCH v2 17/20] linux/array_size.h: Add __is_array(a) to help readability

From: Alejandro Colomar
Date: Sat Nov 20 2021 - 08:02:15 EST


Signed-off-by: Alejandro Colomar <alx.manpages@xxxxxxxxx>
---
include/linux/array_size.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/array_size.h b/include/linux/array_size.h
index c2b4fddba564..4d364f8a1f50 100644
--- a/include/linux/array_size.h
+++ b/include/linux/array_size.h
@@ -7,7 +7,9 @@


/* &a[0] degrades to a pointer: a different type from an array */
-#define __must_be_array(a) __must_be(!__same_type((a), &(a)[0]))
+#define __is_array(a) (!__same_type((a), &(a)[0]))
+
+#define __must_be_array(a) __must_be(__is_array(a))

/**
* ARRAY_SIZE - get the number of elements in array @a
--
2.33.1