Skip to contentSkip to conversation

platform/chrome: Avoid -Wflex-array-member-not-at-end

PATCH Superseded Gustavo A. R. Silva 2 participants 2 messages May 6, 2025 – May 7, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/chrome: Avoid -Wflex-array-member-not-at-end

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.

Move the conflicting declaration to the end of the structure. Notice that struct cros_ec_command is a flexible structure --a structure that contains a flexible-array member.

Fix the following warning:

drivers/platform/chrome/cros_ec_proto_test_util.h:16:32: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

---
 drivers/platform/chrome/cros_ec_proto_test_util.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/platform/chrome/cros_ec_proto_test_util.h +4 -1
index 414002271c9c..b17239f052c2 100644
@@ -13,7 +13,6 @@ struct ec_xfer_mock {
 	struct kunit *test;
 
 	/* input */
-	struct cros_ec_command msg;
 	void *i_data;
 
 	/* output */
@@ -21,6 +20,10 @@ struct ec_xfer_mock {
 	int result;
 	void *o_data;
 	u32 o_data_len;
+
+	/* input */
+	/* Must be last -ends in a flexible-array member. */
+	struct cros_ec_command msg;
 };
 
 extern int cros_kunit_ec_xfer_mock_default_result;
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 8 lines · Gustavo A. R. Silva

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.

Move the conflicting declaration to the end of the structure. Notice that struct cros_ec_command is a flexible structure --a structure that contains a flexible-array member.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-next

[1/1] platform/chrome: Avoid -Wflex-array-member-not-at-end

      commit: 3e552ccf405c0dea6339988202a564357249c437

Thanks!