lkml.org 
[lkml]   [2021]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 17/20] linux/array_size.h: Add __is_array(a) to help readability
Date
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---
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
\
 
 \ /
  Last update: 2021-11-20 14:03    [W:0.353 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site