[PATCH 1/6] include: array_size.h: make header self-contained
Ahmad Fatoum
a.fatoum at barebox.org
Mon Feb 9 01:10:26 PST 2026
The definition of __must_be_array is a bit hairy as it's defined in
<linux/compiler-gcc.h>, which is included by <linux/compiler_types.h>,
but has an implicit dependency on <linux/build_bug.h> for BUILD_BUG_ON_ZERO
in the definition of __must_be_array, but <linux/build_bug.h> itself
already includes <linux/compiler_types.h>.
Let's put a bandaid on this for users of ARRAY_SIZE, by including
<linux/build_bug.h> explicitly for <linux/array_size.h>.
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
include/linux/array_size.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/array_size.h b/include/linux/array_size.h
index 5411d730c819..d1ad53d950d4 100644
--- a/include/linux/array_size.h
+++ b/include/linux/array_size.h
@@ -2,7 +2,8 @@
#ifndef _LINUX_ARRAY_SIZE_H
#define _LINUX_ARRAY_SIZE_H
-#include <linux/compiler.h>
+#include <linux/compiler_types.h>
+#include <linux/build_bug.h>
/**
* ARRAY_SIZE - get the number of elements in array @arr
--
2.47.3
More information about the barebox
mailing list