On Wed, Mar 26, 2025 at 04:35:13PM -0600, Gustavo A. R. Silva wrote: > -Wflex-array-member-not-at-end was introduced in GCC-14, and we are > getting ready to enable it, globally. > > Use the `DEFINE_RAW_FLEX()` helper for an on-stack definition of > a flexible structure where the size of the flexible-array member > is known at compile-time, and refactor the rest of the code, > accordingly. > > So, with these changes, fix the following warning: > > rivers/watchdog/cros_ec_wdt.c:29:40: warning: structure containing a flexible > array member is not at the end of another structure > [-Wflex-array-member-not-at-end] ^ d truncated.
> Signed-off-by: Gustavo A. R. Silva <[email protected]> With minor comments, Reviewed-by: Tzung-Bi Shih <[email protected]> > + DEFINE_RAW_FLEX(struct cros_ec_command, buf, data, > + sizeof(union cros_ec_wdt_data)); s/buf/msg/g makes much sense. > + ((union cros_ec_wdt_data *)buf->data)->req = arg->req; Or, *(struct ec_params_hang_detect *)buf->data = arg->req; > - arg->resp = buf.data.resp; > + arg->resp = ((union cros_ec_wdt_data *)buf->data)->resp; Or, arg->resp = *(struct ec_response_hang_detect *)buf->data;
