platform/chrome: kunit: Avoid -Wflex-array-member-not-at-end
authorGustavo A. R. Silva <gustavoars@kernel.org>
Tue, 6 May 2025 21:14:01 +0000 (15:14 -0600)
committerTzung-Bi Shih <tzungbi@kernel.org>
Wed, 7 May 2025 03:04:29 +0000 (03:04 +0000)
-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]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/aBp7mZ8kj9w4CKkl@kspp
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
drivers/platform/chrome/cros_ec_proto_test_util.h

index 414002271c9c0c5efde31a79d9d2e5624698a0e5..b17239f052c23e8b03b036f8dd5bdebcba1dabe1 100644 (file)
@@ -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;