[PATCH 1/2] stddef: Add a comment about why TRAILING_OVERLAP() exists

Uwe Kleine-König posted 2 patches 2 weeks, 6 days ago
[PATCH 1/2] stddef: Add a comment about why TRAILING_OVERLAP() exists
Posted by Uwe Kleine-König 2 weeks, 6 days ago
Just from reading the definition it's not obvious what the macro does
and why it's needed and sensible to be used.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
 include/linux/stddef.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index dab49e2ec8c0..a748efcd626f 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -97,7 +97,17 @@ enum {
  * TRAILING_OVERLAP() - Overlap a flexible-array member with trailing members.
  *
  * Creates a union between a flexible-array member (FAM) in a struct and a set
- * of additional members that would otherwise follow it.
+ * of additional members that would otherwise follow it. This is needed because
+ * the traditional
+ *
+ * 	struct {
+ * 		struct some_struct_with_FAM mystruct;
+ * 		struct some_other_struct fill_FAM;
+ * 	}
+ *
+ * with the purpose that fill_FAM overlaps the flexible-array in mystruct
+ * triggers a compiler warning about the flexible array member not being at the
+ * end of the structure.
  *
  * @TYPE: Flexible structure type name, including "struct" keyword.
  * @NAME: Name for a variable to define.
-- 
2.50.1