Moving alignment information in the nsapi_msghdr_t

Macro MBED_ALIGN expands in C to _Alignas which can't be used in the
type declaration. This patch moves it to the first type definition
which makes this code compile properly in CPP and C.
pull/15040/head
mateusz.kalinowski 2021-09-08 15:26:41 +01:00
parent f8db068f8c
commit ad0eb0eaa6
1 changed files with 5 additions and 2 deletions

View File

@ -411,8 +411,11 @@ typedef struct nsapi_stagger_req {
/** nsapi_msghdr
*/
typedef struct MBED_ALIGN(max_align_t) nsapi_msghdr {
nsapi_size_t len; /* Data byte count, including header */
typedef struct nsapi_msghdr {
/* In C alignment can't be specified in the type declaration.
* Specifying it in the first member definition will affect whole structure.
*/
MBED_ALIGN(max_align_t) nsapi_size_t len; /* Data byte count, including header */
int level; /* Originating protocol */
int type; /* Protocol-specific type */
} nsapi_msghdr_t;