include: json: reorder designated initializers

This patch reorders designated initializers to satisfy C++ requiring
that designated initializers appear in the same order as the members
they initialize.

Signed-off-by: Markus Fuchs <markus.fuchs@de.sauter-bc.com>
This commit is contained in:
Markus Fuchs 2019-07-18 20:00:15 +02:00 committed by Andrew Boie
parent 779381b5fc
commit 477399627d

View file

@ -130,10 +130,10 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
#define JSON_OBJ_DESCR_PRIM(struct_, field_name_, type_) \
{ \
.field_name = (#field_name_), \
.field_name_len = sizeof(#field_name_) - 1, \
.offset = offsetof(struct_, field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(#field_name_) - 1, \
.type = type_, \
.offset = offsetof(struct_, field_name_), \
}
/**
@ -164,10 +164,10 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
#define JSON_OBJ_DESCR_OBJECT(struct_, field_name_, sub_descr_) \
{ \
.field_name = (#field_name_), \
.field_name_len = (sizeof(#field_name_) - 1), \
.offset = offsetof(struct_, field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = (sizeof(#field_name_) - 1), \
.type = JSON_TOK_OBJECT_START, \
.offset = offsetof(struct_, field_name_), \
.object = { \
.sub_descr = sub_descr_, \
.sub_descr_len = ARRAY_SIZE(sub_descr_), \
@ -203,15 +203,15 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
len_field_, elem_type_) \
{ \
.field_name = (#field_name_), \
.field_name_len = sizeof(#field_name_) - 1, \
.offset = offsetof(struct_, field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(#field_name_) - 1, \
.type = JSON_TOK_LIST_START, \
.offset = offsetof(struct_, field_name_), \
.array = { \
.element_descr = &(struct json_obj_descr) { \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.type = elem_type_, \
.offset = offsetof(struct_, len_field_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
}, \
.n_elements = (max_len_), \
}, \
@ -260,19 +260,19 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
len_field_, elem_descr_, elem_descr_len_) \
{ \
.field_name = (#field_name_), \
.field_name_len = sizeof(#field_name_) - 1, \
.offset = offsetof(struct_, field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(#field_name_) - 1, \
.type = JSON_TOK_LIST_START, \
.offset = offsetof(struct_, field_name_), \
.array = { \
.element_descr = &(struct json_obj_descr) { \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.type = JSON_TOK_OBJECT_START, \
.offset = offsetof(struct_, len_field_), \
.object = { \
.sub_descr = elem_descr_, \
.sub_descr_len = elem_descr_len_, \
}, \
.offset = offsetof(struct_, len_field_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
}, \
.n_elements = (max_len_), \
}, \
@ -330,19 +330,19 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
elem_descr_, elem_descr_len_) \
{ \
.field_name = (#field_name_), \
.field_name_len = sizeof(#field_name_) - 1, \
.offset = offsetof(struct_, field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.type = JSON_TOK_LIST_START, \
.array = { \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(#field_name_) - 1, \
.type = JSON_TOK_LIST_START, \
.offset = offsetof(struct_, field_name_), \
.array = { \
.element_descr = &(struct json_obj_descr) { \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.type = JSON_TOK_LIST_START, \
.offset = offsetof(struct_, len_field_), \
.object = { \
.sub_descr = elem_descr_, \
.sub_descr_len = elem_descr_len_, \
}, \
.offset = offsetof(struct_, len_field_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
}, \
.n_elements = (max_len_), \
}, \
@ -369,10 +369,10 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
struct_field_name_, type_) \
{ \
.field_name = (json_field_name_), \
.field_name_len = sizeof(json_field_name_) - 1, \
.offset = offsetof(struct_, struct_field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(json_field_name_) - 1, \
.type = type_, \
.offset = offsetof(struct_, struct_field_name_), \
}
/**
@ -395,10 +395,10 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
struct_field_name_, sub_descr_) \
{ \
.field_name = (json_field_name_), \
.field_name_len = (sizeof(json_field_name_) - 1), \
.offset = offsetof(struct_, struct_field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = (sizeof(json_field_name_) - 1), \
.type = JSON_TOK_OBJECT_START, \
.offset = offsetof(struct_, struct_field_name_), \
.object = { \
.sub_descr = sub_descr_, \
.sub_descr_len = ARRAY_SIZE(sub_descr_), \
@ -431,15 +431,15 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
elem_type_) \
{ \
.field_name = (json_field_name_), \
.field_name_len = sizeof(json_field_name_) - 1, \
.offset = offsetof(struct_, struct_field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(json_field_name_) - 1, \
.type = JSON_TOK_LIST_START, \
.offset = offsetof(struct_, struct_field_name_), \
.array = { \
.element_descr = &(struct json_obj_descr) { \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.type = elem_type_, \
.offset = offsetof(struct_, len_field_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
}, \
.n_elements = (max_len_), \
}, \
@ -497,18 +497,18 @@ typedef int (*json_append_bytes_t)(const char *bytes, size_t len,
elem_descr_len_) \
{ \
.field_name = json_field_name_, \
.field_name_len = sizeof(json_field_name_) - 1, \
.offset = offsetof(struct_, struct_field_name_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.field_name_len = sizeof(json_field_name_) - 1, \
.type = JSON_TOK_LIST_START, \
.offset = offsetof(struct_, struct_field_name_), \
.element_descr = &(struct json_obj_descr) { \
.align_shift = Z_ALIGN_SHIFT(struct_), \
.type = JSON_TOK_OBJECT_START, \
.offset = offsetof(struct_, len_field_), \
.object = { \
.sub_descr = elem_descr_, \
.sub_descr_len = elem_descr_len_, \
}, \
.offset = offsetof(struct_, len_field_), \
.align_shift = Z_ALIGN_SHIFT(struct_), \
}, \
.n_elements = (max_len_), \
}