carl9170: Avoid -Wflex-array-member-not-at-end warning
PATCH 1/1 carl9170: 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 (which happens to be in a union, so we're moving the entire union) to the end of the corresponding structure. Notice that struct carl9170_rsp is a flexible structure, this is a structure that contains a flexible-array member.
With these changes fix the following warning:
drivers/net/wireless/ath/carl9170/carl9170.h:382:9: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
--- drivers/net/wireless/ath/carl9170/carl9170.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/carl9170/carl9170.h +7 -5
@@ -375,11 +375,6 @@ struct ar9170 {u8 *readbuf;spinlock_t cmd_lock;struct completion cmd_wait; -union { -__le32 cmd_buf[PAYLOAD_MAX +1 ]; -struct carl9170_cmd cmd; -struct carl9170_rsp rsp; - };/* statistics */ unsigned int tx_dropped;
@@ -463,6 +458,13 @@ struct ar9170 {unsigned int cache_idx; } rng;#endif /* CONFIG_CARL9170_HWRNG */ + +/* Must be last as it ends in a flexible-array member. */ +union { +__le32 cmd_buf[PAYLOAD_MAX +1 ]; +struct carl9170_cmd cmd; +struct carl9170_rsp rsp; + }; }; enum carl9170_ps_off_override_reasons {
Signature · 1 line
2.43.0
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 (which happens to be in a union, so we're moving the entire union) to the end of the corresponding structure. Notice that
struct carl9170_rspis a flexible structure, this is a structure that contains a flexible-array member.
Quoted 5 lines
With these changes fix the following warning:
drivers/net/wireless/ath/carl9170/carl9170.h:382:9: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]Signed-off-by Gustavo A. R. Silva <[email protected]>
Sure, if this truly fixes the warning.
Quoted 34 lines
--- drivers/net/wireless/ath/carl9170/carl9170.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/net/wireless/ath/carl9170/carl9170.h +7
-5@@ -375,11 +375,6 @@ struct ar9170 {u8 *readbuf;spinlock_t cmd_lock;struct completion cmd_wait; -union { -__le32 cmd_buf[PAYLOAD_MAX +1 ]; -struct carl9170_cmd cmd; -struct carl9170_rsp rsp; - };/* statistics */ unsigned int tx_dropped;@@ -463,6 +458,13 @@ struct ar9170 {unsigned int cache_idx; } rng;#endif /* CONFIG_CARL9170_HWRNG */ + +/* Must be last as it ends in a flexible-array member. */ +union { +__le32 cmd_buf[PAYLOAD_MAX +1 ]; +struct carl9170_cmd cmd; +struct carl9170_rsp rsp; + }; }; enum carl9170_ps_off_override_reasons {