Skip to contentSkip to conversation

platform/x86: Avoid -Wflex-array-member-not-at-end warning

PATCH In review Gustavo A. R. Silva 2 participants 2 messages Mar 27, 2025 – Apr 7, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

-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 acpi_resource_irq is a flexible structure --a structure that contains a flexible-array member.

Fix the following warning:

drivers/platform/x86/sony-laptop.c:3330:41: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

---
 drivers/platform/x86/sony-laptop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/sony-laptop.c +3 -1
index 3197aaa69da7..9cd6d4a10ddb 100644
@@ -3327,8 +3327,10 @@ struct sony_pic_ioport {
 };
 
 struct sony_pic_irq {
-	struct acpi_resource_irq	irq;
 	struct list_head		list;
+
+	/* Must be last --ends in a flexible-array member. */
+	struct acpi_resource_irq	irq;
 };
 
 struct sonypi_eventtypes {
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 acpi_resource_irq is a flexible structure --a structure that contains a flexible-array member.

[...]

Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86: Avoid -Wflex-array-member-not-at-end warning

      commit: a62372b6c9284ed42c68a0d8b3148f2dde61b4e4

--
i.