From: Michał Janiszewski <
janisozaur@gmail.com>
Inspired by kernel check and recent unification of ARRAY_SIZE, provide
a way of enforcing the macro can only be applied to actual arrays and
not to pointers.
Signed-off-by: Michał Janiszewski <
janisozaur@gmail.com>
---
include/winnt.h | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/include/winnt.h b/include/winnt.h
index 7f822c4aec..ad945464f1 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -760,7 +760,26 @@ typedef struct _MEMORY_BASIC_INFORMATION
((type *)((PCHAR)(address) - offsetof(type, field)))
#ifdef __WINESRC__
-# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+// Validate types used in the expression.
+// Based on
https://elixir.bootlin.com/linux/v4.17.4/source/include/linux/kernel.h#L71