Skip to content

Commit ad0eb0e

Browse files
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.
1 parent f8db068 commit ad0eb0e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

connectivity/netsocket/include/netsocket/nsapi_types.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,11 @@ typedef struct nsapi_stagger_req {
411411

412412
/** nsapi_msghdr
413413
*/
414-
typedef struct MBED_ALIGN(max_align_t) nsapi_msghdr {
415-
nsapi_size_t len; /* Data byte count, including header */
414+
typedef struct nsapi_msghdr {
415+
/* In C alignment can't be specified in the type declaration.
416+
* Specifying it in the first member definition will affect whole structure.
417+
*/
418+
MBED_ALIGN(max_align_t) nsapi_size_t len; /* Data byte count, including header */
416419
int level; /* Originating protocol */
417420
int type; /* Protocol-specific type */
418421
} nsapi_msghdr_t;

0 commit comments

Comments
 (0)